Abstract:With the increase of mechanization of cotton planting and harvesting, it is particularly important to obtain accurate yield map and analyze field yield data, and it is an effective and feasible method to monitor the yield at the cotton conveying pipeline during the operation of cotton picker. The existing photoelectric beam cotton yield measurement sensor has problems such as mucus blocking detection channel and ambient light influence in operation. Facing the complex field working environment, linear or polynomial model is generally used for sensor calibration, and the accuracy and anti-interference performance are not ideal. In view of the above situation, the anti-interference in the structure and circuit design of the sensor was firstly improved. Then, in the process of sensor calibration, random forest regression (RFR) was used to train and test the experimental samples. After analyzing the performance of the model, a stochastic forest regression model based on sparrow search algorithm (SSA) was proposed. The mean square error was used as fitness value to optimize the model. After verification, the optimized model had better detection accuracy under the same verification set. The optimal detection model was obtained by optimizing the range of upper and lower bounds, balancing the running time and detection accuracy. The model performed well on the validation set with a coefficient of determination (R2) of 0.99 and a mean absolute percentage error (MAPE) of 6.34%. The bench test results showed that the maximum error was 9.21% and the average error was 8.33% at different wind speeds. The improved sensor and detection model had good performance and can accurately detect the cotton quality during the operation of the cotton picker.