Welcome to Francis Academic Press

Academic Journal of Computing & Information Science, 2023, 6(12); doi: 10.25236/AJCIS.2023.061203.

Detection of ear root feature region in heterogeneous images based on pig head posture


Qi Li, Shuanglin Nie

Corresponding Author:
Shuanglin Nie

School of Electronic Information and Artificial Intelligence, Shaanxi University of Science & Technology, Xi'an, 710021, China


In the scene of pig thermal infrared temperature measurement, the temperature of the ear root is closest to the body temperature of the pig. In order to address the problem of inaccurate positioning of the ear root area in the thermal infrared image of the pig under motion due to changes in the pig's head posture and single pixel information, based on the research of automatic inspection and temperature measurement robots, it is proposed to establish an ear root area detection model through visible light images, and map the detection results of the model to the thermal infrared image with the same contour information after registration, achieve accurate localization of the pig ear root area in the thermal infrared image. This algorithm achieves the detection of key points in pig heads in visible light images by improving the YOLOv8 network. By analyzing the position information of key points in pig heads through light shadow projection and dynamic coordinate system adjustment methods, the pig head posture and adjustment angle are obtained. The visible light image of the pig's head after angle adjustment is redivided into ear root regions to correct the impact of pig movement on ear root region division. By using AKAZE and GMA algorithms to extract and register features from heterogeneous images, visible and thermal infrared images with the same contour and scale information are obtained. Finally, the detection results of the ear root region in the visible light image are mapped to the thermal infrared image. Through testing on 2650 datasets, the accuracy of key point and category detection was 99%, the number of key point detection model parameters decreased by 41%, and the registration error was only 1.6%. The accuracy of ear root localization in heterogeneous images reached over 99%, making it easy to achieve accurate temperature measurement.


Pig ear root area, Key point detection, Pig head posture, Heterogeneous image registration

Cite This Paper

Qi Li, Shuanglin Nie. Detection of ear root feature region in heterogeneous images based on pig head posture. Academic Journal of Computing & Information Science (2023), Vol. 6, Issue 12: 20-32. https://doi.org/10.25236/AJCIS.2023.061203.


[1] SOERENSEN D D, CLAUSEN S,MERCER J B, et al. Determining the emissivity of pig skin for accurate infrared thermography[J]. Computers and Electronics in Agriculture, 2014,109:52-58.

[2] SYKES D J, COUVILLION J S, CROMIAK A, et al. The use of digital infrared thermal imaging to detect estrus in gilts[J].Theriogenology, 2012,78(1):147-152.

[3] TZANIDAKIS C,SIMITZIS P,ARVANITIS K, et al. An overview of the current trends in precision pig farming technologies[J]. Livestock Science,2021,249:104530.

[4] KAMMERSGAARD T S, MALMKVIST J, PEDERSEN L J. Infrared thermography-a non-invasive tool to evaluate thermal status of neonatal pigs based on surface temperature[J]. Animal, 2013, 7(12):2026-2034.

[5] ZHANG X, KANG X, FENG N, et al. Automatic recognition of dairy cow mastitis from thermal images by a deep learning detector[J]. Computers and Electronics in Agriculture, 2020,178:105754.

[6] FENG Y Z, ZHAO H T, JIA G F, et al. Establishment of validated models for non-invasive prediction of rectal temperature of sows using infrared thermography and chemometrics[J]. International Journal of Biometeorology, 2019, 63(10):1405-1415.

[7] STUKELJ M, HAJDINJAK M, PUSNIK I. Stress-free measurement of body temperature of pigs by using thermal imaging-useful fact or wishful thinking[J]. Computers and Electronics in Agriculture, 2022, 193:106656.

[8] Zhu Weixing, Liu Bo, Yang Jianjun, et al. Detection method of pig ear region based on improved active shape model [J]. Journal of Agricultural Machinery,2015,46(03):288-295.

[9] Ma Li, Zhang Xudong, Xing Zizheng, et al. FDSST detection method for surface temperature of pig ear roots based on skeleton scanning strategy [J]. Journal of Agricultural Machinery,2020,51(S1):371-377.

[10] Zhou Liping, Chen Zhi, Chen Da, et al. Ear root feature region detection in pig thermal infrared images based on improved Otsu algorithm [J]. Journal of Agricultural Machinery,2016,47(04):228-232+14.

