目的 在群养环境下，实现生猪粘连、杂物遮挡等不同条件下生猪个体的高精度分割。方法 对真实养殖场景下的8栏日龄20~105 d共45头群养生猪进行研究，以移动相机拍摄图像为数据源，并执行改变亮度、加入高斯噪声等数据增强操作获取标注图片3 834张。探究基于2个骨干网络ResNet50、ResNet101与2个任务网络Mask R-CNN、Cascade mask R-CNN交叉结合的多种模型，并将循环残差注意力(RRA)思想引入2个任务网络模型中，在不显著增加计算量的前提下提升模型特征提取能力、提高分割精度。结果 选用Mask R-CNN-ResNet50比Cascade mask R-CNN-ResNet50在AP0.5、AP0.75、AP0.5-0.95和AP0.5-0.95-large指标上分别提升4.3%、3.5%、2.2%和2.2%；加入不同数量的RRA模块以探究其对各个任务模型预测性能影响，试验表明加入2个RRA模块后对各个任务模型的提升效果最为明显。结论 加入2个RRA模块的Mask R-CNN-ResNet50模型可以更精确、有效地对不同场景群养生猪进行分割，为后续生猪身份识别与行为分析提供模型支撑。
Objective To realize high-precision segmentation of individual pigs under different conditions such as pig adhesion and debris shielding in a group breeding environment.Method A total of 45 group-housed pigs of 20 to 105 days from eight sheds in real farming scenes were studied. Mobile camera images were used as data sources, and data enhancement operations such as changing brightness and adding Gaussian noise were performed to obtain 3 834 annotated pictures. We explored multiple models with the cross-combinations of two backbone networks ResNet50, ResNet101 and two mission networks Mask R-CNN, Cascade mask R-CNN. We also introduced the idea of recurrent residual attention (RRA) into the two major task network models to improve the feature extraction ability and segmentation accuracy of the model without significantly increasing the amount of calculation.Result Compared with Cascade mask R-CNN-ResNet50, Mask R-CNN-ResNet50 improved AP0.5, AP0.75, AP0.5-0.95 and AP0.5-0.95-large by 4.3%, 3.5%, 2.2% and 2.2% respectively. Different numbers of RRA modules were added to explore the impact on the prediction performance of each task model. The experiment showed that adding two RRA modules had the most obvious improvement effect on each task model.Conclusion The Mask R-CNN-ResNet50 model with two RRA modules can more accurately and effectively segment group-housed pigs under different scenes. The results can provide a model support for subsequent identification and behavior analysis of live pigs.