Next Article in Journal
Structured Innovation-Based Covariance Calibration for TLE-Driven dSGP4–EKF Orbit Determination
Previous Article in Journal
Multirate Quasi-Cycle-by-Cycle Control of High-Switching-Frequency Three-Phase Current Source Rectifier
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Lightweight RPR-DETR for Prohibited Item Detection in X-Ray Security Inspection Images

School of Mathematics and Computer Science, Shaanxi University of Technology, Hanzhong 723001, China
*
Author to whom correspondence should be addressed.
Electronics 2026, 15(18), 4145; https://doi.org/10.3390/electronics15184145 (registering DOI)
Submission received: 17 August 2026 / Revised: 6 September 2026 / Accepted: 10 September 2026 / Published: 13 September 2026
(This article belongs to the Section Computer Science & Engineering)

Abstract

Object overlap in X-ray security inspection images can introduce interference into feature representation and increase the difficulty of prohibited item detection. To address this problem, an improved RT-DETR model named RPR-DETR is developed in this study. First, the original backbone is replaced with a lightweight RGCSPELAN structure, where structural reparameterization is incorporated into hierarchical feature aggregation to decrease model complexity. Second, a Pola-CGLU encoder is introduced to model relationships across different spatial regions while retaining local neighborhood interaction. In addition, an RFPN structure is employed to reorganize feature transformation and scale conversion among different feature levels. On the OPIXray dataset, RPR-DETR obtains an mAP50 of 90.0%, exceeding RT-DETR-R18 by 1.2 percentage points. Compared with RT-DETR-R18, RPR-DETR uses 31.2% fewer parameters and requires 22.6% fewer FLOPs. On DvXray, the proposed model improves mAP50 by 1.4 percentage points over the baseline. The experimental results indicate that RPR-DETR provides a better balance between prohibited item detection performance and model complexity.

1. Introduction

As passenger volumes continue to grow across airports, metro systems, and railways, baggage security inspection places increasing demands on detection accuracy and processing efficiency. X-ray imaging can reveal objects inside baggage without requiring physical inspection and has therefore become an important tool for prohibited item screening in public transportation systems. Conventional security screening still relies heavily on manual interpretation of X-ray images. Prolonged and repetitive inspection can be affected by visual fatigue and differences in operator experience. Automated prohibited item detection based on computer vision can help improve screening efficiency and reduce the workload associated with manual image inspection.
X-ray images differ from natural images because of their projection characteristics. Objects inside baggage are projected onto a two-dimensional plane along the X-ray direction. When multiple objects are stacked together, their projected information may overlap within the same region, causing the contours and local structures of prohibited items to become mixed with information from surrounding objects. To address object overlap in X-ray images, Wei et al. [1] established the OPIXray dataset and introduced a de-occlusion attention module to improve feature extraction for overlapped prohibited items. Zhao et al. [2] approached the problem from the perspective of label assignment and proposed a label-aware mechanism for detecting overlapping objects.
CNN-based detectors have been extensively investigated for prohibited item detection in X-ray imagery. Two-stage detectors generally obtain candidate regions before performing object classification and bounding-box refinement. For example, Pai et al. [3] integrated a spatial transformer network with Faster R-CNN [4] to study detection under severe occlusion. Single-stage YOLO detectors [5,6,7,8,9] have also been widely adopted because of their efficient detection framework. Cheng et al. [10] developed X-YOLO by incorporating attention and modifying the dynamic detection head of YOLOv5. Zhang et al. [11] proposed MFPIDet, which combines multiscale feature extraction with adaptive feature fusion. Han et al. [12] introduced SC-Lite to decrease network complexity through lightweight feature extraction, fusion, and pruning. Wang et al. [13] developed LM-YOLOv8 based on YOLOv8-seg, using SPPF-LSKA and C2f-MSC to enhance contextual and multiscale feature representation. Zhao et al. [14] further incorporated state space modeling into the YOLO framework and proposed Xray-YOLO-Mamba. Although these CNN-based approaches have improved feature representation and model efficiency, their feature interaction is still dominated by local convolution and hierarchical propagation. Consequently, contextual information from a wider spatial range may not be sufficiently exploited when prohibited items overlap with surrounding objects.
The self-attention mechanism in Transformer [15] can establish relationships among different spatial positions. Alansari et al. [16] proposed MHT-X, which combines multiscale contour information with Vision Transformer to capture the spatial structure of objects and global contextual information. Zhu et al. [17] proposed FDTNet, which employs dual-stream architecture in the spatial and frequency domains to improve feature extraction from X-ray images. Compared with feature extraction methods dominated by local convolution, Transformers can establish relationships among regions over a broader spatial range, providing another way to use contextual information for detecting overlapping objects.
Carion et al. [18] introduced DEtection TRansformer (DETR), bringing Transformers into end-to-end object detection and establishing one-to-one correspondence between predictions and ground truth objects through set prediction and bipartite matching. For X-ray prohibited item detection, Sima et al. [19] proposed MSFA-DETR, which incorporates a multiscale feature extraction structure into the self-attention process and uses foreground feature sequences to improve object query initialization. Li et al. [20] proposed AO-DETR for object overlap in X-ray images, with modifications to queries specific to each category and object localization. Although DETR-based methods improve interactions among different spatial regions, standard DETR often converges slowly and incurs relatively high computational cost, increasing the computational burden in practical security inspection scenarios.
RT-DETR [21] was developed for real-time end-to-end Transformer detection, using an efficient hybrid encoder for multiscale feature processing and an IoU-aware query-selection mechanism to improve object-query initialization. Chen et al. [22] subsequently applied RT-DETR to X-ray prohibited item detection and proposed X-DETR, with modifications to the backbone, AIFI encoder, and bounding box regression process.
However, when objects overlap, their projected information can become mixed within the same region, causing the contours and local structures of prohibited items to be affected by surrounding objects. In such cases, the model needs to establish relationships among different spatial regions while preserving local structures around the target. The AIFI module in RT-DETR uses self-attention to model relationships among spatial positions, whereas its feed-forward network mainly performs channel transformation independently at each position and provides limited direct interaction among neighboring spatial locations. In addition, reducing the number of parameters and computational cost while improving detection performance can lower the computational and storage requirements of the model. During feature fusion, features at different resolutions also require channel transformation and scale adjustment. To address these issues, this study develops RPR-DETR based on RT-DETR-R18, with the following main contributions:
  • A lightweight RGCSPELAN backbone is constructed. It combines the feature splitting strategy of CSP, the hierarchical aggregation mechanism of ELAN, and the structural reparameterization of RepConv. This design preserves features obtained at different processing depths while decreasing both the parameter count and the required computation.
  • A Pola-CGLU encoder is designed. Polarity-aware linear attention and CGLU are introduced into the original AIFI. The polarity-aware linear attention captures long-range relationships among different regions, while CGLU further incorporates local neighborhood information. In this way, the encoding process can make use of both global context and local structures.
  • An RFPN feature fusion structure is constructed. GSConvE and SNI are introduced into the fusion path for feature transformation and scale conversion, respectively, to improve information exchange among features from different levels.

