The accurate recognition of pig behaviors in intensive farming is crucial for health monitoring and growth assessment. To address multi-scale recognition challenges caused by perspective distortion (non-frontal camera angles), this study proposes MACA-Net, a YOLOv8n-based model capable of detecting four key behaviors: eating, lying on the belly, lying on the side, and standing. The model incorporates a Mamba Global–Local Extractor (MGLE) Module, which leverages Mamba to capture global dependencies while preserving local details through convolutional operations and channel shuffle, overcoming Mamba’s limitation in retaining fine-grained visual information. Additionally, an Adaptive Multi-Path Attention (AMPA) mechanism integrates spatial-channel attention to enhance feature focus, ensuring robust performance in complex environments and low-light conditions. To further improve detection, a Cross-Layer Feature Pyramid Transformer (CFPT) neck employs non-upsampled feature fusion, mitigating semantic gap issues where small target features are overshadowed by large target features during feature transmission. Experimental results demonstrate that MACA-Net achieves a precision of 83.1% and mAP of 85.1%, surpassing YOLOv8n by 8.9% and 4.4%, respectively. Furthermore, MACA-Net significantly reduces parameters by 48.4% and FLOPs by 39.5%. When evaluated in comparison to leading detectors such as RT-DETR, Faster R-CNN, and YOLOv11n, MACA-Net demonstrates a consistent level of both computational efficiency and accuracy. These findings provide a robust validation of the efficacy of MACA-Net for intelligent livestock management and welfare-driven breeding, offering a practical and efficient solution for modern pig farming.
Model updating is a challenging task with regard to maintaining the performance of non-destructive detection models while using hyperspectral imaging techniques for detecting the internal quality of fresh fruits like blueberries. Different sample batches and differences in hyperspectral image acquisition environments may lead to a significant decline in the performance of hyperspectral detection models. This study investigated the transferability of a hyperspectral model for the quantitating soluble solid content of blueberries across different batches for two harvest years. Hyperspectral images and SSC values of blueberries were collected from two batches, including 364 samples from 2024 and 175 samples from 2025. The differences between SSC measurements and spectral data across these two batches were analyzed. Based on the sample dataset of the year 2024, a high-performance quantitative model for detecting SSC values was established by combining it with partial least squares regression (PLSR) and competitive adaptive reweighted sampling (CARS). This high-performance model could achieve a high determination coefficient () of 0.8965 and a low root mean square error of prediction (RMSEP) of 0.3707 °Brix. Using the sample dataset for the year 2025, the hyperspectral model was updated by the semi-supervised parameter-free calibration enhancement (SS-PFCE) algorithm. The updated model performed better than those established using individual datasets from 2024 and 2025, and obtained an of 0.8347 and an RMSEP of 0.4930 °Brix. This indicates that the calibration transfer strategy is superior in improving hyperspectral model performance. This study demonstrated that the SS-PFCE algorithm, as a calibration transfer strategy, could effectively improve the transferability of the established model for detecting the SSC of blueberries across different sample batches.