[11] Liu Gang, Feng Yankun, Kang Xi. A thermal infrared video detection method for pig ear root temperature based on improved YOLO v4 [J]. Journal of Agricultural Machinery,2023,54(02):240-248.

[12] Feng Yankun, Kangxi, Wang Yanchao, et al. Method for detecting the temperature of pig ear roots based on thermal infrared video [J]. Journal of Agricultural Machinery,2021,52(S1):284-290.

[13] Zhao Haitao. Pig body temperature detection and key temperature measurement location recognition based on infrared thermal imaging technology [D]. Huazhong Agricultural University, 2019.

[14] Hulin Li,Hanbing Wei, Zheng Liu et al. Slim-neck by GSConv: A better design paradigm of detector architectures for autonomous vehicles[J]. Computer Vision and Pattern Recognition(CVPR),2022. 

[15] D. Ouyang et al., "Efficient Multi-Scale Attention Module with Cross-Spatial Learning," ICASSP 2023-2023 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Rhodes Island, Greece, 2023, pp. 1-5.

[16] Huang Zhijie, Xu Aijun, Zhou Suyin, et al. A Pig Face Key Point Detection Method Integrating Hyperparameterization and Attention Mechanism [J/OL]. Journal of Agricultural Engineering:1-9[2023-09-01].

[17] Xie Qiuju, Wu Mengru, Bao Jun, et al. Individual Pig Face Recognition by Integrating Attention Mechanism [J]. Journal of Agricultural Engineering,2022,38(07):180-188.

[18] Dongsheng Ruan, Daiyin Wang, Yuan Zheng, Nenggan Zheng, Min Zheng. Gaussian Context Transformer[J]. Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021.

[19] Yan Hongwen, Liu Zhenyu, Cui Qingliang, et al. Facial pose detection of group health preserving pigs based on improved Tiny YOLO model [J]. Journal of Agricultural Engineering,2019,35(18):169-179.

[20] Wang Lu, Liu Qing, Cao Yue, et al. Pig herd posture recognition based on improved Cascade Mask R-CNN and collaborative attention mechanism [J]. Journal of Agricultural Engineering, 2023,39 (04): 144-153. 

[21] Zhao Yifei. Research on Registration and Fusion Algorithms for Visible and Infrared Images [D]. Xi'an University of Electronic Science and Technology,2021.

[22] Duan Linfeng, Hou Xinguo, Hu Zhiyuan. NSCT contour and principal direction consistency infrared and visible image registration [J]. Electrooptic and control,2022,29(06):1-5.

[23] Zong Huilin, Yuan Xiping, Gan Shu, et al. Improved AKAZE algorithm for feature matching of unmanned aerial vehicle images in debris flow areas [J]. Surveying and Mapping Bulletin,2023(02):91-96+103.

[24] Xue Peng. Research on Substation Augmented Reality Inspection System Based on AKAZE Algorithm [D]. Northeast Petroleum University,2022.

[25] Zhou Rui. Research on Mobile Image Mosaic Algorithm Based on Improved AKAZE-GMS and Grid Optimization [D]. Central China Normal University,2021.

[26] Bian J W, Lin W Y, Liu, Matsushita Y, et al. GMS: Grid-Based Motion Statistics for Fast, Ultra-robust Feature Correspondence. International Journal of Computer Vision, 2020, 128(6):1850-1593.

[27] Hu Xin, Hu Luming, Liu Guihang. An improved GMS image feature point matching algorithm [J]. Electronic measurement technology,2021,44(17):131-137.

[28] Liu Shuai, Rui Ting, Wang Dong, et al. Research on Improved GMS Algorithm Based on Feature Matching Quality [J]. Electro Optics and Control,2021,28(07):31-34.

[29] Xiang Hengyong, Zhou Li, Ba Xiaohui, et al. Feature matching and filtering algorithm based on dynamic window motion statistical information [J]. Journal of South China University of Technology (Natural Science Edition),2020,48(06):114-122.

[30] Li Guangbo, Cha Wenwen, Chen Chengpeng, et al. Pig face recognition and detection method based on improved YOLOv5s [J]. Southwest Agricultural Journal,2023,36(06):1346-1356.