Feeding is the most important behavior that represents the health and welfare of
weanling pigs. The early detection of feed refusal is crucial for the control of
disease in the initial stages and the detection of empty feeders for adding feed
in a timely manner. This paper proposes a real-time technique for the detection
and recognition of small pigs using a deep-leaning-based method. The proposed
model focuses on detecting pigs on a feeder in a feeding position. Conventional
methods detect pigs and then classify them into different behavior gestures. In
contrast, in the proposed method, these two tasks are combined into a single
process to detect only feeding behavior to increase the speed of detection.
Considering the significant differences between pig behaviors at different
sizes, adaptive adjustments are introduced into a you-only-look-once (YOLO)
model, including an angle optimization strategy between the head and body for
detecting a head in a feeder. According to experimental results, this method can
detect the feeding behavior of pigs and screen non-feeding positions with
95.66%, 94.22%, and 96.56% average precision (AP) at an intersection over union
(IoU) threshold of 0.5 for YOLOv3, YOLOv4, and an additional layer and with the
proposed activation function, respectively. Drinking behavior was detected with
86.86%, 89.16%, and 86.41% AP at a 0.5 IoU threshold for YOLOv3, YOLOv4, and the
proposed activation function, respectively. In terms of detection and
classification, the results of our study demonstrate that the proposed method
yields higher precision and recall compared to conventional methods.