2. RPR-DETR

2.1. RT-DETR-R18 Baseline

RT-DETR follows an end-to-end Transformer detection paradigm. Instead of relying on postprocessing with Non-Maximum Suppression (NMS), it formulates object detection as a set prediction problem and establishes matched pairs between predictions and ground-truth objects through bipartite matching.
In this work, RT-DETR-R18 serves as the baseline. As shown in Figure 1, the model is composed of a ResNet18 backbone, an efficient hybrid encoder, and a Transformer decoder. ResNet18 first generates hierarchical feature maps at different stages. The high-level feature is processed by the Attention-based Intra-scale Feature Interaction (AIFI) module to model interactions within the same scale. The multi-level features are then aggregated by CCFM.
The fused encoder features are passed to the Transformer decoder for object prediction. Before decoding, RT-DETR employs an Intersection over Union (IoU)-aware query selection strategy to identify informative encoder features and use them as initial object queries. These queries are iteratively refined by the decoder layers to produce category predictions and bounding boxes. Figure 2 summarizes the three structural changes introduced in RPR-DETR, covering the backbone, the AIFI encoder, and the cross-scale fusion path.
The three modifications are arranged at successive stages of feature processing. RGCSPELAN generates hierarchical features while reducing model complexity. The high-level S5 feature is subsequently processed by Pola-CGLU to model spatial relationships and local structural information under object overlap and occlusion. RFPN further integrates the processed high-level representation with lower-level spatial features across different scales. Together, these stages connect backbone feature extraction, high-level feature interaction, and cross-scale fusion within RPR-DETR.

2.2. Lightweight RGCSPELAN Backbone

ResNet18 obtains hierarchical representations through successive residual stages. To decrease model complexity while retaining information produced at different processing depths, RGCSPELAN is used as the lightweight backbone in RPR-DETR, as shown in Figure 3.
RGCSPELAN integrates the feature partitioning idea of Cross Stage Partial (CSP) connections with the hierarchical aggregation strategy of the Efficient Layer Aggregation Network (ELAN). After the initial channel adjustment, the feature map is divided into a direct branch and a deeper processing branch. The latter applies RepConv and subsequent convolutions, and intermediate features produced at several depths are concatenated before the final projection to the required output channels.
By retaining feature responses from multiple processing depths, this design avoids forcing all information through convolutional paths of identical depth. The reduced intermediate channel width also limits the additional parameter and computational overhead associated with repeated convolution. RepConv further adopts structural reparameterization: a multi-branch configuration is used during optimization, whereas the learned branches are equivalently merged into a single convolution before inference. Thus, the richer training-time representation does not require a multi-branch structure during deployment.

2.3. Pola-CGLU Encoder

In X-ray images containing overlapping objects, features from neighboring objects may interfere with the representation of the contours and local structures of prohibited items. The encoder should capture dependencies over a sufficiently wide spatial range without discarding local spatial cues. In the original RT-DETR encoder, AIFI is applied to the high-level S5 feature map and performs intra-scale interaction through Multi-Head Self-Attention (MHSA). To alleviate feature ambiguity caused by object overlap and occlusion, the AIFI used in this work is reconstructed by combining the polarity-aware linear attention of PolaFormer [23] with the Convolutional Gated Linear Unit (CGLU) [24], resulting in the Pola-CGLU encoder shown in Figure 4.
The MHSA in the original AIFI computes the relationships among different spatial positions using the query matrix Q, key matrix K, and value matrix V:
Attention ( Q , K , V ) = Softmax Q K T d k V
where dk denotes the feature dimension of a single attention head. The attention weights are obtained from pairwise interactions among spatial tokens and are used to aggregate the corresponding value features.
Traditional linear attention commonly applies nonnegative mappings, such as ReLU, to the query and key matrices, causing negative values to be truncated during the mapping process. Polarity-aware linear attention further decomposes the queries and keys according to their polarity into positive and negative components:
Q + = ReLU ( Q ˜ ) p , Q = ReLU ( Q ˜ ) p K + = ReLU ( K ˜ ) p , K = ReLU ( K ˜ ) p
Here, Q ˜ and K ˜ represent the scaled forms of the query and key matrices, while p is a learnable power exponent. Different combinations of the positive and negative components are used to model relationships between features with the same or opposite polarity, allowing both components to participate in the subsequent linear attention computation. The learnable power exponent adjusts the numerical distribution of each polarity component after nonlinear mapping.
In polarity-aware linear attention, learnable positional encoding is added to the key features to preserve information from different spatial positions. The value features are processed by depth-wise convolution for local spatial modeling and are then added to the output of linear attention. The fused features are multiplied element-wise by the gating branch and subsequently passed through a linear projection to obtain the output of polarity-aware linear attention. In this way, polarity-aware linear attention models spatial relationships across the feature map while retaining a local convolutional processing path.
Although the value branch of polarity-aware linear attention already uses depth-wise convolution to process local spatial information, the original Transformer feed-forward network mainly performs channel transformation independently at each position, with limited direct information exchange among neighboring positions. CGLU is further used to replace the original feed-forward network, introducing local spatial processing into the channel transformation process.
CGLU first applies a convolution to map the input features into a new channel space and then divides them into two branches. One branch is processed by depth-wise convolution and a Gaussian Error Linear Unit (GELU) activation and is then combined with the other branch through element-wise gating. A final convolution restores the required number of output channels. The gated branch can be expressed as:
F(X) = Conv1 × 1[GELU(DWConv3×3(U))⊙V]
where U and V denote the two feature branches obtained after channel mapping, DWConv3×3 denotes a 3 × 3 depth-wise convolution, and ⊙ denotes element-wise multiplication. The depth-wise convolution enables information exchange among neighboring spatial positions during the feed-forward process, while the gating operation controls information transfer between the two branches. The gated output is added to the original input through a residual path, yielding the final feature representation.
Pola-CGLU modifies both processing paths of the original AIFI. The attention branch establishes interactions among different spatial regions while retaining a local convolutional path, whereas CGLU introduces depth-wise-convolution-based neighborhood interaction and gated feature modulation in the feed-forward branch. The combination of the two paths enhances high-level feature representation and helps alleviate feature ambiguity caused by overlapping and partially occluded objects in X-ray images.

