| In recent years,various computer vision algorithms have been widely applied in the fields of agriculture and animal husbandry to support the automation development of the industry.For the pig counting and inventory problem in the field of animal husbandry,compared with traditional manual counting and ear tag counting,machinevision-based methods can save a lot of manpower and resources,while also having advantages such as reducing the risk of transmission of infectious diseases in livestock and improving the efficiency of the breeding industry.Based on this,this article took pigs in intensive pig farms as the research object,created a pig dataset,used the improved YOLOv5 algorithm and NVIDIA AI development board to implement a pig inventory system,The specific works of this article are as follows:(1)In order to solve the problem of the lack of datasets for pig detection scenarios,this article collected pig image data through various approaches to create a pig dataset.The dataset includes images from intensive pig farms,images captured from videos of pigsty and pig channels and images obtained by web crawlers.The collected images were pre-processed and traditionally enhanced,then annotated according to the dataset annotation method.And for different intensive pig farms,a strategy of further data augmentation using pseudo-label semi-supervised learning was proposed to adapt to different scenarios of pig inventory.(2)In order to improve the detection accuracy of the YOLOv5 algorithm for pig targets,an improved YOLOv5 target detection algorithm was proposed in this article.Firstly,a light-weight ECA attention mechanism module was introduced to achieve adaptive weight reallocation for different feature map channels;Secondly,based on the aforementioned improvements,the original receptive field enhancement module was replaced with the SPPCSPC receptive field enhancement module which proposed in the YOLOv7 algorithm to optimize the updating efficiency of the gradient stream;Finally,the SIo U loss function was introduced to optimize the "oscillation" phenomenon of the pre-selected box in the regression stage.The experimental results showed that the improved YOLOv5 algorithm improved the detection accuracy of pig targets and had a good improvement effect.(3)To meet the practical needs of the current intensive pig farms,a pig inventory system was developed based on NVIDIA Jetson Xavier NX.The system used the Deep Stream stream-processing platform to pull multiple video streams within the factory,applied the Tensor RT component to accelerate the inference speed of the pig detection algorithm designed in this article and used tracking algorithm with the overthe-line counting method to achieve pig channel inventory.At the same time,a communication framework based on HTTP protocol was designed to achieve real-time cloud inventory results display and data enhancement mechanism for pseudo-label.In summary,this article created a pig detection dataset including various scenarios of pig targets,proposed an improved YOLOv5 algorithm for pig counting,designed and implemented a pig inventory system based on an embedded platform,which showed strong practical application value. |