How to realize the rapid and automatic identification of individuals in the pig group has always been a difficult point in the field of large-scale breeding.Traditional methods such as ear tags,manual observation,and tattoos have many problems,and it is difficult to meet the needs of large-scale pig farm automation management.Therefore,how to apply intelligent methods to realize the automatic,effective and rapid identification of individual pigs and establish a traceable pig breeding platform has important practical significance for improving the management level of large-scale farming.In order to solve the above actual situation,this thesis proposes a convolutional neural network method based on target detection,drawing on the harmless non-invasive recognition method,and the YOLOv5 algorithm to identify pig faces for identification.At the same time,the attention mechanism is introduced to improve the method.The workflow of this study is summarized as follows:(1)The experimental data set of pig identification marked by LabelImg was constructed.It includes video footage of 30 landrace pigs and 34 fattening black pigs.Among them,the landrace pig data comes from the public video materials provided by the JDD-2017 JD Finance Global Data Explorer Competition,and the fattening black pig data comes from field shooting on the pig farm.By converting video data into image data,and performing preprocessing operations such as similarity deduplication,image standardization,etc.,and finally manually annotating the data,18,581 pig face images were obtained,and an experimental data set for pig face detection was constructed,and processed A good data set is divided according to the training set and test set 8:2.(2)An improved model for pig individual identification based on YOLOv5-CA is proposed.Firstly,by analyzing the experimental results and performance indicators of three different detection algorithms SSD,Fast R-CNN and YOLOv5 on pig face recognition,the original model of YOLOv5 is selected,and then two different attention mechanism modules,ECA and CA,are proposed for comparison.Experiment to get the optimal recognition algorithm to improve the detection accuracy.The algorithm optimization part takes this as an idea,and conducts a series of improvement verification experiments respectively.The final experimental results show that the experimental effect of the YOLOv5+CA module algorithm is the best.In the 64 pig data sets,the average detection accuracy reached 84.91%,which increased by 3.59% based on the original algorithm,the recall rate increased by 2.15%,and the precision rate increased by 4.69%.And can be applied to smart mobile devices.(3)A pig identification verification platform based on the improved YOLOv5 algorithm is designed.The platform takes the improved model proposed in this thesis as the core,adopts the front-end and back-end separation mode,uses the Flask framework to deploy the model on the mobile platform,and tests and verifies the detection and recognition performance of the model on two pig face detection datasets.It has been verified that the improved model has a detection speed of 45ms/sheet and a detection accuracy 3.59%higher than the original model.The highest accuracy of the model on individual pig identification can reach 84.91%.In addition,the platform can also be used for filing,carding and real-time reporting of pig breeding information. |