## 3 Materials and Methods
### Model Improvement  
#### 3.4.1 Replacing the YOLO11 Backbone  
Target detection for sugarcane in complex environments in the field faces a number of challenges, including complex backgrounds, variable illumination, target occlusion, significant deformation, multi-scale target distribution, and limited real-time and equipment resources. Backgrounds in field environments often contain weeds, soil, and other objects that are similar in color and texture to sugarcane and can easily lead to false or missed detections. In addition, instability of lighting conditions, such as glare, shadows, or low light, can distort or blur parts of the target, further increasing the difficulty of detection. Figure 4: YOLO11 structure diagram. Occlusion and deformation problems of the target, such as overlapping or inverted sugarcane leaves, also make it difficult for traditional detection models to accurately recognize them. The multi-scale distribution characteristics of sugarcane targets, on the other hand, require the model to be able to have good detection capability for targets of different sizes and distances, while in dense target scenarios, the model needs to have stronger differentiation capability to avoid misjudgment. These issues are overlaid with the requirements of real-time and limited equipment resources in practical agricultural applications, making it necessary for the models to be not only highly accurate but also lightweight and suitable for deployment to edge devices such as drones or self-driving farm machines. For these problems, replacing the backbone network of YOLO11 with RepViT [13] is an ideal solution. The design of RepViT combines the global feature modeling capability of a vision transformer with the local feature extraction capability of a convolutional neural network to accurately separate targets from complex backgrounds while preserving the detailed features of sugarcane leaves. Its adaptability to illumination variations and robustness to target deformation and occlusion significantly improve the model's detection performance. The lightweight, heavily parameterized structure means the RepViT inference phase has a low computational overhead and is suitable for real-time operation in resource-constrained devices. In addition, RepViT's multi-scale feature modeling capability enhances the detection of small targets and improves the differentiation of dense targets. Overall, RepViT offers an ideal balance of performance and efficiency, providing strong support for sugarcane target detection in complex field environments. RepViT is a lightweight CNN (Convolutional Neural Network) designed for computer vision tasks. Inspired by RepVGG, it aims to maintain or enhance model performance while retaining its lightweight nature. The RepViT structure is shown in Figure 5 and consists of four phases. The resolution of the processed image at each stage is denoted as \(\frac{H}{4}\times\frac{W}{4}\), \(\frac{H}{8}\times\frac{W}{8}\), \(\frac{H}{16}\times\frac{W}{16}\), and \(\frac{H}{32}\times\frac{W}{32}\), channel size \(C_{i}\), batch size B, and image size H \(\times\) W. The Stem module preprocesses the input image. Stages 1 to 4 include multiple RepViTBlock and optional RepViTSEBlock modules as well as deeply separable convolution (3 \(\times\) 3 DW), 1 \(\times\) 1 convolution, SE (Squeeze and Excite) modules, and FFN (Feedforward Network). Each stage reduces the spatial dimension by downsampling. In addition, the Pooling module performs global average pooling to further reduce the spatial dimensionality of the feature map. The FC module consists of a fully connected layer for final category prediction. Inspired by RepVGG, RepViT utilizes structural reparameterization techniques to enhance model learning during training. It employs a multi-branch structure to improve model representation during training, which is subsequently reparameterized to an equivalent single-branch structure during inference.