IEEE Access (Jan 2023)
An Efficient Neural Network for Pig Counting and Localization by Density Map Estimation
Abstract
Automatic pig counting and locating from camera images is one of the most important tasks in modern pig farming industry, which helps farmers to improve the efficiency of the livestock management in pig feeding, welfare estimation, unexpected events monitoring and etc. Due to the complex and diverse pigpen environment, complicated distributions of pig population and various motions of live pigs, traditional image processing techniques are not effective in counting and locating pigs in crowds. Thus, this task relies on manual labor heavily which is time-consuming and error-prone. In this paper, we propose an efficient and accurate pig counting method for top-view surveillance images in large-scale, crowded feeding scenes. The proposed method is composed of a novel density map generator and a density map estimation network architecture. The pigs in images are expressed as ellipses and their group density is generated with elliptical 2D Gaussian distribution. The proposed network is designed with efficient hybrid blocks including selective kernel convolution and vision transformer for feature extraction and density map regression. The total number of pigs in one image can be calculated by summing entire values in the density map. We also apply a modified K-means clustering algorithm on the density map to locate pig targets. To verify the effectiveness and precision of the proposed method, we evaluate our proposed method on our testing dataset. The Mean Absolute Error of counting numbers on testing images is 0.726. Due to lightweight design by using depth-wise separable convolutions and hybrid-vit blocks, our proposed method has very fast inference speed and will reduce dependency on computing resources substantially when deployed in pig farms. Based on the accurate estimated density maps of the testing images, pig locating can also achieve pretty good results. The modified K-means clustering algorithm proposed in this paper obtain target locating with 88.22% precision and 86.02% recall respectively. These results indicate our proposed method can accurately count pigs in piggery by density map estimation and locate pig targets even in crowded situations.
Keywords