2.4. RFPN Feature Fusion Structure

After the high-level S5 feature is processed by Pola-CGLU, feature transformation, scale adjustment, and fusion are further performed across different feature levels. As the spatial resolutions vary across feature levels, their spatial sizes need to be adjusted before fusion. In RPR-DETR, GSConvE and SNI [25] are introduced into the feature fusion path to construct RFPN. GSConvE is used for feature transformation and channel rearrangement, while SNI performs scale conversion between features from different levels.
GSConvE is mainly used for feature transformation in the fusion path, and its structure is shown in Figure 5. Following the initial convolution, the resulting feature is retained as the first branch. The same feature is further processed by a standard convolution, a depth-wise convolution, and GELU activation to form the second branch. The outputs of the two branches are then concatenated along the channel dimension and rearranged using Channel Shuffle. This operation recombines features obtained at different processing depths in the output channels.
Soft Nearest Neighbor Interpolation (SNI) is adopted for scale conversion. SNI first applies nearest-neighbor interpolation and then rescales the upsampled feature according to the input-output resolution ratio. When both spatial dimensions are enlarged by a factor of r, the operation is expressed as:
Y = 1 r 2 Upsample nearest ( X )
where X and Y denote the feature maps before and after scale conversion, respectively, and r is the upsampling factor. SNI does not introduce learnable sampling positions or interpolation weights. Instead, it rescales the output of nearest neighbor interpolation according to the change in spatial resolution.
After feature transformation by GSConvE and scale conversion by SNI, features from different levels are fused at the corresponding spatial resolution, completing multiscale information propagation within the encoder.

3. Experiments and Results

3.1. Experimental Setup

The experiments were performed under Linux on an NVIDIA A800 GPU with 80 GB of memory. The implementation used Python 3.10.14, PyTorch 2.2.2, and CUDA 12.2. During training, images were resized to 640 × 640. A batch size of 4 was used, and optimization was performed with AdamW for 100 epochs using an initial learning rate of 0.0001. For all models trained in this study, training was performed from scratch without pretrained weights. Unless otherwise stated, the same training configuration was used for the comparative and ablation experiments.
For the efficiency evaluation, the batch size was set to 1 with an input size of 640 × 640. Single-image inference latency and peak GPU memory usage were measured. Latency refers to the model inference time per image, excluding preprocessing and post-processing, while peak GPU memory denotes the maximum allocated GPU memory during inference.

3.2. Datasets

Two publicly available X-ray prohibited-item detection datasets, OPIXray and DvXray, were used in the experiments. OPIXray was used for the main comparative experiments, occlusion-level evaluation, and ablation studies, while DvXray was used to further evaluate the detection performance of the proposed model.
OPIXray [1] provides 8885 X-ray images distributed among five prohibited-item categories: Straight Knife, Multi-tool Knife, Folding Knife, Utility Knife, and Scissor. Its official split contains 7109 training images and 1776 test images. For the experiments in this study, 710 samples were taken from the official training partition as the validation set, resulting in 6399 training images, 710 validation images, and 1776 test images. The official test set is divided into three subsets according to the degree of occlusion: OL1, OL2, and OL3, containing 922, 548, and 306 images, respectively. These three subsets together constitute the complete test set.
DvXray [26] consists of 16,000 dual-view sample pairs, corresponding to 32,000 X-ray images, and contains 15 prohibited-item categories such as firearms and knives. The official test partition was kept unchanged, and a subset of the original training data was separated to form the validation set.

3.3. Evaluation Metrics

The models are evaluated in terms of detection performance, model complexity, and runtime efficiency. Precision (P), Recall (R), mAP50, and mAP50:95 are used to evaluate detection performance, while Params and floating-point operations (FLOPs) characterize model complexity. Single-image inference latency and peak GPU memory usage are additionally reported to evaluate runtime efficiency. Equations (5)–(8) provide the definitions of Precision, Recall, category-level average precision, and mean average precision.
P = TP TP + FP
R = TP TP + FN
A P i = 0 1 P i ( R ) dR
mAP = 1 n i = 1 n AP i
In these equations, TP, FP, and FN correspond to true-positive, false-positive, and false-negative predictions, respectively, and n is the number of object categories. mAP50 denotes mean AP at an IoU threshold of 0.5, whereas mAP50:95 is obtained by averaging mAP over IoU thresholds from 0.5 to 0.95 at intervals of 0.05. Params indicate the total number of model parameters, whereas FLOPs are used to characterize the computational requirement of one forward pass.

