| Identification is a fundamental task for precision farming in the modern sheep industry.It is of significant importance for the sustainable development of the livestock industry.At present,traditional marker identification methods have disadvantages such as easy detachment and limited detection distance.With the development of computer vision technology,identity recognition technology based on deep learning has been widely applied,which also lays the foundation for solving the sheep identity problem.Due to the high similarity of sheep appearance,and factors such as lighting conditions and background complexity have a great impact on recognition accuracy,the existing recognition methods do not make use of additional semantic information,and in order to achieve a high accuracy rate,their model complexity is high,and the computational and parametric quantities are very large,making it difficult to deploy applications in practical scenarios.Therefore,this study proposes a metric learningbased identity recognition method using an attention-guiding mechanism for skeleton key parts that balances accuracy and efficiency,and develops a system to deploy it to improve practical applications.The specific research work is as follows.(1)Construction of the sheep skeletons keypoint detection model based on transformer and scale fusion.A total of 1800 images of sheep in different poses and scenes were first collected.17 key points were manually annotated,and the dataset was prepared using various data enhancement methods.Then,an improved Transformer encoder was introduced into the highdimensional feature extraction layer of the HRNet network to capture the spatially constrained relationships between the key points; a multi-scale information fusion module was introduced to improve the learning ability of the model for features of different dimensions.Experimental results show that the improved model reduces the number of parameters by 86.8% compared to HRNet-48 and achieves an accuracy of 75% on the key point dataset.It has the highest accuracy and better detection speed than other comparison models,especially for small-scale images.The visualisation experiments verified that the model can respond to the spatial relationships between skeleton pose of the sheep,providing additional semantic information for the subsequent individual identification model.(2)Construction of an individual identification model for sheep based on skeletal attention guidance.To address the problem that the existing identity datasets are small in scale and mostly closed sets,a total of 7991 images of 234 sheep were collected to create a sheep identity dataset.Based on the idea of knowledge distillation,a network structure using the skeleton attention guidance mechanism is proposed.Firstly,an adaptive pooling module and a skeleton pose feature alignment module are designed to adequately match the skeleton information by spatially aligning the images; secondly,a metric learning loss is designed by combining cross entropy,consistent and triplet.The proposed method can make the identity recognition network focus more on the critical regions in the image and improve recognition accuracy while ensuring efficiency.The experimental results show that the proposed method achieves 74.4% m AP and 96.2% Rank-1,both higher than the rest of the comparison methods.Comparative experiments on a variety of mainstream neural networks all obtained improved accuracy,demonstrating the effectiveness and generalisation of the proposed method.The interpretability of the method was analysed by ablation experiments and visualisation experiments.(3)Design and implementation of a sheep identification system.To address the problem that deep learning models are difficult to use in practical application scenarios,an interactive sheep identification system is designed and developed based on web technology.By optimizing and accelerating the model and deploying it to the server,the whole process can be processed in 0.2 seconds for a single frame,realizing real-time detection and recognition of sheep and visualizing the results,which is important for promoting the implementation of sheep identification applications. |