applied sciences  
A Lightweight Pig Face Recognition Method Based on Automatic Detection and Knowledge Distillation [PERSON] 1, [PERSON] 1, [PERSON] 2, [PERSON] 2 and [PERSON] 2,*()  
Footnote 1: [[https://www.mdpi.com/journal/applsci](https://www.mdpi.com/journal/applsci)]([https://www.mdpi.com/journal/applsci](https://www.mdpi.com/journal/applsci))  
Footnote 2: [[https://www.mdpi.com/journals/applsci](https://www.mdpi.com/journals/applsci)]([https://www.mdpi.com/journals/applsci](https://www.mdpi.com/journals/applsci))  
Footnote 3: [[https://www.mdpi.com/journals/applsci](https://www.mdpi.com/journals/applsci)]([https://www.mdpi.com/journals/applsci](https://www.mdpi.com/journals/applsci))  
Footnote 4: [[https://www.mdpi.com/journals/applsci](https://www.mdpi.com/journals/applsci)]([https://www.mdpi.com/journals/applsci](https://www.mdpi.com/journals/applsci))  
Footnote 5: [[https://www.mdpi.com/journals/applsci](https://www.mdpi.com/journals/applsci)]([https://www.mdpi.com/journals/applsci](https://www.mdpi.com/journals/applsci))  
Footnote 6: [[https://www.mdpi](https://www.mdpi)]([https://www.mdpi](https://www.mdpi)). and use readers to monitor and manage their behavior, health status, and production data. An HF RFID system demonstrated impressive results in recording pig drinking behaviors, with an accuracy of 93% when cross-referenced with visual observations [6]. Similarly, the application of UHF RFID showcased potential in tracking feeding behaviors, achieving a 96% accuracy [7]. While RFID systems are prevalent, they are costly, especially when deployed on a large-scale farm [8]. In addition, the requirement for physical implantation presents ethical dilemmas concerning animal welfare. In recent years, researchers have been focusing on utilizing non-invasive deep learning-based automatic animal face recognition technology to track and monitor the health of animals, inspired by advancements in human face recognition technology [9; 10; 11; 12; 13]. Although some relevant studies [14] have achieved promising results in automatic animal recognition tasks, such as sheep [15], cattle [16], birds [17], and pigs [18], existing pig face recognition models, primarily based on comprehensive Convolutional Neural Networks (CNNs), face challenges of high computational demands and reliance on extensive labeled data, limiting their practical deployment in resource-constrained environments. The comprehensive CNN architectures, as employed in the aforementioned studies, offer robust feature extraction capabilities and exceptional performance due to the depth and intricacy of their stacked convolutional layers [19]. However, this sophistication comes at a cost. The significant model sizes and dense architectural designs inherently lead to high computational complexity. In practical applications, deploying CNN algorithms in embedded systems requires efficient memory utilization, low-cost operators, and compact weight representations. Hence, recent works have sought to pivot towards lightweight models, acknowledging the significance of reduced complexity in embedded systems. However, a dilemma arises. While these slim models have fewer parameters, making them amenable for embedded deployments, they often compromise on accuracy, underperforming when compared to their horizter counterparts. Meanwhile, existing pig face recognition studies typically employ one of two methods: manually cropping pig faces from images or using end-to-end two-stage models that automatically detect and then identify pig faces. The former is time-consuming and not scalable for large datasets, while the latter relies heavily on large annotated datasets. Moreover, these end-to-end models require re-annotation when applied to new data, making them less feasible for practical applications. To bridge the existing shortcomings in the pig face recognition task, firstly, a two-stage pig face recognition model was proposed that decoupled the detection from recognition. The advantage of this is that we reduce the need for repetitive annotation tasks.