applied sciences  
Research on Contactless Detection of Sow Backfat Thickness Based on Segmented Images with Feature Visualization  
[PERSON] 1,2, [PERSON] 1,2,3,4, [PERSON] 5, [PERSON] 1,2, [PERSON] 2,6 and [PERSON] 1,2,*  
* [1]College of Engineering, Huazhong Agricultural University, Wuhan 430070, China; 1592750347898163.com (T.C.); [EMAIL_ADDRESS] (XL.L.); [EMAIL_ADDRESS] (HL.)
* [2]Sherzhen Institute of Nutrition and Health, Huazhong Agricultural University, Shenzhen 518000, China; [EMAIL_ADDRESS]
* [3]Agricultural Genomics Institute at Shenzhen, Chinese Academy of Agricultural Sciences, Shenzhen 518000, China
* [4]Shenzhen Branch, Guangdong Laboratory for Lingnan Modern Agriculture, Shenzhen 518000, China
* [5]Hubei Hongshan Laboratory, Wuhan 430070, China; [EMAIL_ADDRESS]
* [6]Key Laboratory of Smart Farming for Agricultural Animals, Ministry of Agriculture and Rural Affairs, Wuhan 430070, China
* [7]Correspondence: [EMAIL_ADDRESS]  
Aiming to address the problem that the existing methods for detecting sow backfat thickness are stressful, costly, and cannot detect in real time, this paper proposes a non-contact detection method for sow backfat with a residual network based on image segmentation using the feature visualization of neural networks. In this paper, removing the irrelevant information of the image to improve the accuracy of the sow backfat thickness detection model is proposed. The irrelevant features in the corresponding image of the feature map are found to have the same high brightness as the relevant feature regions using feature visualization. An image segmentation algorithm is then used to separate the relevant feature image regions, and the model performance before and after image segmentation is compared to verify the feasibility of this method. In order to verify the generalization ability of the model, five datasets were randomly divided, and the test results show that the coefficients of determination (R\({}^{2}\)) of the five groups were above 0.89, with a mean value of 0.91, and the mean absolute error (MAE) values were below 0.66 mm, with a mean value of 0.54 mm, indicating that the model has high detection accuracy and strong robustness. In order to explain the high accuracy of the backfat thickness detection model and to increase the credibility of the application of the detection model, using feature visualization, the irrelevant features and related features of the sow back images extracted by the residual network were statistically analyzed, which were the characteristics of the hip edge, the area near the body height point, the area near the backfat thickness measurement point (P2), and the lateral contour edge. The first three points align with the previous research on sow backfat, thus explaining the phenomenon of the high accuracy of the detection model. At the same time, the side contour edge features were found to be effective for predicting the thickness of the back. In order to explore the influence of irrelevant features on the accuracy of the model, UNet was used to segment the image area corresponding to the irrelevant features and obtain the sow contour image, which was used to construct a dorsal fat thickness detection model. The R\({}^{2}\) results of the model were above 0.91, with a mean value of 0.94, and the MAE was below 0.65 mm, with a mean value of 0.44 mm. Compared to the test results of the model before segmentation, the average R\({}^{2}\) of the model after segmentation increased by 3.3%, and the average MAE decreased by 18.5%, indicating that irrelevant features will reduce the detection accuracy of the model, which can provide a reference for farmers to dynamically monitor the backfat of sows and accurately manage their farms.  
backfat thickness; non-contact detection; feature visualization; residual network