Abstract:Cow rear udder traits are key indicators for evaluating dairy cows’ roduction performance and breeding value, and their accurate and automated evaluation is of great significance for improving dairy farm management efficiency and genetic breeding levels. The complex structural morphology, naturally blurred boundaries of cow rear udders, as well as interferences such as occlusion and variable lighting in milking sites, make high-precision and automated image segmentation and trait evaluation extremely challenging. A multi-stage adaptive enhancement segmentation network for cow rear udder traits (MAAE-SegNet) was proposed. By introducing an adaptive parameter activation mechanism, it enhanced the backbone network’s dynamic expression capability for udder features in complex scenarios, and constructed a dynamic gated attention module to effectively focus on the key regions of the rear udder, thereby improving the clarity and completeness of rear udder segmentation boundaries. Experimental results showed that compared with the Mask2Former model, the improved model achieved 0. 5 and 1. 5 percentage points improvements in detection box accuracy and recall rate respectively, and 1. 8 and 2. 0 percentage points improvements in segmentation accuracy and recall rate respectively. The model had a parameter count of 4. 705 5 × 107 and a floating-point operation ( FLOP) count of 1. 59 × 1011, demonstrating higher accuracy without a significant increase in parameter quantity.