Abstract:Research on pitaya detection methods is the basis and prerequisite for realizing intelligent picking. Existing pitaya detection methods only target a single performance indicator, which is difficult to meet the needs of real agricultural scenarios. Therefore, an accurate and efficient dual-index detection method for pitaya quality and maturity was proposed. Firstly, the adaptive discriminator enhanced style generation adversarial network algorithm was used to expand the pitaya image and establish a pitaya dataset. The image was enhanced by gamma transform to highlight the characteristics of pitaya and reduce the impact of lighting environment. Secondly, the YOLO v7-RA model was proposed, by designing ELAN_R3 to replace the efficient layer aggregation network (ELAN) module to reduce the extraction of repetitive features by the backbone network. This enhanced the model’s attention to fine-grained features and improved the accuracy of dual-index detection. The mixture of selfattention and convolution (ACmix)was applied to enhance the model’s ability to extract and integrate feature information, and reduce the interference of cluttered background information. Finally, the detection level of the YOLO v7-RA model was verified through experiments. Experimental results showed that the precision rate of the method was 97.4%, the recall rate was 97.7%, the mAP0.5 was 96.2%, and FSP was 74f/s. A balance between detection accuracy and detection speed was achieved. Even under occlusion, the YOLO v7-RA model detection accuracy still reached 91.4%. The model had good generalization ability to provide strong technical support for the development of intelligent pitaya picking.