Abstract:
The existing pig counting system based on image processing are seriously affected by light conditions, and the counting accuracy is poor when pigs are crowded and obscured.To realize the intelligent pig counting, the paper proposed a counting scheme based on the improved instance segmentation algorithm was proposed in this study. Aiming at the problems of image illumination and target edge blur, Laplace operator was used to preprocess the images. The feature extraction network of MASK R-CNN network was improved by using Resnet-152 as the Mask R-CNN feature extraction network, and the original Feature Pyramid Network(FPN) was followed by a bottom-up enhancement path, which directly fused the low-level edge features with the high-level features to improve the recognition ability of the target edge bluring. The non maximum suppression process and loss function were optimized and improved to improve the segmentation accuracy. The experiments were carried out at three different real pig farms to verify the counting accuracy, respectively in Hebei province, Jilin province and Inner Mongolia. The size of the cage in Hebei pig farm was 5.5 m × 1.8 m, with an average of 12 pigs in a single pen, with a feeding density of 1.21 pigs/m2; the size of the cage in Jilin pig farm was 5.5 m × 3.9 m, with an average of 22 pigs in a single pen, and the average rearing density was 1.03 pigs/m2; the size of the cage in Inner Mongolia pig farm was 11.4 m × 5.28 m, with an average of 80 pigs in a single pen, the average feeding density was 1.32 pigs/m2. The RGB camera is wa nstalled on the top of the pen and acquired the image in daytime. 2 400 images were collected in total, and 2000 images were selected after image preprocessing, and 1 250 images of three pig farms were selected as the original data set according to the ratio of 2:2:1. The training set and verification set were enhanced to 1 500 and 150 images and 250 images for the test set, The experimental results showed that 98 images could realize exact counting and 2 images missed 1 pig in the Jilin pig farm, the accuracy of pig counting was 98%. In Hebei pig farm, 99 images could realize the exact counting and the accuracy of pig counting was 99%. For Inner Mongolia pig farms with high feeding density, the accuracy of pig counting was 86%, among the 50 test images, 7 images missed detection, 4 images missed 1 target, 3 images missed 2 targets, The results can provide the application of the artificial intelligent in agriculture field.