GSCW-YOLO:A Real-Time Lightweight Behavior Recognition Model for Multi- Dairy-Goat

Xiaobo Wang, Meili Wang, Yufan Hu, Mei Li, Wenxiao Zhao, Rui MaoResearch Square 2024 · DOI

TL;DR

GSCW-YOLO is a new lightweight deep learning model designed to monitor dairy goat health by recognizing ten distinct behaviors—including critical abnormal ones like limping and attacking—in real-time. By optimizing the YOLOv8n architecture with advanced attention mechanisms and content-aware upsampling, the researchers achieved a 97.5% mAP and a blistering 175 FPS on a tiny 5.9MB footprint.

What Problem Does This Paper Address?

In modern intensive livestock farming, an animal's behavior is a primary "vital sign" for its physiological health. Early detection of abnormal behaviors (e.g., limping from injury or aggressive attacking) can prevent disease outbreaks and improve animal welfare.

However, current monitoring relies heavily on manual observation, which is subjective and inefficient. Automated solutions often fall into two camps: wearable sensors, which can cause stress and harm to the animals, or computer vision models. Existing vision models frequently struggle with the "messy" reality of a farm—complex backgrounds like railings and windows, goats positioned far from the camera (small targets), and the subtle visual differences between similar actions like scratching versus gnawing.

Methods

The authors built GSCW-YOLO by taking the lightweight YOLOv8n as a baseline and introducing four key architectural enhancements:

  1. CARAFE (Content-Aware Reassembly of Features): They replaced standard nearest-neighbor upsampling with this operator. Unlike static interpolation, CARAFE is content-aware, allowing the model to preserve fine behavioral details during feature fusion.
  2. GCT (Gaussian Context Transformer): This module was integrated into the Path Aggregation Network (PAN). It uses a Gaussian function to map global context to attention weights, effectively "teaching" the model to prioritize goat features while ignoring background noise like barn infrastructure.
  3. Small Object Detection (SOD) Layer: The researchers added a high-resolution detection head specifically to capture intricate details of goats located far from the surveillance cameras.
  4. Wise-IoU (WIoU) Loss Function: They replaced the standard CIoU loss with WIoU, which uses a dynamic focusing mechanism to adjust gradient weights. This helps the model converge faster and adapt better to rapid, transient behavioral changes.

Datasets

The study introduces a new benchmark dataset called GoatABRD (Goat Abnormal Behavior Recognition Dataset):

  • Composition: 9,213 images extracted from high-definition farm surveillance.
  • Categories: 10 total behaviors.
  • Abnormal: Limping, attacking, death, and gnawing.
  • Common: Standing, lying, eating, drinking, scratching, and grooming.
  • Diversity: Data was collected over a year to account for various lighting conditions (day, night, sunny, cloudy).

Key Insights and Ideas

  • Efficiency over Scale: One of the most impressive "aha moments" is that the authors actually reduced the model size (from 6.2MB to 5.9MB) while simultaneously increasing accuracy. This proves that targeted architectural improvements (like GCT) are more effective for edge deployment than simply adding more layers.
  • Context is King: Standard models often get "distracted" by the vertical lines of barn railings. The GCT module’s ability to suppress this background noise was a major factor in improving precision.
  • The "Small Target" Bottleneck: The paper highlights that in real-world farming, goats aren't always front-and-center. By adding a dedicated SOD layer, they addressed a common failure point in standard YOLO models where distant animals are simply overlooked.
  • Solving Overlap: Standard YOLOv8n often produces overlapping anchor boxes for similar behaviors (e.g., drinking vs. standing near a trough). GSCW-YOLO’s refined feature extraction allows it to distinguish these nuances much more cleanly.

Key Results

GSCW-YOLO outperformed several heavyweights in the field, including YOLOv10n, YOLOv7, CenterNet, and EfficientDet:

  • Accuracy: Achieved a mean Average Precision (mAP) of 97.5%, a 2% improvement over the baseline YOLOv8n.
  • Speed: Clocked in at 175 FPS, making it the fastest model tested (5.2x faster than CenterNet).
  • Footprint: At only 5.9MB, it is highly suitable for deployment on low-cost farm CPUs or edge devices.
  • Class Performance: It achieved the highest mAP for 9 out of 10 behavior categories, trailing only slightly behind CenterNet on the "limping" category while being significantly faster and lighter.

Limitations and Future Work

While the model is excellent at recognizing abnormal behaviors, the authors acknowledge that it does not yet diagnose specific diseases. A goat limping could mean many things—from a simple scratch to a serious infection.

Future Directions: * Expert Integration: The authors plan to integrate veterinary expert knowledge to transform these behavioral alerts into a predictive disease diagnosis system. * Cross-Species Utility: There is significant potential to adapt this lightweight architecture for other livestock, such as swine or cattle, where similar monitoring challenges exist.

Summary updated

Abstract

<title>Abstract</title> Livestock behavior serves as a crucial indicator of physiological health. Using deep learning methods to automatically recognize dairy goat behaviors, especially abnormal ones, can aid in the early detection of potential health and environmental issues. This study proposed a multi-scale and lightweight behavior recognition model for dairy goats, known as GSCW-YOLO, which integrates Gaussian Context Transformation (GCT) and the Content-Aware Reassembly of Features upsampling operator (CARAFE). This integration aims to enhance the YOLOv8n model's attention to behavioral features, mitigate complex background interferences and concurrently enhance the model's capability to discern subtle differences among behaviors. Furthermore, the model includes a small target detection layer and optimization of the Wise-IoU loss function to enhance its adaptability in identifying distant small target behaviors and transient abnormal behaviors in surveillance videos. A new dataset called GoatABRD was also established, encompassing four abnormal behaviors (limping, attacking, death and gnawing) and six common behaviors (standing, lying, eating, drinking, scratching and grooming). The experimental results demonstrate that the precision, recall and mean Average Precision (mAP) of the GSCW-YOLO model reached 93.5%, 94.1% and 97.5%, respectively, marking improvements of 3, 3.1 and 2 percentage points over the YOLOv8n model. Moreover, the GSCW-YOLO model has a considerably smaller size of only 5.9MB, with a frame per second (FPS) of 175. Meanwhile, it outperforms popular models like CenterNet, Efficientdet, and other networks in the YOLO series. GSCW-YOLO provides significant technical support for the intelligent management and welfare-focused breeding of dairy goats, thereby facilitating the modernization of the dairy goat industry.
BibTeX
@inproceedings{wang2024gscw,
  author = {Xiaobo Wang and Meili Wang and Yufan Hu and Mei Li and Wenxiao Zhao and Rui Mao},
  title = {{GSCW-YOLO:A Real-Time Lightweight Behavior Recognition Model for Multi- Dairy-Goat}},
  booktitle = {Research Square},
  year = {2024},
  doi = {10.21203/rs.3.rs-4994192/v1},
}
Figure