Abstract:Realizing the accurate detection of moving cows in complex farming environment is the basis for behavioral perception of cows such as lameness detection and estrus behavior analysis. Aiming to solve the defects of the existing methods using parametric model to achieve the target detection of moving cows, a background modeling method based on nonparametric kernel density estimation was proposed. The probability model of the pixel was estimated according to the historical sample of each pixel, which had the disadvantage of high complexity caused by the redundant information contained in the historical sample information. The key frame detection technique was adopted to eliminate the redundant information in the sample to reduce the complexity of the algorithm and the ability to acquire the remote frame image information by the kernel function under small samples to improve the detection accuracy. In view of the lack of detected target contours, the threeframe difference method was applied to further achieve a more complete extraction of moving targets. In order to verify the effectiveness of the proposed method, the video samples of moving cows under different environments and disturbances were tested and compared with the Gaussian mixture model and the Kernel density estimation model. The experimental results showed that the average detection rate of the proposed algorithm was 95.65%, which was 15.56 percentage points higher than that of the Gaussian mixture model and 10.56 percentage points higher than that of the Kernel density estimation model. It also showed that the research algorithm had greater improvement than the Gaussian mixture model and the Kernel density estimation model in complex environments such as sunny, rainy and night time. In addition, the average realtime indicator of the algorithm was 1.11, which can basically realize the realtime and accurate detection of moving cow targets. The results were of great significance for the prevention and diagnosis of dairy cows disease and the accurate perception of cows movement behaviors.