# Lightweight RT-DETR with Attentional Up-Downsampling Pyramid Network
## 3 Materials and Methods
### Design of Lightweight RT-DETR with Attentional Up-Downsampling Pyramid Network
#### 3.2.3 Attentional Up-Downsampling Pyramid Network (AUDPN)  
In deep learning, upsampling operations are critical steps in many tasks, such as image segmentation, super-resolution, and generative adversarial networks. Typically, upsampling methods using nn.Upsample include nearest neighbor interpolation and bilinear interpolation. The neck network of RT-DETR R18 employs the nearest neighbor interpolation method for upsampling via nn.Upsample. However, these traditional upsampling methods have certain limitations, leading to less-than-ideal model accuracy. Specifically, conventional upsampling methods (like nearest neighbor and bilinear interpolation) fail to fully utilize contextual information, often resulting in blurred feature maps, especially around edges and details [65; 66]. Additionally, these methods apply the same interpolation strategy across all locations, neglecting the fact that different areas may require different treatments. For example, edge regions may need more detail preservation, while flat regions might require smoother transitions. To overcome these limitations, inspired by attention mechanisms, this paper proposes a new upsampling module--AdaptiveGateUpsample, the structure of which is illustrated in Figure 3.  
In designing the AdaptiveGateUpsample module, we enhanced information utilization and feature representation during the upsampling process by introducing an adaptive channel attention mechanism [67] and a multi-path upsampling approach. Specifically, we employed global average pooling and a gating mechanism (using \(1\times 1\) convolutions and a  
Figure 3: The Structural Diagram of AdaptiveGateUpsample. Hardsigmoid activation function) to generate channel attention weights. These weights are used to emphasize important features while suppressing unimportant ones [67; 68], making the upsampling process more adaptive. Additionally, we combined transpose convolutions and nearest neighbor interpolation for feature map enlargement through parallel pathways. The advantage of integrating transpose convolutions into the network lies in their ability to adjust parameters via backpropagation during training [69]. Compared to traditional interpolation algorithms, this dynamic and learnable upsampling method yields more reasonable pixel values, resulting in richer detail in the high-resolution feature maps [70]. Therefore, the transpose convolution pathway can better restore detailed information, while the nearest neighbor interpolation pathway provides a quick and straightforward upsampling method. The combination of both, through concatenation and channel attention gating operations, enhances the quality of the feature maps after upsampling. Moreover, in neural networks, downsampling operations are used to reduce the spatial resolution of feature maps, thereby decreasing computational complexity and increasing the receptive field. RT-DETR R18 employs convolutional operations for downsampling. However, this traditional method has certain limitations that impact the overall performance of the model, such as information loss and lack of adaptability. The lack of adaptability parallels the issues presented by the upsampling module, while information loss manifesting specifically as fixed-size convolution kernels and strides may lead to the loss of important feature information. In particular, large strides in convolution can easily overlook details, and even smaller strides may face the problem of excessive detail but overall inadequacy [71]. To address these issues, we also introduce a channel attention mechanism [67] and propose a new downsampling module--AdaptiveGateDownsample. Its structure is illustrated in Figure 4.  
This module integrates an adaptive attention mechanism and a multi-path downsampling strategy, effectively enhancing information utilization and feature representation during the downsampling process.