3.4. Comparative Experiments on the OPIXray Dataset

To evaluate the overall detection performance of RPR-DETR, the proposed model is compared with several YOLO and RT-DETR models, as shown in Table 1. Except for RT-DETR (HGNetV2), all models were retrained using the data split described in Section 3.2. The result of RT-DETR (HGNetV2) was taken from the original study, which used the official 7109-image training set. All results in Table 1 were evaluated on the same official OPIXray test set of 1776 images.
Compared with RT-DETR-R18, RPR-DETR increases Precision, Recall, and mAP50 from 91.6%, 88.7%, and 88.8% to 93.1%, 89.1%, and 90.0%, respectively, while mAP50:95 increases from 40.8% to 41.1%. The proposed model contains 13.7 M parameters and requires 44.1 G FLOPs, compared with 19.9 M parameters and 57.0 G FLOPs for RT-DETR-R18, corresponding to reductions of 31.2% and 22.6%.
Relative to RT-DETR-R34, RPR-DETR increases mAP50 from 89.6% to 90.0%, while reducing the parameter count from 31.1 M to 13.7 M and FLOPs from 88.8 G to 44.1 G. Compared with the listed YOLO models, RPR-DETR achieves lower mAP50:95, but higher Precision, Recall, and mAP50. In particular, its Precision and mAP50 reach 93.1% and 90.0%, respectively, which are the highest values in Table 1. Its number of parameters and FLOPs are also lower than those of the listed YOLO models.
As shown in Table 2, RPR-DETR achieves a single-image inference latency of 32.7 ms, which is close to the 32.3 ms of RT-DETR-R18. Its peak GPU memory usage decreases from 0.243 GB to 0.202 GB, corresponding to a reduction of approximately 16.9%. These results further demonstrate the lightweight characteristics of RPR-DETR, as the model reduces computational complexity and GPU memory usage without a substantial increase in inference latency.
Table 3 further reports the AP50 results for individual prohibited-item categories. The results of AEFNet, GADet-L, FDTNet, and AO-DETR are taken from the corresponding publications. Since their training and evaluation protocols are not fully consistent with those used in this study, these results are included as literature-based references.
Compared with RT-DETR-R18, RPR-DETR improves AP50 by 1.7, 3.2, and 1.0 percentage points for Multi-tool Knife, Folding Knife, and Scissor, respectively. The largest improvement is observed for Folding Knife, while the performance on Straight Knife remains nearly unchanged, and AP50 for Utility Knife decreases by 0.2 percentage points. The overall mAP50 increases from 88.8% to 90.0%. Compared with the other methods listed in Table 3, RPR-DETR achieves the highest AP50 for Folding Knife and the highest overall mAP50.

3.5. Performance Under Different Occlusion Levels

To further evaluate the detection performance under different occlusion conditions, RT-DETR-R18 and RPR-DETR were tested on the OL1, OL2, and OL3 subsets of OPIXray. The same trained models were directly evaluated on each subset without additional training or parameter adjustment. The results are shown in Table 4.
As shown in Table 4, the performance difference between the two models is relatively limited under OL1 and OL2. On OL1, RPR-DETR improves mAP50 from 90.7% to 91.3%, while the other metrics remain close to those of RT-DETR-R18. On OL2, Precision and mAP50:95 increase from 90.1% and 39.5% to 91.9% and 40.7%, respectively, whereas Recall and mAP50 show slight decreases.
A more evident difference is observed on OL3. Compared with RT-DETR-R18, RPR-DETR improves Precision from 90.2% to 92.1%, Recall from 82.7% to 86.2%, and mAP50 from 86.0% to 89.2%, corresponding to gains of 1.9, 3.5, and 3.2 percentage points, respectively, while mAP50:95 remains unchanged at 38.7%. The larger gains under OL3 indicate that the advantage of RPR-DETR becomes more evident under severe occlusion, particularly in Recall and mAP50.

3.6. Module Comparison and Ablation Studies

3.6.1. Comparison of Different Backbones

To evaluate candidate lightweight backbones for this task, RGCSPELAN was compared with ConvNeXtV2, MobileNetV4, and EfficientViT in terms of detection performance and computational cost, while the remaining network structure and training settings were kept unchanged. The results are shown in Table 5.
As shown in Table 5, RGCSPELAN achieves a Precision of 92.1%, a Recall of 88.7%, an mAP50 of 89.2%, and an mAP50:95 of 41.0%, all of which are the highest among the candidate backbones. EfficientViT has the lowest number of parameters and FLOPs, but its mAP50 is only 85.3%. Although ConvNeXtV2 requires fewer FLOPs, its mAP50 and mAP50:95 are 87.9% and 40.2%, respectively, both lower than those of RGCSPELAN. Considering the detection metrics, number of parameters, and FLOPs, RGCSPELAN is selected as the backbone of the proposed model.

3.6.2. Evaluation of Feature Fusion Structures

To evaluate different feature fusion structures, RFPN was compared with HWD, CARAFE, and WaveletPool in terms of detection performance, parameter count, and FLOPs, while all other network components and training settings were kept unchanged. The results are presented in Table 6.
As shown in Table 6, CARAFE achieves the highest Precision and mAP50:95, whereas RFPN achieves the highest Recall and mAP50, reaching 89.2% and 89.5%, respectively. The FLOPs of RFPN are 56.4 G, slightly higher than those of HWD but lower than those of CARAFE and WaveletPool. Considering Recall, mAP50, and FLOPs, RFPN is selected as the feature fusion structure in the proposed model.

3.6.3. Ablation Study

