## 3 Methods
### Swin Transformer  
In object detection networks, the backbone network plays several critical roles. Its primary function is to extract useful features from raw image data. This is typically achieved through multiple layers of convolutional networks, with each layer capturing different levels of detail and abstract features in the image, ranging from bare edges and textures  
Figure 1: Architecture of the RT-DETR-Tomato-BS Model. to more complex object parts. The original RT-DETR selects different sizes of backbone networks based on the model size to extract image feature information. In this paper, ResNet50 is used as the comparison backbone network model. ResNet50 was initially proposed by [PERSON] et al. [51]. This network design addresses the training difficulties that arise with increasing network depth, particularly the problems of vanishing and exploding gradients. The core of ResNet is the residual learning block (Residual Block). Additionally, skip connections allow inputs to connect to the next layer, skip one or more layers, and connect directly to deeper layers. This connection strategy facilitates more effective gradient flow during training, thereby resolving the vanishing gradient problem in deep network training. The architecture of ResNet50 is introduced in detail next, with its architectural diagram shown in Figure 2:  
The figure shows that ResNet50 consists of 50 convolutional and fully connected layers. However, this structure has certain drawbacks. Although residual connections help alleviate the vanishing gradient problem and facilitate the training of deeper networks, the complex structure of ResNet50 can lead to overfitting when the data volume is insufficient. This means the model performs well on the training data but poorly on unseen data. In profound networks, information becomes excessively smoothed after passing through many layers, especially with continuous residual connections, potentially causing the loss of some important feature information. This issue can be problematic in object detection tasks that require capturing fine details. To address this shortcoming, this paper replaces the backbone network with one based on the Transformer framework [52]. The Transformer handles sequential data through a self-attention mechanism, supports parallel computation, and can capture long-range dependencies. It was initially introduced in the field of natural language processing. Swin Transformer [11] brings this technology into the computer vision field and achieves remarkable results. The structure of the Swin Transformer is shown in Figure 3:  
In the Swin Transformer, the image undergoes multiple feature extraction and refinement steps, utilizing patch partition: the image is first divided into 4 \(\times\) 4 pixel patches. Each patch is flattened along the channel dimension to form the initial feature representation. Convolutional layer (as linear embedding layer): A convolutional layer is used as the linear embedding layer to transform these features into a higher-dimensional feature space \(C\) to enhance the feature representation capability. Figure 3: Architecture of the Swin Transformer. Figure 2: Architecture of ResNet50. The Swin Transformer block employs a multi-head self-attention module based on shifted windows (W-MSA/SW-MSA), followed by a 2-layer MLP with GeLU non-linearity in between. LayerNorm (LN) is applied before each MSA module and each MLP, and a residual connection is applied after each module. W-MSA is more efficient compared to global self-attention MSA, with the computational complexities of the two self-attention mechanisms being as follows:  
\[\Omega(MSA)=4 hwC^{2}+2(hw)^{2}C \tag{1}\]  
\[\Omega(W-MSA)=4 hwC^{2}+2M^{2}hwC \tag{2}\]  
MSA has quadratic complexity concerning the number of patch tokens h \(\times\) w (with h \(\times\) w patch tokens, each patch token computes h \(\times\) w times globally).