Research on Walnut Recognition Algorithm in Natural Environment Based on Improved YOLOX
Aiming to address the issues of missed detection and false detection of walnut recognition in natural environments using existing target detection algorithms,we proposed an improved YOLOX-S walnut recognition algorithm based on Swin Transformer multi-layer feature fusion.First of all,a multi-layer feature fusion module based on Swin Transformer was introduced into the backbone feature extraction network,and the multi-head attention mechanism of Swin Transformer was used to extract the feature information of small targets and fuse them with feature maps,which could effectively resolve the issue of losing feature information related to smaller targets within the higher-level feature map as a result of deepening network layers.Secondly,to enhance the detection accuracy of the algorithm,we introduced a more efficient Repblock module to replace the CSP module in the original network.Finally,to enhance the down-sampling effect,we employed the Transition Block module as the down-sampling module of the backbone feature extraction network.The results showed that the improved YOLOX-S algorithm demonstrated an average accuracy of 96.72%on the walnut datasets,which was higher than the accuracy achieved by the Faster R-CNN,YOLOv5-S,and YOLOX-S algorithms,with improvements of 7.36,1.38,and 0.62 percentage points respectively.The detection speed of the algorithm reached 46 f/s,while the model parameter size was 20.55 M.The improved YOLOX-S algorithm exhibited superior average precision,thereby addressing the issues of missed detection and false detection effectively.It had a better recognition effect on walnuts in the natural environment.