Abstract:To solve the problem of low accuracy and poor realtime performance of weed recognition in corn field, a detection method of weed based on multiscale retinex with color restoration (MSRCR)and improved YOLOv4-tiny algorithm was proposed. Firstly, according to the image characteristics of weed in corn field environment, the MSRCR algorithm was used for image feature enhancement preprocessing to improve the image contrast and detail quality. Then, Mosaic online data augmentation method was used to enrich the object detection background, improve the training efficiency and the detection accuracy of small objects. Finally, The K-means++ was used for a priori anchor boxes clustering analysis and channel pruning for the YOLOv4-tiny model. The total parameters of the improved and simplified model were reduced by 45.3%, the model size was reduced by 458%, the mean average precision(mAP)was increased by 2.5 percentage points, and the average detection frame time on the Jetson Nano embedded platform was reduced by 22.4%. The proposed Prune-YOLOv4-tiny model was compared with Faster RCNN, YOLOv3-tiny, and YOLOv4, the experimental results showed that the mAP of the Prune-YOLOv4-tiny model was 96.6%, which was 22.1 percentage points and 3.6 percentage points higher than that of the Faster RCNN and YOLOv3-tiny, and 1.2 percentage points lower than that of the YOLOv4 model; the model size of the Prune-YOLOv4-tiny was 12.2MB, which was 3.4% of the Faster RCNN, 36.9% of the YOLOv3-tiny, and 5% of the YOLOv4; the average detection frame time on the Jetson Nano embedded platform was 131ms, which was 32.1% of the YOLOv3-tiny and 7.6% of YOLOv4. The optimization method proposed was superior to other commonly used object detection algorithms in model size, detection time and detection accuracy, which could provide a feasible real-time weed recognition method for the field precision weeding system with limited hardware resources.