To evaluate the contribution of each proposed module, RT-DETR-R18 was used as the baseline, and RGCSPELAN, Pola-CGLU, and RFPN were individually introduced into the baseline. Different combinations of these modules were also evaluated on OPIXray. Table 7 summarizes the corresponding ablation configurations.
With RGCSPELAN alone, mAP50 reaches 89.2% compared with 88.8% for the baseline, while Params and FLOPs change from 19.9 M and 57.0 G to 13.8 M and 44.5 G, respectively. This result shows that RGCSPELAN reduces the number of parameters and computational cost while maintaining detection performance. When Pola-CGLU is used alone, Precision increases to 92.9% and mAP50 reaches 89.2%. With RFPN alone, Recall and mAP50 reach 89.2% and 89.5%, respectively. These results indicate that RGCSPELAN mainly contributes to model lightweighting, Pola-CGLU enhances feature interaction in the encoder, and RFPN improves cross-scale feature fusion.
The combined-module results indicate that the effects of the three modifications are not simply additive. RGCSPELAN changes the hierarchical feature representations generated by the backbone, while RFPN subsequently performs cross-scale transformation and fusion on these features. In the configuration combining RGCSPELAN and RFPN, the original AIFI is retained, and the resulting mAP50 of 89.1% is slightly lower than the 89.5% obtained with RFPN alone, showing that modifications to feature extraction and cross-scale fusion do not necessarily produce cumulative gains. Pola-CGLU replaces the original AIFI for processing the high-level S5 feature and introduces additional feature interaction before cross-scale fusion. By combining spatial relationship modeling with local neighborhood interaction, the S5 feature generated by the modified backbone is further processed before entering RFPN. With all three modifications enabled, mAP50 reaches 90.0%, the highest among the ablation configurations. Although the configuration combining Pola-CGLU and RFPN achieves a slightly higher mAP50:95 of 41.5%, RPR-DETR reduces the number of parameters to 13.7 M and FLOPs to 44.1 G while achieving the highest mAP50. Accordingly, RPR-DETR was selected based on the overall balance between detection performance and model complexity rather than the best result on a single evaluation metric.

3.7. Validation on the DvXray Dataset

RPR-DETR was further evaluated on DvXray to examine its performance on a second X-ray security inspection dataset, with the corresponding results summarized in Table 8.
On DvXray, RPR-DETR obtains 94.7% Precision, 85.6% Recall, 90.8% mAP50, and 73.7% mAP50:95, as reported in Table 8. Compared with RT-DETR-R18, these values are higher by 1.6, 0.6, 1.4, and 2.4 percentage points, respectively. Its parameter count and FLOPs decrease from 19.9 M and 57.0 G to 13.7 M and 44.1 G, respectively. RPR-DETR also provides the highest Precision, Recall, mAP50, and mAP50:95 among the listed YOLO models while requiring fewer parameters and FLOPs. These results show that the performance gains of RPR-DETR are maintained on a second X-ray security inspection dataset.

3.8. Detection Results and Visualization Analysis

To visually compare the detection performance of the two models on X-ray images, representative samples with noticeable object overlap or densely distributed surrounding objects are selected from the OPIXray and DvXray datasets. Figure 6 and Figure 7 present the detection outputs and Grad-CAM response maps of RT-DETR-R18 and RPR-DETR on OPIXray and DvXray, respectively. In the Grad-CAM heatmaps, colors from blue to red indicate increasing response intensity. The target layers for heatmap visualization were the final P3, P4, and P5 feature maps before the RT-DETR decoder, corresponding to layers 19, 22, and 25 in RT-DETR-R18 and layers 20, 23, and 26 in RPR-DETR.
As shown in Figure 6 and Figure 7, RT-DETR-R18 produces several false detections, missed detections, and redundant predictions in the selected samples, whereas RPR-DETR produces fewer such errors. The Grad-CAM heatmaps show that, for some samples, the highlighted regions of the baseline model extend to objects surrounding the target. In contrast, the highlighted regions of RPR-DETR are more concentrated on the prohibited items and their contours. These results indicate that RPR-DETR focuses more closely on prohibited item regions in the selected samples with object overlap and dense surrounding objects.

4. Conclusions

This study presents RPR-DETR, an improved RT-DETR-R18 detector obtained by redesigning the backbone, AIFI encoder, and cross-level feature fusion process. RGCSPELAN is used to decrease model complexity while retaining representations from different processing depths. Pola-CGLU combines polarity-aware attention with local convolutional processing to model interactions among different spatial regions while retaining neighborhood information during encoding. In the fusion stage, GSConvE and SNI modify feature transformation and scale conversion across different levels.
RPR-DETR achieves 90.0% mAP50 on OPIXray, exceeding RT-DETR-R18 by 1.2 percentage points, while the number of parameters and FLOPs are reduced by 31.2% and 22.6%, respectively. Under the most severe OL3 occlusion condition, Recall and mAP50 improve by 3.5 and 3.2 percentage points over RT-DETR-R18, respectively. The peak GPU memory usage is reduced by approximately 16.9%, while the single-image inference latency remains comparable to that of the baseline. On DvXray, RPR-DETR records 90.8% mAP50 and 73.7% mAP50:95, improving on RT-DETR-R18 by 1.4 and 2.4 percentage points, respectively. The ablation experiments further verify the roles of the three introduced components. Qualitative detection examples show fewer missed, false, and redundant predictions in the selected samples, while Grad-CAM results indicate that the response regions of RPR-DETR are more concentrated around prohibited items and their contours.
Future research will investigate deployment and inference performance on practical security inspection equipment and evaluate detection stability under different operating environments.

Author Contributions

Conceptualization, J.S. and J.W.; methodology, J.S.; software, J.S.; validation, J.S.; data curation, J.S.; visualization, J.S.; writing—original draft preparation, J.S.; writing—review and editing, J.S. and J.W.; supervision, J.W.; funding acquisition, J.W. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the Key Research and Development Program of Shaanxi Province, grant number 2025SF-YBXM-066, and the Special Research Program Project of the Shaanxi Provincial Department of Education, grant number 23JK0363.

Data Availability Statement

