Abstract The detection of feed behavior at pig farms is essential in monitoring the welfare and health of pigs. Addressing the low automation level of feeding behavior detection in group-housed pig farming, this study proposes a lightweight feeding behavior detection model, GAB-YOLO, based on YOLOv8s. The model employs GhostNet with a Convolution and Self-Attention Mixed Module (ACMix) as the back-bone, enhancing feature extraction capability while reducing parameters. Wise-IoU is utilized as the bounding box loss function to improve sensitivity to piglets. To integrate features of pigs with different body types, a Feature Fusion Module called Bi-directional Multi Feature Pyramid Network (BMFPN) is proposed as the neck part of the model. Experimental results demonstrate that the improved model achieves detection accuracies of 98.40% for drinking behavior and 98.66% for eating behavior in group-housed pigs, representing improvements of 2.79% and 2.99%, respectively, over the original YOLOv8s algorithm, with a 14.5% reduction in parameters. The Deep Simple Online and Realtime Tracking (DeepSORT) algorithm is integrated into the improved model to address the issue of inaccurate video behavior judgment by YOLO, forming the lightweight model GAB-YOLO-DeepSORT. Finally, GAB-YOLO-DeepSORT is deployed on the NVIDIA Jetson Nano. The practical operation on the Jetson Nano shows that the proposed model can track multiple targets for pigs of different sizes and varieties in a group-housed environment, thus ensuring the accuracy of pig feeding behavior recognition and providing support for the subsequent establishment of pig health systems.