We propose a lightweight detection algorithm based on the Single Shot MultiBox Detector (SSD) algorithm in order to facilitate sheep management and to realize sheep facial identification, and we take the self-constructed dataset as the research object. First, the SSD replaces the VGG16 backbone network with MobileNetv3, a lightweight neural network, to create a hybrid model that is much smaller. Second, the ECA attention mechanism is incorporated into the backend of the 72 × 160 bottleneck layer. Finally, the SmoothL1 loss function is substituted with the BalancedL1 loss function. The optimized model’s size decreases significantly from the original SSD’s 132 MB to just 22.4 MB. It achieves a mean average precision of 83.47% and maintains an average frame rate of 68.53 frames per second. Compared to the basic SSD model, the mean average precision has increased by 3.25 percentage points, the model size has decreased by 109.6 MB, and the detection speed has improved by 9.55 frames per second. In comparative experiments using the same dataset with different object detection models, the proposed model outperforms the SSD, Faster R-CNN, Retinanet, and CenterNet in terms of mean average precision, with improvements of 3.25 percentage points, 4.71 percentage points, 2.38 percentage points, and 8.13 percentage points, respectively. The detection speed has shown significant improvements, increasing by 9.55, 58.55, 53.1, and 12.37 frames per second, respectively. The improved model presented in this paper significantly reduces the model’s size and computational requirements while maintaining an excellent performance. This provides a valuable reference for the digitalization of animal husbandry and livestock farming.
Read full abstract