The datasets used in this study are publicly available. The OPIXray and DvXray datasets can be accessed through their respective official repositories: OPIXray (https://github.com/OPIXray-author/OPIXray, accessed on 15 August 2025) and DvXray (https://github.com/Mbwslib/DvXray, accessed on 28 December 2025).

Acknowledgments

The authors would like to thank the School of Mathematics and Computer Science, Shaanxi University of Technology, for providing the GPU computing resources and experimental environment used in this study.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Wei, Y.; Tao, R.; Wu, Z.; Ma, Y.; Zhang, L.; Liu, X. Occluded prohibited items detection: An X-ray security inspection benchmark and de-occlusion attention module. In Proceedings of the 28th ACM International Conference on Multimedia, Seattle, WA, USA, 12–16 October 2020; pp. 138–146. [Google Scholar] [CrossRef] [Scilit]
  2. Zhao, C.; Zhu, L.; Dou, S.; Deng, W.; Wang, L. Detecting overlapped objects in X-ray security imagery by a label-aware mechanism. IEEE Trans. Inf. Forensics Secur. 2022, 17, 998–1009. [Google Scholar] [CrossRef] [Scilit]
  3. Pai, P.; Kumar, S.K.; Kumar, G.A. Improving prohibited item detection in X-ray images using neural networks under complex occlusion conditions. IEEE Access 2025, 13, 182608–182620. [Google Scholar] [CrossRef] [Scilit]
  4. Ren, S.; He, K.; Girshick, R.; Sun, J. Faster R-CNN: Towards real-time object detection with region proposal networks. IEEE Trans. Pattern Anal. Mach. Intell. 2017, 39, 1137–1149. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  5. Redmon, J.; Divvala, S.; Girshick, R.; Farhadi, A. You only look once: Unified, real-time object detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, NV, USA, 27–30 June 2016; pp. 779–788. [Google Scholar] [CrossRef] [Scilit]
  6. Jocher, G.; Chaurasia, A.; Stoken, A.; Borovec, J.; Kwon, Y.; Michael, K.; Fang, J.; Wong, C.; Zeng, Y.; Montes, D.; et al. Ultralytics/YOLOv5: v6.2—YOLOv5 classification models, Apple M1, reproducibility, ClearML and Deci.ai integrations. Zenodo 2022. [Google Scholar] [CrossRef]
  7. Jocher, G.; Chaurasia, A.; Qiu, J. YOLOv8 by Ultralytics. Available online: https://github.com/ultralytics/ultralytics (accessed on 14 August 2026).
  8. Wang, A.; Chen, H.; Liu, L.; Chen, K.; Lin, Z.; Han, J.; Ding, G. YOLOv10: Real-time end-to-end object detection. Adv. Neural Inf. Process. Syst. 2024, 37, 107984–108011. [Google Scholar] [CrossRef] [Scilit]
  9. Tian, Y.; Ye, Q.; Doermann, D. YOLOv12: Attention-centric real-time object detectors. Adv. Neural Inf. Process. Syst. 2025, 38, 78433–78457. [Google Scholar] [CrossRef] [Scilit]
  10. Cheng, Q.; Lan, T.; Cai, Z.; Li, J. X-YOLO: An efficient detection network of dangerous objects in X-ray baggage images. IEEE Signal Process. Lett. 2024, 31, 2270–2274. [Google Scholar] [CrossRef] [Scilit]
  11. Zhang, L.; Huang, Z.A.; Shi, C.; Ma, H.; Li, X.; Wu, X. MFPIDet: Improved YOLOv7 architecture based on multi-scale feature fusion for prohibited item detection in complex environment. Complex Intell. Syst. 2024, 10, 8095–8108. [Google Scholar] [CrossRef] [Scilit]
  12. Han, L.; Ma, C.; Liu, Y.; Sun, J.; Jia, J. SC-Lite: An efficient lightweight model for real-time X-ray security check. IEEE Access 2024, 12, 103419–103432. [Google Scholar] [CrossRef] [Scilit]
  13. Wang, T.; Yuan, P.; Wang, A. Dangerous goods detection in X-ray security inspection images based on improved YOLOv8-seg. Electronics 2026, 15, 1112. [Google Scholar] [CrossRef] [Scilit]
  14. Zhao, K.; Peng, S.; Li, Y.; Lu, T. A lightweight Xray-YOLO-Mamba model for prohibited item detection in X-ray images using selective state space models. Sci. Rep. 2025, 15, 13171. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  15. Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, L.; Polosukhin, I. Attention is all you need. Adv. Neural Inf. Process. Syst. 2017, 30, 5998–6008. [Google Scholar]
  16. Alansari, M.; Ahmed, A.; Alnuaimi, K.; Velayudhan, D.; Hassan, T.; Javed, S.; Bennamoun, M.; Werghi, N. Multi-scale hierarchical contour framework for detecting cluttered threats in baggage security. IEEE Access 2024, 12, 77454–77467. [Google Scholar] [CrossRef] [Scilit]
  17. Zhu, Z.; Zhu, Y.; Wang, H.; Wang, N.; Ye, J.; Ling, X. FDTNet: Enhancing frequency-aware representation for prohibited object detection from X-ray images via dual-stream transformers. Eng. Appl. Artif. Intell. 2024, 133, 108076. [Google Scholar] [CrossRef] [Scilit]
  18. Carion, N.; Massa, F.; Synnaeve, G.; Usunier, N.; Kirillov, A.; Zagoruyko, S. End-to-end object detection with transformers. In Proceedings of the European Conference on Computer Vision (ECCV 2020), Glasgow, UK, 23–28 August 2020; pp. 213–229. [Google Scholar] [CrossRef] [Scilit]
  19. Sima, H.; Chen, B.; Tang, C. Multi-Scale Feature Attention-DEtection TRansformer: Multi-Scale Feature Attention for security check object detection. IET Comput. Vis. 2024, 18, 613–625. [Google Scholar] [CrossRef] [Scilit]
  20. Li, M.; Jia, T.; Wang, H.; Ma, B.; Lu, H.; Lin, S.; Cai, D.; Chen, D. AO-DETR: Anti-overlapping DETR for X-ray prohibited items detection. IEEE Trans. Neural Netw. Learn. Syst. 2025, 36, 12076–12090. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  21. Zhao, Y.; Lv, W.; Xu, S.; Wei, J.; Wang, G.; Dang, Q.; Liu, Y.; Chen, J. DETRs beat YOLOs on real-time object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 17–21 June 2024; pp. 16965–16974. [Google Scholar] [CrossRef] [Scilit]
  22. Chen, M.; Lin, Z.; Jiang, N.; Zhu, L.; Zhang, Z.; Li, X.L.; Zhang, X. X-DETR: Edge-aware fusion and frequency domain enhanced lightweight real-time framework for X-ray security screening detection. In Proceedings of the 5th International Conference on Electronic Information Engineering and Computer Technology (EIECT), Jiangmen, China, 24–26 October 2025; pp. 55–59. [Google Scholar] [CrossRef] [Scilit]
  23. Meng, W.; Luo, Y.; Li, X.; Jiang, D.; Zhang, Z. PolaFormer: Polarity-aware linear attention for vision transformers. In Proceedings of the International Conference on Learning Representations (ICLR), Singapore, 24–28 April 2025. [Google Scholar]
  24. Shi, D. TransNeXt: Robust foveal visual perception for vision transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA, 17–21 June 2024; pp. 17773–17783. [Google Scholar] [CrossRef] [Scilit]
  25. Li, H. Rethinking features-fused-pyramid-neck for object detection. In Proceedings of the European Conference on Computer Vision (ECCV 2024), Milan, Italy, 29 September–4 October 2024; pp. 74–90. [Google Scholar] [CrossRef] [Scilit]
  26. Ma, B.; Jia, T.; Li, M.; Wu, S.; Wang, H.; Chen, D. Toward dual-view X-ray baggage inspection: A large-scale benchmark and adaptive hierarchical cross refinement for prohibited item discovery. IEEE Trans. Inf. Forensics Secur. 2024, 19, 3866–3878. [Google Scholar] [CrossRef] [Scilit]
  27. Cani, J.; Diou, C.; Evangelatos, S.; Argyriou, V.; Radoglou-Grammatiki, P.; Sarigiannidis, P.; Varlamis, I.; Papadopoulos, G.T. Illicit object detection in X-ray imaging using deep learning techniques: A comparative evaluation. IEEE Access 2026, 14, 27171–27208. [Google Scholar] [CrossRef] [Scilit]
  28. Zhu, K.; Chang, X.; Zhang, Q. AEFNet: A real-time network for detecting prohibited items in X-ray images across complex scenarios. Meas. Sci. Technol. 2025, 36, 036004. [Google Scholar] [CrossRef] [Scilit]
  29. Li, M.; Ma, B.; Wang, H.; Chen, D.; Jia, T. GADet: A geometry-aware X-ray prohibited items detector. IEEE Sens. J. 2024, 24, 1665–1678. [Google Scholar] [CrossRef] [Scilit]
  30. Woo, S.; Debnath, S.; Hu, R.; Chen, X.; Liu, Z.; Kweon, I.S.; Xie, S. ConvNeXt V2: Co-designing and scaling ConvNets with masked autoencoders. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Vancouver, BC, Canada, 17–24 June 2023; pp. 16133–16142. [Google Scholar] [CrossRef] [Scilit]
  31. Qin, D.; Leichner, C.H.; Delakis, M.; Fornoni, M.; Luo, S.; Yang, F.; Wang, W.; Banbury, C.; Ye, C.; Akin, B.; et al. MobileNetV4: Universal models for the mobile ecosystem. In Proceedings of the European Conference on Computer Vision (ECCV 2024), Milan, Italy, 29 September–4 October 2024; pp. 78–96. [Google Scholar] [CrossRef] [Scilit]
  32. Cai, H.; Li, J.; Hu, M.; Gan, C.; Han, S. EfficientViT: Lightweight multi-scale attention for high-resolution dense prediction. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), Paris, France, 1–6 October 2023; pp. 17302–17313. [Google Scholar] [CrossRef] [Scilit]
  33. Xu, G.; Liao, W.; Zhang, X.; Li, C.; He, X.; Wu, X. Haar wavelet downsampling: A simple but effective downsampling module for semantic segmentation. Pattern Recognit. 2023, 143, 109819. [Google Scholar] [CrossRef] [Scilit]
  34. Wang, J.; Chen, K.; Xu, R.; Liu, Z.; Loy, C.C.; Lin, D. CARAFE: Content-aware reassembly of features. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), Seoul, Republic of Korea, 27 October–2 November 2019; pp. 3007–3016. [Google Scholar] [CrossRef] [Scilit]
  35. Williams, T.L.; Li, R. Wavelet pooling for convolutional neural networks. In Proceedings of the International Conference on Learning Representations (ICLR), Vancouver, BC, Canada, 30 April–3 May 2018. [Google Scholar]
