# Soybean Weed Detection Based on RT-DETR with Enhanced Multiscale Channel Features
## 2 Materials and Methods
### EMCF-RTDETR Model
#### 2.2.3 Emitter Network  
In RT-DETR [34], the Cross-Scale Contextual Fusion (CCFF) module is a core component designed to perform cross-scale feature fusion via a cross-attention mechanism. Our goal is to address the soybean weed detection scenario characterized by small targets and complex backgrounds, which requires accurate detection of multiple weeds while keeping the number of parameters and computation small. This requires further refinement of the fusion of multi-scale features [43]. To address these challenges, we propose the Enhanced Multi-Scale Fusion Module (EMFF), which is inspired by the adaptive feature fusion model [44; 45]. EMF is a more flexible multi-scale feature extraction and fusion mechanism designed to improve the granularity and comprehensiveness of feature representation. By processing the P3, P4, and P5 feature layers differently through two different feature layer aggregations and a diffusion process, this module ensures that the features of each feature layer are fully expressed and fully utilized [45].  
In this process, the fusion module stands as the core design element of EMFF, with its structure illustrated in Figure 5. Within this fusion process, distinct operations are strategically applied to different feature layers: the P3 layer employs ADown downsampling to extract advanced semantic features [46]; the P4 layer utilizes 1 \(\times\) 1 convolution to adjust features, thereby preserving the integrity of mid-level representations; the P5 layer enhances detailed features through upsampling. This approach optimizes each feature layer, significantly improving cross-scale feature fusion effectiveness. In the feature enhancement phase, the method introduces parallel depth-wise convolutions with multiple kernel sizes (5 \(\times\) 5, 7 \(\times\) 7, 9 \(\times\) 9, and 11 \(\times\) 11) designed to match and amplify cross-scale features [47]. Additionally, a 1 \(\times\) 1 convolution layer is incorporated to refine feature representations, thereby elevating the quality and expressive capabilities of the features. Ultimately, the residual connection mechanism is retained, ensuring effective flow between original and enhanced features while preventing information loss.  
Assume that the feature inputs of layers P3, P4 and P5 are \(x_{1}\), \(x_{2}\) and \(x_{3}\) respectively, and the final feature output is \(Y\), the process is shown in formulas below:  
\[F=Concat\{ADown(x_{1}),Conv_{1\times 1}(x_{2}),Conv_{1\times 1}[Upsample(x_{3})]\} \tag{6}\]  
\[F_{i}=DWConv_{k_{i}\times k_{i}}(F) \tag{7}\]  
where \(F\) is the feature after splicing operation; \(F_{i}\) is the feature output after separable convolution at different depths; \(k_{i}\in\) 5, 7, 9, 11; \(i=\) 1, 2, 3, 4. Using convolution kernels of different sizes after obtaining \(F\) can capture rich context information under different receptive fields, thus enhancing the perception ability for targets at different scales. For example, smaller convolution kernels can capture more local details, while larger convolution kernels help to obtain the global context, thus striking a balance between local and global features. Adopting a parallel structure ensures the complementarity of different receptive field features, effectively improving the robustness of detection.  
\[F^{\prime}=Conv_{1\times 1}\Big{[}F+\sum_{i=1}^{4}Conv_{1\times 1}(F_{i}) \Big{]} \tag{8}\]  
\[Y=F+F^{\prime} \tag{9}\]  
where \(F^{\prime}\) is the result of refining features through the last convolution layer; finally, the final feature output result \(Y\) is obtained by residual connection. By aggregating and diverging three different feature layers in different forms, it is ensured that the EMFF module performs better in detecting small targets in complex scenes of soybean fields, and the accuracy and robustness of the model are greatly improved.