| Instance segmentation is a key technology in the field of computer vision,which can realize pixel level segmentation of images and accurately extract interest objects.At present,breeding enterprises show a trend of large-scale development,biological assets continue to increase,the traditional manual counting method is inefficient and accuracy is not guaranteed,large-scale breeding enterprises have an urgent need for intelligent counting equipment.To solve this problem,this paper aims to build an intelligent counting system based on instance segmentation technology,without human intervention,to achieve accurate and real-time counting of pigs.Firstly,the paper studies the instance segmentation algorithm of deep learning ——Mask R-CNN,and designs experiments to analyze the detection performance of the algorithm,providing a theoretical basis for the improvement of the algorithm and the application in practical scenarios.The experimental results show that when the Intersection-over Union between the target bounding boxes exceed 35%,the visible area is less than 62×34 pixels when the target is under occlusion,or the edge of the target is blurred,the model could not accurately segment targets,and the missed detection problem existed.According to the characteristics of actual images,the main problem of this paper is the occlusion problem between targets.In addition,the experiment proves that the target area in the overhead view of the group rearing pen is larger,and the problem of occlusion is alleviated to some extent.In the application scene,the image was taken from the overhead angle.Secondly,the paper improves Mask R-CNN algorithm to solve the problem of omission of occlusion target.Feature Pyramid Network with fast path enhancement is designed to improve the recognition ability of the model to occlude targets and to the edge fuzzy targets.The Non-Maximum Suppression process is improved to avoid the problem of missed detection caused by the Intersection-over Union between bounding boxes being greater than the set threshold.The repulsion loss is introduced,which makes the prediction box close to the real bounding box of the target and far away from the bounding box of other targets.At the same time,Region Proposal Network network is optimized to solve the problem of missed detection of small scale targets.The average accuracy of the improved network in the test set is 78.6%,an improvement of 9% over the original network.In addition,no target missed detection when the Intersection-over Union between the target boundary boxes was no more than 55% and the target visible area was no less than 24×24 pixels.Finally,the improved Mask R-CNN network is integrated with the target counting task.The images of the application scenes are collected in batches and build our dataset,which were used for network training and testing.The results shows that the mean absolute error of the counting model is 0.2,and the root mean square error RMSE is 0.55.The accuracy and stability of the network were relatively good,which basically meets the needs of practical applications. |