Abstract:Automated counting of silkworms is crucial for intelligent sericulture management. However, due to small individual size, morphological variations, and severe occlusion in dense farming environments. This impeded precise distribution of mulberry leaves and lime powder for optimal feeding and disinfection. To address dense silkworm counting challenges and enhance detection and segmentation accuracy, DLC-YOLO, an improved instance segmentation algorithm was proposed based on YOLO 11n. Firstly, in the backbone network, a DysnakeConv and C3k2 fused structure was designed, utilizing dynamic deformable convolution kernels to adaptively trace silkworm contours, strengthening feature extraction for slender, curved morphologies. Secondly, in the neck network, a CGAfusion content-guided attention mechanism replaced the original feature fusion, integrating multi-scale cross-layer features from the backbone and feature pyramid at the detection head input. This significantly improved multi-scale feature fusion efficiency, particularly for dense small targets. Finally, an LSCSBD-Seg segmentation head incorporated local semantic constraints and boundary refinement modules to enhance edge segmentation precision in dense clusters. A dedicated dense silkworm instance segmentation dataset covering varied rearing densities and lighting conditions was constructed for validation. Experimental results demonstrated that DLC-YOLO outperformed YOLO 11n, with detection precision (mAP50, mAP50:95) increasing by 2.3 and 5.1 percentage points, and segmentation precision (mAP50, mAP50:95) improving by 3.0 and 2.9 percentage points, respectively.