1. Introduction
With the continuous development of precision agriculture, precise and intelligent breeding methods have been widely discussed. In modern farm management, it is necessary to collect different types of information on sheep, such as vaccination information and pregnancy status. Collecting different types of information can help farmers manage their farms, further develop effective management strategies, improve feeding methods, and reduce feeding costs [
1,
2]. Before collecting various information about individual sheep, it is necessary to determine their corresponding identities. Meanwhile, sheep identification can help prevent diseases and further promote sheep growth. In addition, the identification of individual sheep can lead to the traceability of meat product quality and further meet the needs of people for high-quality meat. Therefore, the automatic identification of individual sheep has become indispensable.
Traditional sheep recognition methods include paint marking, manual observation, and invasive equipment technology [
3,
4]. However, traditional methods have limitations. The manual observation method has low efficiency and accuracy and is not suitable for large-scale sheep flocks. The paint marking method requires frequent maintenance and cleaning. The use of radio frequency identification (RFID) tags can bring pressure on animals. In addition, tags are often damaged, lost, and easily disturbed in complex environments [
5,
6]. Considering that sheep are usually raised in groups, which makes it difficult and time-consuming to collect information about each sheep, it may be inconvenient for farmers to manage their farms by relying on traditional sheep recognition methods [
7].
With the development of information technology, biological image recognition has received more and more attention and has become a promising trend in animal identification. Biological image recognition technology takes advantage of intelligent monitoring equipment and computer vision to obtain the stable biological features of sheep, including their DNA fingerprints, iris patterns, and facial images [
8,
9]. Among these methods, recognition methods based on iris patterns and DNA fingerprints face many challenges. Collecting clear and stable iris images is relatively difficult, and changes in brightness during the collection process can easily lead to acquisition failure [
10,
11]. The accuracy of identifying individual sheep through DNA fingerprints is high, but the recognition time is long, so real-time detection cannot be achieved. In contrast, sheep face recognition is a low-cost and efficient recognition method that is currently the mainstream research direction for sheep biological image recognition.
In recent years, scholars have used computer vision technology to recognize livestock faces, and various CNNs have been developed for the task of identification [
12,
13,
14]. Song et al. [
15] used an improved YOLOv3 model to recognize 20 adult Sunit sheep, and the mAP reached 97.2%. Although the model size of improved YOLOv3 has been reduced from the initial 235 MB to 61 MB to reduce computational costs, the recognition model still has large parameters, which is not conducive to deployment on mobile devices. In addition, the number of experimental sheep is relatively small, and it is difficult to identify comprehensive and detailed sheep face features in the constructed sheep face dataset. Billah et al. [
16] collected 3278 photos of goats, including open-source images and manually captured facial images of 10 dairy goats, and used the YOLOv4 model for facial recognition, achieving a recognition accuracy of 96.4%. However, the model size of YOLOv4 is 244 MB, so it does not have advantages in terms of model size or recognition speed. Considering that YOLOv3 and YOLOv4 are versions before the YOLO series, although they have achieved high performance in sheep face recognition tasks, the models are relatively large in model size and are not suitable for practical applications of sheep face recognition. Hitelman et al. [
17] used the ResNet50V2 model combined with the ArcFace loss function to train the facial images of 81 young Assaf sheep with an average recognition accuracy of 97%. However, the size of the ResNet50V2 model is about 98 MB, and the model parameters are too large, which is not conducive to deployment on mobile devices. Although CNNs have achieved good results in sheep face recognition, the sizes of the relevant sheep face recognition models are too large, the recognition times are long, and the costs of deployment to mobile devices are not considered. Deploying a sheep face recognition model on mobile devices meets the needs of practical applications. In practical applications, herders can collect, identify, and save information on sheep at any time, making it more convenient and efficient to collect various information about sheep and further improving the efficiency of farm management. In addition, compared to the upper computer control system, the cost of designing and developing a mobile recognition system is lower. To our knowledge, there is currently limited research on lightweight sheep face recognition models and mobile system design, and further evaluation and development are needed.
YOLO (You Only Look Once) is a high-performance recognition model [
18,
19,
20]. YOLOv5 has attracted more and more attention with the development of the YOLO series of algorithms [
21,
22]. There are four versions of YOLOv5, of which the YOLOv5s model has obvious advantages in FLOPs and parameters. The model size of YOLOv5s is 14 MB, which shows the potential for its deployment on an intelligent mobile terminal. In this study, an improved lightweight model based on YOLOv5s was developed and named LSR-YOLO. Firstly, the lightweight ShuffleNetv2 module replaced the feature extraction module in the backbone of YOLOv5s, effectively reducing the model size and FLOPs. Through the comparison of several improved models, we found that the loss of
[email protected] was minimal when the Ghost module was introduced into the neck of YOLOv5s. For the C3 module in the neck of YOLOv5s, we integrated the Ghost module and further built a lightweight C3Ghost module to reduce the model size and FLOPs. Finally, the CA attention module was introduced in the backbone to enhance the feature extraction ability of recognition model. Extensive experiments showed that the LSR-YOLO achieves the desired performance compared to existing detection methods. The main contributions of this study are as follows:
(1) A novel, lightweight sheep face detection method called LSR-YOLO was proposed. The model size of LSR-YOLO is only 9.5 MB. Experiments showed that LSR-YOLO achieves a good balance in detection efficiency, model size, and detection accuracy.
(2) We deployed LSR-YOLO on the mobile end and further designed a mobile recognition system, which provides technical support for the development of sheep face recognition system on the the mobile end.
The paper is organized as follows: in “
Section 2,” we introduced the details of shooting sheep facial images in detail and the steps of constructing sheep face dataset. In addition, we introduced the model architecture and the details of the improved modules. In “
Section 3,” we described the details of the comparison experiments and presented the detailed experimental results. In “
Section 4,” we introduced the facial image acquisition device of sheep, the sheep face mobile recognition system, and future research directions. “
Section 5” summarizes the research of this paper.
4. Discussion
In this study, a lightweight sheep face recognition model named LSR-YOLO was constructed to recognize the corresponding identity of a sheep face image. LSR-YOLO has great advantages in recognition accuracy and model size. The experimental results on the self-made sheep face dataset show that the
[email protected] of the LSR-YOLO model reaches 97.8%. In addition, the model size of LSR-YOLO is only 9.5 MB, which provides a method for the deployment of a mobile terminal identification system.
The sheep face dataset in this study only collected facial images of small-tailed Han sheep, and there may be deviations in the recognition results of other breeds of sheep. Therefore, in future research, we will continue to expand the scale of the sheep face dataset by adding facial images of more breeds of sheep to further increase the diversity of the dataset.
Sheep face image acquisition is difficult because sheep are emotionally sensitive and prone to extreme behavior. Therefore, it will be beneficial to develop a sheep face image acquisition device to solve these problems. The acquisition device can be paired with a server system to save the acquired images, and the model can be retrained on the face images of newly arrived sheep. This method would be expected to identify more sheep. To solve the above problems, we designed a set of sheep facial image acquisition devices, their structure mainly including a mobile phone, camera, and conveyor belt. The sheep facial image acquisition device is shown in
Figure 13. Specifically, the mobile phone is connected to a USB camera to video-record the sheep’s facial images passing through the conveyor belt. The two groups of conveyor belts form a V-shaped structure to fix the body of the sheep. When the sheep pass through the conveyor belt structure, the conveyor belt helps the sheep move forward to prevent the sheep from stopping and causing congestion. In addition, the conveyor belt structure can prevent sheep from having a stress reaction. At present, the equipment is in the testing stage, and we will promote it in the future.
Face images of individuals from the same breed of sheep are highly similar. Taking the small-tailed Han sheep as an example, some sheep have different details, including yellow spots, black spots, and ear shapes. By collecting sheep face images from multiple perspectives for training, the recognition model can learn richer and more robust details, thus improving its recognition accuracy. In the future, we will optimize the sheep facial image acquisition device to achieve the effects of collecting multiple facial images at the same time.
In the long run, developing a mobile recognition system—specifically, integrating a lightweight sheep face recognition model into a mobile phone and developing a sheep face recognition application—would be beneficial. Herders could access real-time information about sheep through their mobile phones, further increasing management efficiency. In addition, herdsmen could also use the camera on their mobile phones to capture target images, further identifying target identities and obtaining target information. Mobile end recognition would provide herdsmen with a more convenient and efficient recognition method. The identified results could be transmitted to a centralized server on the farm through a local area network on a 5G network. Our vision is to propose a lightweight sheep face recognition model for sheep face recognition, thereby reducing recognition time and saving deployment costs.
In this study, we developed a mobile sheep face recognition system. This recognition system was designed using Android Studio. The sheep face recognition system is divided into three modules: image selection, image display, and recognition results. Each module was designed independently to realize the functions of image recognition, analysis, and preservation. A sheep face recognition control system can recognize sheep face images effectively and provide corresponding identity information in the system. Administrators can view, update, and save information in real-time. The interface of the mobile sheep face recognition system is shown in
Figure 14.
In future research, more models in the field of computer vision need to be evaluated and developed to face the challenge of sheep face recognition. In long-term planning, sheep face recognition is also meant to develop models for livestock tracking, counting, emotional analysis, and weight estimation. By integrating multiple algorithms, the collected information is transmitted in real-time to the central server of the farm, achieving the construction of big data farms and meeting the needs of modern and welfare farming [
39,
40]. The sheep face dataset used in this study currently has project partnerships with some companies, and as the project collaboration has not yet ended, the dataset is currently not publicly available. In the future, we will consider making this dataset publicly available for easy access.