3.1. Augmentation of the SIXray Dataset
The SIXray dataset is a dedicated object detection dataset designed for X-ray security screening scenarios [
20]. It comprises luggage images collected from Beijing subway security checkpoints, aiming to locate and classify prohibited items with a focus on five frequently occurring categories: guns, knives, wrenches, pliers, and scissors [
21,
22].
Figure 1 presents an overview of the data augmentation methods applied to the SIXray dataset. The original dataset did not include a dedicated validation set. To address this, we constructed a validation set by randomly sampling 5546 images from the original training set, which initially comprised 74,960 images in total. The remaining 69,414 images formed a new training set, while the original 13,412 images were retained as the test set to prevent data leakage.
As shown in
Figure 2, to mitigate the issue of insufficient sample size, images containing wrenches, pliers, and scissors were randomly rotated and scaled. The generated augmented samples were incorporated into the training set. After increasing the sample size for these three categories, the total number of training images reached 74,392. Since negative samples constituted over 85% of the dataset, potentially causing the model to favor “safe predictions,” the number of negative samples was halved to mitigate data bias, reducing the training set from 74,392 to 43,358 images. Unlike traditional methods that rely solely on oversampling or undersampling to adjust data distribution, this approach combines rotation-scaling augmentation with negative sample reduction. This optimizes the positive-to-negative sample ratio from 1:6 to 1:3, better accommodating complex scene requirements.
To evaluate data augmentation effectiveness, we compared the accuracy of two models on both the original and augmented datasets (
Table 1).
As detailed in
Table 1, the data augmentation strategy yielded a substantial surge in rare category instances. Specifically, initially scarce samples such as Scissors (increasing from 709 to 1490), Wrench (from 1532 to 3734), and Pliers experienced a twofold or greater increase. Concurrently, background samples were rigorously suppressed, plummeting from 62,068 to 31,034. This augmentation approach successfully rectified the extreme inherent data imbalance, effectively breaking the model’s bias towards background dominance and compelling it to extract features from historically rare contraband items. Observing the precision variations of YOLOv8m before and after augmentation, easily identifiable or majority classes experienced a marginal precision drop (e.g., Gun decreased from 0.96223 to 0.95341). Conversely, extremely challenging rare classes demonstrated notable gains, with Scissors improving from 0.78019 to 0.79909. For YOLOv8m, data augmentation served as a pivotal rebalancing mechanism. Sacrificing a negligible amount of precision in head classes to secure significant improvements in difficult tail classes constitutes a highly advantageous trade-off for real-world security screening scenarios. In contrast to YOLOv8m, YOLO11m exhibited exceptional performance post-augmentation: all foreground target classes (Gun, Knife, Wrench, Pliers, and Scissors) achieved positive precision growth. Most notably, the precision of Knife saw a dramatic leap from 0.91549 to 0.96014. Under this data-rebalancing protocol, the YOLO11m baseline accommodates the augmented training distribution more favorably than YOLOv8m for the reported foreground categories.
For the prohibited-item detection task considered in this study, Precision, Recall, F1-score, and mAP50 were selected as the core evaluation metrics. Precision, Recall, and F1-score summarize classification reliability under imbalanced conditions [
23], while mAP50 evaluates the combined localization and classification quality at an intersection-over-union threshold of 0.5. Together, these metrics reflect the trade-off between false alarms, missed detections, and overall detection performance.
3.2. Scale-Aware MobileNetV3 Backbone Reconstruction
The computational capacity, memory bandwidth, and energy budget of edge-based X-ray inspection equipment are substantially lower than those of workstation GPUs. Direct deployment of a conventional YOLO backbone may therefore impose excessive storage and arithmetic costs, even when the detector satisfies the required recognition accuracy. To reduce this deployment burden, the original backbone is reconstructed using MobileNetV3-Small, while the neck and detection heads are retained so that the structural effect of backbone replacement can be evaluated independently.
MobileNet factorizes a standard convolution into channel-wise spatial filtering and pointwise channel mixing, thereby establishing an explicit trade-off between recognition accuracy and resource consumption [
24]. This operator has subsequently been adopted in lightweight detection and structured compression frameworks to reduce the cost of feature extraction [
25,
26]. These studies also indicate that a reduction in theoretical FLOPs does not automatically guarantee an equivalent detector-level acceleration, because the interaction between depthwise and pointwise operations, memory access, and the target hardware must also be considered.
The preservation of information becomes more critical as model capacity decreases. MobileNetV2 introduced inverted residuals and linear bottlenecks because nonlinear transformations in narrow feature spaces may destroy information that cannot be recovered by subsequent layers [
27]. MobileNetV3 further combined these principles with hardware-aware neural architecture search and NetAdapt-based platform adaptation, and separately optimized its Large and Small variants for different resource regimes [
28,
29]. Its hard-swish activation is intended as a hardware-oriented approximation of swish rather than an assertion of universally superior nonlinear representation [
30]. The low arithmetic burden of MobileNetV3 has consequently motivated its use in power-constrained vision systems and lightweight YOLO detectors [
31,
32]. In the X-ray inspection domain, LightRay replaced the YOLOv4 backbone with MobileNetV3 and introduced shallow-feature enhancement and attention-based fusion to compensate for information loss affecting small and occluded targets [
11]. These findings motivate the research sequence adopted here: the lightweight backbone is first evaluated as an isolated structural intervention, and attention-based compensation is then examined separately in
Section 3.3.
The detailed reconstruction paths are shown in
Figure 3 and
Figure 4. In the implemented YOLOv8m and YOLO11m definitions, the original backbone portion corresponding to layers 0–8 is replaced by three cascaded MobileNetV3-Small stages, denoted MobileNet1, MobileNet2, and MobileNet3. MobileNet1 extracts shallow, high-resolution features and routes them to the second concatenation path of the neck, located at layer 8 in
Figure 3 and layer 9 in
Figure 4. MobileNet2 produces intermediate features describing object shape and occlusion relationships and connects them to the first concatenation path, located at layer 5 in
Figure 3 and layer 6 in
Figure 4. MobileNet3 supplies the deep semantic representation to the original top-down and bottom-up feature-fusion path. The upsampling, concatenation, multiscale fusion, and detection-head structures are otherwise retained. This arrangement preserves three-level feature delivery while allowing the original convolutional stack to be replaced by inverted-residual and depthwise-separable operations.
To determine whether the same reconstruction behaves consistently at different detector capacities, the experiment was extended from the principal YOLO11m model to the n, s, and l variants. YOLOv8m is retained as a cross-generation reference. For every YOLO11 baseline–MobileNet pair, the data split, image resolution, optimization protocol, evaluation procedure, and random seed were held constant. All scale-wise results reported in
Table 2 use random seed 41. The absolute change in mAP50 is reported in percentage points, while parameter and FLOP changes are calculated relative to the corresponding baseline.
Table 2 shows that the effect of MobileNetV3 reconstruction is scale dependent rather than uniformly beneficial. For YOLO11n, FLOPs decrease by 20.28%, but mAP50 decreases from 0.79751 to 0.78164, corresponding to a loss of 1.587 percentage points. The parameter count also increases from 2.591 M to 2.847 M. Thus, the adopted reconstruction does not constitute effective parameter compression at the n scale. Because the original nano model is already highly compact, the fixed cost of stage interfaces and channel adaptation occupies a larger fraction of the network, while the reduced cross-channel interaction of depthwise convolution becomes more consequential. The result is therefore treated as a capacity-limited failure case rather than being concealed as a successful lightweighting result. This interpretation is compatible with the information-preservation motivation behind the linear bottlenecks of MobileNetV2 [
27]. YOLO11s occupies a more favorable operating region. Its mAP50 changes from 0.83121 to 0.83254, an increase of only 0.133 percentage points, while parameters and FLOPs decrease by 30.22% and 46.03%, respectively.
The strongest observed accuracy–efficiency result occurs at the m scale. YOLO11m-MobileNet improves mAP50 from 0.87235 to 0.88469 under seed 41, corresponding to a gain of 1.234 percentage points, while reducing parameters from 20.03 M to 12.00 M and FLOPs from 67.3 G to 28.8 G. Because YOLO11m was selected as the principal architecture, the baseline–MobileNet comparison was additionally repeated using seeds 42 and 43. As shown in
Table 3, the MobileNetV3-reconstructed model improves mAP50 under all three evaluated seeds. The complete downstream module-ablation study was subsequently conducted using seeds 41, 42, and 43, following the statistical reporting protocol described in
Section 4.1.3.
For YOLO11l, the parameter count and FLOPs decrease by 39.73% and 56.13%, respectively, whereas mAP50 rises by 0.297 percentage points. The l-scale model therefore retains sufficient absolute capacity after compression, and much of its original computation appears redundant for the present five-category SIXray task. However, the accuracy difference is small and has not yet been verified by repeated-seed experiments. In addition, the compressed l model still requires 15.258 M parameters and 38.298 G FLOPs, exceeding the cost of YOLO11m-MobileNet and weakening its suitability for constrained deployment.
The YOLOv8m comparison provides cross-generation evidence that MobileNet-based reconstruction can also preserve or improve detection performance outside the YOLO11 family. The reconstructed model increases mAP50 from 0.88009 to 0.89615, corresponding to a gain of 1.606 percentage points, while reducing the parameter count from 33.94 M to 20.07 M and FLOPs from 85.4 G to 67.7 G.
The observed non-monotonic pattern agrees with the broader model-scaling literature without being directly implied by it. EfficientNet demonstrated that depth, width, and input resolution should be balanced rather than changed independently [
33]; EfficientDet extended this principle to the joint scaling of the backbone, feature-fusion network, and prediction heads in an object detector [
34]. In the present experiment, the same MobileNetV3 reconstruction interacts with neck and head configurations of different capacities. At the n scale, the representational bottleneck and fixed interface overhead dominate; at the s scale, accuracy is maintained under compression; at the m scale, redundancy removal and retained capacity are most favorably balanced; and at the l scale, large computational redundancy can be removed, but the remaining deployment cost is still comparatively high.
Accordingly, MobileNetV3 should not be described as a universally beneficial drop-in replacement for every YOLO scale. The experiments instead identify a capacity-dependent operating range. YOLO11n approaches the lower representational boundary, YOLO11s offers accuracy-preserving compression, and YOLO11l retains unnecessary deployment cost despite strong compression. YOLO11m provides the most favorable observed balance among detection accuracy, parameter count, and arithmetic complexity, and the positive effect of its backbone reconstruction is reproduced across the three evaluated seeds. It is therefore selected as the principal YOLO11 architecture for the attention-compensation experiments in
Section 3.3 and the subsequent VF-BCE optimization.
The scale-wise experiment above is a backbone-reconstruction study and should not be confused with the final-model comparison requested for lightweight deployment. A direct comparison of the complete YOLO-EMV model against the standard YOLO11n, YOLO11s, and YOLO11m baselines under the common seed-41 protocol is reported separately in
Section 4.4.
3.3. Attention Mechanism for Enhanced Feature Extraction
Complex X-ray scenes contain overlapping objects, low-contrast boundaries, and substantial background interference, which can weaken the detector response to small or partially occluded prohibited items [
35,
36,
37]. Three representative attention mechanisms were therefore compared. CBAM combines sequential channel and spatial attention to refine feature responses [
38]; SE models global channel dependencies through squeeze and excitation operations [
39]; and ECA performs lightweight local cross-channel interaction using one-dimensional convolution without dimensionality reduction [
40]. Their structures are summarized in
Figure 5.
The three mechanisms were first screened on the original YOLOv8m and YOLO11m backbones under the unified seed-41 protocol. This screening stage was designed to compare the relative behavior of CBAM, SE, and ECA before the selected mechanisms were transferred to the corresponding lightweight feature pathways. In both baseline architectures, the candidate attention module was inserted after the eighth backbone block. At an input resolution of
, this position corresponds to a
deep semantic feature map, allowing the attention candidates to be compared at the same feature level while leaving the neck and detection heads unchanged.
Figure 6 and
Figure 7 show the insertion points in YOLOv8m and YOLO11m, respectively.
All attention candidates were trained for 100 epochs using an input resolution of , a batch size of 64, and an initial learning rate of 0.01. The learning rate, data partition, training schedule, baseline architecture, and evaluation procedure were held constant within each screening experiment so that the observed differences primarily reflected the selected attention mechanism.
As shown in
Table 4 and
Table 5, under seed 41, SE achieves the highest mAP50 among the YOLOv8m candidates, increasing mAP50 from 0.88009 to 0.89080. ECA achieves the highest mAP50 among the YOLO11m candidates, increasing mAP50 from 0.87235 to 0.88505. These single-seed tables are used for attention-candidate selection rather than for claims of run-to-run robustness. SE and ECA are subsequently integrated into the corresponding YOLO-SMV and YOLO-EMV lightweight pathways, and their interactions with MobileNetV3 and VF-BCE are evaluated in
Section 4.2. In particular, the repeatability of the ECA contribution is assessed through the complete three-seed YOLO11m factorial ablation.
3.4. Class-Sensitive VF-BCE Loss Design and Parameter Selection
The SIXray training set presents two related optimization difficulties: a large number of background candidates relative to prohibited-item targets, and marked differences in recognition difficulty among the five prohibited-item categories. BCE provides stable binary classification supervision, but it does not explicitly reduce the accumulated contribution of easy negative samples. Focal Loss addresses this issue by down-weighting well-classified examples [
41], while Varifocal Loss (VFL) further learns an IoU-aware classification score and applies asymmetric weighting to positive and negative samples [
42]. These properties motivate the use of VFL for quality-aware and hard-sample optimization, with BCE retained as a complementary classification term.
Before determining the fusion coefficient, the category-compensation strategy is fixed so that only the influence of
is varied in the subsequent ablation. Class reweighting is a common approach to mitigating category imbalance [
43]; however, direct inverse-frequency weighting is not adopted here because category frequency alone does not fully describe detection difficulty. On the augmented SIXray data, the YOLO11m BCE baseline obtains Precision values of 0.97431, 0.96014, 0.79116, 0.86040, and 0.77570 for Gun, Knife, Wrench, Pliers, and Scissors, respectively. Gun and Knife therefore retain unit weights; Wrench and Pliers receive moderate compensation because of their lower baseline performance; and Scissors receives the largest weight because it combines the lowest baseline Precision with the smallest augmented instance count among the five categories. The fixed weight vector is
corresponding to Gun, Knife, Wrench, Pliers, and Scissors. These weights remain unchanged in all
experiments.
Following the original VFL formulation, the class-weighted VFL term used in this study is defined as
where
is the predicted classification score and
is the IoU-aware target. For a matched positive sample,
is the IoU between the predicted box and the corresponding ground-truth box; for a negative sample,
. The parameters
and
control negative-sample scaling and focusing strength, respectively. The total VFL term is
where
.
The BCE term is defined as
where
is the binary class label. The proposed composite loss is then written as
A linear mixing coefficient is also used in other compound-loss formulations to balance complementary supervision objectives [
44]. In Equation (
5),
is exactly the BCE endpoint, whereas
is the class-weighted VFL endpoint.
The expected influence of
can be examined from the class-wise loss. For a positive sample (
and
), Equation (
5) becomes
This can be interpreted as a scaled BCE with the effective target
Thus,
at
, while
as
. Increasing
therefore makes the classification score more strongly reflect localization quality. For a negative sample, the corresponding term is
For an easy negative with
, this term approaches
showing that increasing
progressively suppresses easy-background gradients. At the same time, the fixed category weights amplify the VFL term more strongly for Wrench and Pliers (
) and Scissors (
). For these categories, the nominal coefficients
are 1.05/1.40 at
, 1.20/1.60 at
, and 1.35/1.80 at
. Therefore, the principal search interval is set to
: lower values may provide insufficient focusing, whereas values close to 1 may leave limited complementary BCE supervision. The two endpoints are retained to identify the effect of each single loss.
The fusion coefficient was screened under a controlled seed-41 protocol. All candidate values of
were evaluated using the same random seed, data partition, training schedule, and evaluation procedure, so that between-seed variation did not confound the coefficient comparison. This table is therefore treated as a single-seed exploratory coefficient ablation rather than as a multi-seed robustness analysis. After fixing
, the selected VF-BCE configuration was subsequently evaluated using seeds 41, 42, and 43 as part of the complete factorial ablation in
Section 4.2.
Accordingly, the following settings are evaluated on the YOLO11m baseline:
The class weights in Equation (
1) are fixed in every experiment, and the remaining training configuration is kept unchanged to isolate the effect of the fusion coefficient.
As shown in
Table 6 and
Figure 8, the seed-41 mAP50 increases from 0.87235 at the BCE endpoint to 0.91926 at
, and reaches the maximum value of 0.92710 at
. Relative to the BCE and class-weighted VFL endpoints within this controlled single-seed comparison, the selected setting is higher by 5.475 and 3.448 percentage points, respectively. Increasing
to 0.9 or 1 does not produce a further gain under the same seed, indicating that a larger VFL coefficient is not monotonically beneficial under the fixed class-weight scheme.
The category-level Precision values provide complementary evidence for this selection. The weighted categories respond differently to the fusion coefficient: Wrench reaches its highest seed-41 Precision at , whereas Scissors reaches its highest value at . When rises to 0.9 and 1, Pliers continues to improve, but Scissors decreases to 0.75671 and 0.72594, respectively.
Figure 9 compares the classification-loss curves of the BCE, class-weighted VFL, and VF-BCE variants during training. All three settings exhibit stable within-objective convergence. Because BCE, VFL, and VF-BCE use different sample-weighting mechanisms and therefore have different numerical scales, neither their absolute magnitudes nor their apparent decay rates are directly comparable. The curves are consequently used only to examine optimization stability within each loss setting; the selected VF-BCE configuration shows no evident oscillatory behavior during training.