| In the process of modern dairy farming,it is very important to identify individual cows quickly and accurately for daily management such as selection,feeding,milk production records and so on.With the popularization of camera equipment,it has become possible to achieve contactless and stress-free identification of individual cows based on image biometrics,while the development of artificial intelligence technology has provided technical support for individual cow facial identification.This paper takes the individual dairy cows in the natural environment of the farm as the detection target,and uses the deep learning technology to carry out the research on the facial recognition of dairy cows,which provides an effective method reference for the individual identification of dairy cows in precision breeding.The main work is as follows:(1)A cow face dataset is established.The hand-held camera was used to shoot cows with different postures,growth periods,lighting and lactation stages,and a series of pre-processing such as video framing and image screening were used to construct datasets of cows with and without ear labeling.The ear-labeled dataset contains 17,263 cow face images in 71 categories,and the ear-annotated dataset contains 14,740 cow face images in 95 categories.(2)Taking the facial data of cows with ear annotations as the research object,an improved YOLO v4 cow facial recognition model fused with coordinate information is proposed.First,the coordinate attention mechanism is added to the feature extraction layer of the YOLO v4 network to improve the sensitivity of the cow’s face to the position,and then the coordinate convolution module is added to the detection head to further enhance the position information of the cow’s face.Finally,different models were used to recognize the cow face dataset,and the recognition effects of different occlusions and different colors of cows were compared to verify the recognition performance of the improved model.The experimental results show that the m AP of the improved YOLO v4 model reaches 93.68%,the average frame rate reaches 19frames/s,and the detection speed is fast;the m AP of the improved YOLO v4 model under occlusion is 89.43%,which can robustly cope with the challenge of face occlusion of cows in different breeding environment;the m AP of the improved YOLO v4 model in the black and black-and-white cow face images is 90.42% and 96.45% respectively,indicating that the improved YOLO v4 model has a strong ability of cow face recognition.(3)Taking the facial data of cows without ear annotations as the research object,an improved YOLO x-s cow facial recognition model fused with attention mechanism is proposed.First,in order to better extract cow facial features,in the feature fusion part of the model,part of the Concat operation of the original YOLO x-s model is replaced by an iterative attention feature fusion module,and then a pyramid segmentation attention module is added to improve the recognition accuracy of the model.The experimental results show that the m AP of the improved YOLO x-s model reaches 95.74% and the average frame rate reaches 23frames/s;in the cow facial occlusion dataset,the m AP of the improved YOLO x-s model reaches 90.70%;in the facial recognition results of cows of different colors,the m AP of the improved YOLO x-s model in the black and black-and-white cow face images is 93.35% and98.46% respectively,indicating that the improved YOLO x-s model can well recognize the cow faces with different color features in different environments. |