Parallel channel and position attention-guided feature pyramid for pig face posture detection - Hu, Zhiwei; Yan, Hongwen; Lou, Tiantian (International Journal of Agricultural and Biological Engineering, 2022)
The area of the pig’s face contains rich biological information, such as eyes, nose, and ear. The high-precision detection of pig face postures is crucial to the identification of pigs, and it can also provide fundamental archival information for the study of abnormal behavioral characteristics and regularities. In this study, a series of attention blocks were embedded in Feature Pyramid Network (FPN) for automatic detection of the pig face posture in group-breeding environments. Firstly, the Channel Attention Block (CAB) and Position Attention Block (PAB) were proposed to capture the channel dependencies and the pixel-level long-range relationships, respectively. Secondly, a variety of attention modules are proposed to effectively combine the two kinds of attention information, specifically including Parallel Channel Position (PCP), Cascade Position Channel (CPC), and Cascade Channel Position (CCP), which fuse the channel and position attention information in both parallel or cascade ways. Finally, the verification experiments on three task networks with two backbone networks were conducted for different attention blocks or modules. A total of 45 pigs in 8 pigpens were used as the research objects. Experimental results show that attention-based models perform better. Especially, with Faster Region Convolutional Neural Network (Faster R-CNN) as the task network and ResNet101 as the backbone network, after the introduction of the PCP module, the Average Precision (AP) indicators of the face poses of Downward with head-on face (D-O), Downward with lateral face (D-L), Level with head-on face (L-O), Level with lateral face (L-L), Upward with head-on face (U-O), and Upward with lateral face (U-L) achieve 91.55%, 90.36%, 90.10%, 90.05%, 85.96%, and 87.92%, respectively. Ablation experiments show that the PAB attention block is not as effective as the CAB attention block, and the parallel combination method is better than the cascade manner. Taking Faster R-CNN as the task network and ResNet101 as the backbone network, the heatmap visualization of different layers of FPN before and after adding PCP shows that, compared with the non-PCP module, the PCP module can more easily aggregate denser and richer contextual information, this, in turn, enhances long-range dependencies to improve feature representation. At the same time, the model based on PCP attention can effectively detect the pig face posture of different ages, different scenes, and different light intensities, which can help lay the foundation for subsequent individual identification and behavior analysis of pigs. Keywords: objection detection, attention mechanism, feature pyramid network, face posture detection, pig DOI: 10.25165/j.ijabe.20221506.7329 Citation: Hu Z W, Yan H W, Lou T T. Parallel channel and position attention-guided feature pyramid for pig face posture detection. Int J Agric & Biol Eng, 2022; 15(6): 222–234.