Abstract
Automated monitoring of piglet behavior is essential for improving animal welfare in precision livestock farming. However, the presence of farrowing crates leads to extreme physical occlusions, causing standard instance segmentation models to produce duplicate or incomplete detections. This paper presents CClusnet-Inseg, a two-stage framework that leverages center-point prediction and a refined clustering algorithm to achieve robust segmentation. Evaluated on a dataset of 4,600 images, the model achieves a mean Average Precision (mAP) of 84.1, significantly outperforming state-of-the-art models like Mask R-CNN and YOLACT++ in high-occlusion environments.
1. Introduction
In modern swine production, farrowing crates are used to protect piglets from crushing, but they introduce significant challenges for computer vision systems. Metal bars frequently split a single piglet into multiple visible segments or obscure critical body parts. Research indicates that occlusions occur in approximately 97.7% of images in these environments, categorized as Body-Separated Occlusion (BSO) and Part-Missing Occlusion (PMO). Standard bounding-box-based detectors struggle to associate these fragmented parts correctly, leading to frequent counting and tracking errors.
2. Methodology
The proposed CClusnet-Inseg framework addresses occlusion by focusing on object centers rather than edges, providing a stable reference point that remains consistent even when an animal's body is partially hidden.
2.1 Stage 1: Neural Network Architecture
The system uses an encoder-decoder network to produce a five-channel output: a semantic segmentation map and a center offset vector map. The offset map allows each pixel to "vote" for the $(x, y)$ coordinates of the center of the piglet it belongs to. This approach ensures that even if a piglet is visually split by a bar, the pixels on both sides of the obstruction point toward the same center.
2.2 Stage 2: Clustering and Masking
To convert network outputs into individual instances, the authors employ DBSCAN clustering. This choice provides a 20x speedup over traditional Mean-shift algorithms, reducing clustering time from 2.8s to 0.15s per image. Furthermore, the "Remain-Centers-to-Mask" (RC2M) algorithm is introduced to re-assign "noise" pixels to the nearest valid cluster, effectively recovering fragmented body parts and boosting mAP by 1.3.
3. Experimental Results
The model was evaluated on a custom dataset of 4,600 images from various farrowing crate configurations. CClusnet-Inseg achieved a mAP of 84.1, surpassing YOLACT++ (80.9), CondInst (80.6), and the industry-standard Mask R-CNN (74.4).
3.1 Robustness to Occlusion
Qualitative analysis shows that the center-clustering approach successfully prevents "double counting" errors. By predicting a single center for each animal, the model maintains instance integrity even when a metal bar physically divides the piglet's appearance. This robustness allows for the extraction of accurate behavioral metrics, such as trajectory, average speed, and spatial usage (e.g., time spent on heat pads).
4. Discussion and Conclusion
CClusnet-Inseg provides a specialized solution for high-occlusion environments in precision agriculture. While the current inference speed of approximately 4 frames per second (FPS) is a limitation for real-time high-speed applications, the framework's accuracy is sufficient for detailed welfare monitoring. Future work will focus on optimizing the backbone for higher throughput and integrating advanced multi-object tracking algorithms to improve long-term identification.
Summary updated