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 (R2) 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 R2 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 R2 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.
Read full abstract