Image-based detection of rice straw moisture content in feed production using an attention-enhanced ResNet50 and two-stage regression
摘要
Rice straw is abundant in yield, and utilizing straw as animal feed is a vital strategy for resource recovery. Among the factors affecting its feed value, moisture content is a particularly critical parameter.
MethodsIn this study, a rapid image-based method is proposed for detecting the moisture content of rice straw. Images of straw samples with moisture levels ranging from 0% to 80% were collected to construct a comprehensive dataset, which was subsequently processed through cropping, denoising, and data augmentation to improve data quality. Based on the ResNet50 architecture, a Squeeze-and-Excitation module and an optimized loss function were incorporated to develop the ResNet50_SE_SF model. In the proposed framework, moisture content is first classified into discrete intervals and then refined through regression analysis to enable continuous and precise prediction. This two-stage strategy effectively constrains the regression space and improves prediction stability for samples with highly similar visual features. To validate practical applicability, a detection platform was implemented on a Raspberry Pi and evaluated using four batches of rice straw. Each sample image was segmented into six sub-images, and the predicted values were averaged to obtain the final moisture content.
ResultsThe optimized ResNet50_SE_SF model achieved a TOP-1 Accuracy of 92.77%, while the proposed two-stage classification–regression framework achieved an average MAE of 1.43% in field validation within the production-relevant moisture range.
ConclusionOverall, this study provides a reliable and efficient solution for rice straw moisture detection and establishes a methodological foundation for applying image recognition technologies in agricultural biomass management.