Figure 1. Network architecture of RT-DETR-R18.
Figure 1. Network architecture of RT-DETR-R18.
Electronics 15 04145 g001
Figure 2. Overall architecture of RPR-DETR.
Figure 2. Overall architecture of RPR-DETR.
Electronics 15 04145 g002
Figure 3. Architecture of RGCSPELAN.
Figure 3. Architecture of RGCSPELAN.
Electronics 15 04145 g003
Figure 4. Architecture of the Pola-CGLU encoder.
Figure 4. Architecture of the Pola-CGLU encoder.
Electronics 15 04145 g004
Figure 5. Architecture of the GSConvE module.
Figure 5. Architecture of the GSConvE module.
Electronics 15 04145 g005
Figure 6. Detection and Grad-CAM comparison on OPIXray: (a) RT-DETR-R18 detections; (b) RT-DETR-R18 Grad-CAM responses; (c) RPR-DETR detections; (d) RPR-DETR Grad-CAM responses.
Figure 6. Detection and Grad-CAM comparison on OPIXray: (a) RT-DETR-R18 detections; (b) RT-DETR-R18 Grad-CAM responses; (c) RPR-DETR detections; (d) RPR-DETR Grad-CAM responses.
Electronics 15 04145 g006
Figure 7. Detection and Grad-CAM comparison on DvXray: (a) RT-DETR-R18 detections; (b) RT-DETR-R18 Grad-CAM responses; (c) RPR-DETR detections; (d) RPR-DETR Grad-CAM responses.
Figure 7. Detection and Grad-CAM comparison on DvXray: (a) RT-DETR-R18 detections; (b) RT-DETR-R18 Grad-CAM responses; (c) RPR-DETR detections; (d) RPR-DETR Grad-CAM responses.
Electronics 15 04145 g007
Table 1. Comparison of different models on the OPIXray dataset.
Table 1. Comparison of different models on the OPIXray dataset.
ModelP/%R/%mAP50/%mAP50:95/%FLOPs/GParams/M
YOLOv5m87.483.088.743.364.025.0
YOLOv8m88.284.888.942.678.725.8
YOLOv11m87.884.689.043.067.720.0
YOLOv12m87.783.488.743.059.519.6
YOLOv12l87.684.688.642.682.026.4
YOLOv13l89.084.689.042.284.326.9
RT-DETR(HGNetV2) [27]89.838.9110.032.0
RT-DETR-R1891.688.788.840.857.019.9
RT-DETR-R3492.889.189.641.488.831.1
RPR-DETR93.189.190.041.144.113.7
Table 2. Comparison of model complexity and runtime efficiency.
Table 2. Comparison of model complexity and runtime efficiency.
ModelFLOPs/GParams/MLatency/msPeak GPU Memory/GB
RT-DETR-R1857.019.932.30.243
RPR-DETR44.113.732.70.202
Table 3. Category-wise AP50 comparison on the OPIXray dataset.
Table 3. Category-wise AP50 comparison on the OPIXray dataset.
ModelSTMUFOUTSCmAP50/%
AEFNet [28]76.395.994.180.899.089.2
GADet-L [29]54.085.281.877.589.877.7
FDTNet [17]74.691.291.585.297.688.0
AO-DETR [20]63.088.484.877.790.180.8
RT-DETR-R1875.693.791.686.896.488.8
RPR-DETR75.795.494.886.697.490.0
Note: ST, Straight Knife; MU, Multi-tool Knife; FO, Folding Knife; UT, Utility Knife; SC, Scissor.
Table 4. Detection performance under different occlusion levels on OPIXray.
Table 4. Detection performance under different occlusion levels on OPIXray.
Occlusion LevelModelP/%R/%mAP50/%mAP50:95/%
OL1RT-DETR-R1893.690.190.742.6
RPR-DETR93.690.391.342.2
OL2RT-DETR-R1890.188.387.639.5
RPR-DETR91.988.087.440.7
OL3RT-DETR-R1890.282.786.038.7
RPR-DETR92.186.289.238.7
Table 5. Comparison of different backbone networks.
Table 5. Comparison of different backbone networks.
BackboneP/%R/%mAP50/%mAP50:95/%FLOPs/GParams/M
ConvNeXtV2 [30]90.286.787.940.231.912.3
MobileNetV4 [31]91.284.686.539.939.511.3
EfficientViT [32]89.685.185.338.527.210.7
RGCSPELAN92.188.789.241.044.513.8
Table 6. Comparison of different feature fusion schemes.
Table 6. Comparison of different feature fusion schemes.
FusionP/%R/%mAP50/%mAP50:95/%FLOPs/GParams/M
HWD [33]90.988.289.041.455.619.2
CARAFE [34]92.688.889.341.557.320.0
WaveletPool [35]92.288.488.840.760.919.1
RFPN92.289.289.541.156.419.6
Table 7. Ablation results of RPR-DETR.
Table 7. Ablation results of RPR-DETR.
BaselineRGCSPELANPola-CGLURFPNP/%R/%mAP50/%mAP50:95/%FLOPs/GParams/M
91.688.788.840.857.019.9
92.188.789.241.044.513.8
92.988.189.241.057.220.1
92.289.289.541.156.419.6
93.688.689.040.644.714.0
92.888.689.140.743.913.6
93.288.589.341.556.619.8
93.189.190.041.144.113.7
Note: ✓ indicates that the corresponding module is included in the model.
Table 8. Detection performance of different models on DvXray.
Table 8. Detection performance of different models on DvXray.
ModelP/%R/%mAP50/%mAP50:95/%FLOPs/GParams/M
YOLOv8m89.979.687.870.978.725.8
YOLOv11m89.978.386.667.267.720.0
YOLOv12m90.876.685.766.159.519.6
YOLOv13l90.381.689.372.184.426.9
RT-DETR-R1893.185.089.471.357.019.9
RPR-DETR94.785.690.873.744.113.7
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Song, J.; Wei, J. A Lightweight RPR-DETR for Prohibited Item Detection in X-Ray Security Inspection Images. Electronics 2026, 15, 4145. https://doi.org/10.3390/electronics15184145

AMA Style

Song J, Wei J. A Lightweight RPR-DETR for Prohibited Item Detection in X-Ray Security Inspection Images. Electronics. 2026; 15(18):4145. https://doi.org/10.3390/electronics15184145

Chicago/Turabian Style

Song, Jia, and Jia Wei. 2026. "A Lightweight RPR-DETR for Prohibited Item Detection in X-Ray Security Inspection Images" Electronics 15, no. 18: 4145. https://doi.org/10.3390/electronics15184145

APA Style

Song, J., & Wei, J. (2026). A Lightweight RPR-DETR for Prohibited Item Detection in X-Ray Security Inspection Images. Electronics, 15(18), 4145. https://doi.org/10.3390/electronics15184145

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop