Abstract:Fecal defecation is a primary source of organic waste in intensive aquaculture systems. The increase in the amount of defecation and the extension of time will accelerate the accumulation of pollutants such as ammonia nitrogen and nitrite in the aquaculture water. Therefore, monitoring fish defecation behavior is essential for maintaining optimal water conditions and ensuring sustainable fish production. In order to solve the problem that traditional defecation behavior analysis is time-consuming and labor-intensive, a high-performance, lightweight fish defecation behavior recognition model CDW-YOLO v7 was proposed based on the innovative enhancement of the YOLO v7-tiny. In the proposed model, a bidirectional feature pyramid network (C2f-BiFPN) was applied to optimize feature extraction within the neck network, a DyHead target detection head with an attention mechanism was utilized to accurately detect fish defecation behavior and strengthen relevant features, and the WIoU loss function was incorporated to improve the accuracy of the model’s outputs. Experimental results indicated that the performance of the CDW-YOLO v7 model was much better than that of the baseline YOLO v7-tiny model because reducing the number of parameters loading models by 2.56×106 and giga floating-point operations per second (GFLOPs) by 5.90×109, while increasing mean average precision (mAP) by 2.04 percentage points. Additionally, the proposed model surpassed three classic object detection algorithms (YOLO v3-tiny, YOLO v4-tiny, and YOLO v5s) when evaluating criteria such as model size, accuracy, and detection speed. The research result can provide a theoretical foundation for subsequent detection of fish health and establishing a quantitative relationship between fish behavior and water quality.