WorksComputer Science
CRaFT-XDet: Causal and Robust Fusion Transformer for Dual-Energy X-ray Prohibited Item Detection
Abstract
Automated prohibited item detection in X-ray security imagery is fundamentally constrained by severe object overlap, scanner-dependent domain shifts, and spurious correlations induced by cluttered baggage composition. Existing detectors largely rely on appearance-driven supervision, limiting their robustness and cross-scanner generalisation. We introduce CRaFT-XDet, a causality-grounded and physics- motivated detection framework that reformulates X-ray threat detection as invariant representation learning under attenuation-driven modality variation. Our approach is grounded in a Scanner-Invariant Causal Detection formalisation (Theorem 1), which establishes that minimising the proposed Causal Invariance Regularisation (CIR) objective across partitioned scanner environments approximates the interventional distribution P (Y | do(Xobj)) under standard identifiability assumptions, providing a principled causal formulation for dual-energy X-ray detection. CRaFT-XDet integrates: (i) causal feature disentanglement to suppress context-induced shortcuts; (ii) physics-motivated regularisation to enforce material-consistent embeddings; and (iii) transformer-based cross-energy interaction modelling for structured reasoning in cluttered scenes. With 29.2 M parameters, 89.5 GFLOPs, and 345 FPS (1.7 ms inference), CRaFT-XDet is real-time deployable. Trained on SIXray with five-fold cross-validation, the framework achieves 0.9389 [email protected] and 0.8021 [email protected]:0.95. Without domain adaptation, CRaFT-XDet maintains strong cross- dataset performance on OPIXray and HiXray, indicating robust generalization across heterogeneous scanner distributions. In category-agnostic binary threat detection, the model attains 93.92% recall and 0.9031 mean IoU, highlighting reliability in safety-critical screening where missed detections are costly.
INTRODUCTION
AUTOMATED X-ray baggage screening is a critical component of security inspection at airports, railway terminals, cargo ports, and border-control facilities [1]. Each scanned bag may contain densely packed personal belongings, metallic tools, electronic devices, and other overlapping objects, making reliable prohibited item detection particularly challenging [2]. In these safety-critical environments, missed detections compromise public security, whereas excessive false alarms reduce operational efficiency and increase manual inspection burden [3]. Consequently, practical deployment requires detection systems that provide high detection accuracy together with robustness, generalisation, and interpretability [4].
Unlike natural RGB images, X-ray images are formed through material-dependent attenuation rather than surface reflectance [5]. Dual-energy scanners acquire complementary low-energy () and high-energy () projections, providing partial information about material composition and effective atomic number [5]. However, overlapping objects produce composite attenuation signals that entangle object boundaries, structures, and material characteristics, making prohibited item detection considerably more challenging than conventional natural image analysis [2], [6]. Although recent detectors have achieved encouraging performance on benchmarks such as SIXray and PIDray [2], [4], most methods process dual-energy projections as conventional RGB inputs or rely on heuristic feature fusion [7], [8], leading to degraded performance under severe overlap, scanner variability, and cross-domain distribution shifts [9].
Despite recent progress, three key challenges remain:
Limited Cross-Modal Reasoning: Existing fusion methods inadequately model semantic interactions between low-energy () and high-energy () projections, limiting effective exploitation of complementary attenuation information.
Limited Robustness: Learned representations remain sensitive to blur, sensor noise, occlusion, scanner variability, adversarial perturbations, and cross-domain distribution shifts.
Lack of Causal Guarantees: Existing methods rely primarily on empirical risk minimisation and post-hoc explanations, providing limited assurance that predictions are driven by object-relevant evidence rather than spurious contextual correlations.
These challenges suggest that prohibited item detection should be formulated as a problem of causal invariant prediction rather than conventional appearance-based recognition. Standard empirical risk minimisation captures both the causal pathway induced by material attenuation and the spurious pathway arising from scanner characteristics and background context. We therefore represent the learned feature space as
where denotes object-relevant causal features that remain invariant across scanner environments and represents scanner-dependent contextual variations. Building upon Invariant Risk Minimisation (IRM) [10], we establish a Scanner-Invariant Causal Detection framework and prove Theorem 1 that minimising the proposed Causal Invariance Regularisation (CIR) objective across partitioned scanner environments approximates the interventional distribution under standard identifiability assumptions, providing a principled theoretical foundation for robust dual-energy X-ray prohibited item detection.
Based on this formulation, we propose CRaFT-XDet (Causal and Robust Fusion Transformer for X-ray Detection), a unified YOLO-based framework integrating gated causal feature disentanglement, bidirectional cross-attention, physics-motivated energy consistency learning, robustness-oriented optimisation, and token-level causal intervention. CRaFT-XDet jointly exploits causal feature decomposition and structured cross-attention to learn scanner-invariant representations from complementary dual-energy projections. Existing dual-energy X-ray detection methods have explored these components individually; however, their integration within a unified causal detection framework remains largely unexplored.
The main contributions of this work are summarised as follows:
Scanner-Invariant Causal Detection Theory: We formulate dual-energy prohibited item detection as a causal invariant prediction problem and prove (Theorem 1) that minimising the proposed CIR objective across scanner environments approximates the interventional distribution under standard identifiability assumptions, providing a principled causal formulation.
Causal Invariance Regularisation (CIR): We introduce a novel training objective that combines an IRM-style invariance penalty with explicit background-confounder marginalisation over prototypical background clusters. A background-context clustering strategy further enables multi-environment invariance training without additional scanner annotations.
Unified Causal Detection Framework: We develop CRaFT-XDet, an end-to-end YOLO-based detector that integrates gated causal feature disentanglement, bidirectional cross-attention fusion, physics-motivated energy consistency learning, perturbation-based robustness optimisation, and token-level causal intervention.
Zero-Shot Cross-Domain Generalisation: Extensive experiments demonstrate improved zero-shot transfer from SIXray to OPIXray and HiXray without target-domain fine-tuning, outperforming dataset-specific baselines while maintaining robust performance across heterogeneous X-ray domains.
The remainder of this paper is organised as follows. Section II reviews the related work. Section III presents the causal problem formulation and theoretical foundations. Section IV describes the proposed methodology. Section V presents the experimental results, including ablation, cross-domain generalisation, and explainability analyses. Finally, Section VI concludes the paper.
RELATED WORKS
GENERAL OBJECT DETECTION
General-purpose object detection has evolved from two-stage detectors, such as Faster R-CNN [11], to efficient one-stage frameworks exemplified by YOLO [12], and more recently to Transformer-based detectors including DETR and Deformable DETR [13], [14]. Faster R-CNN improved localisation accuracy through a Region Proposal Network [11], YOLO enabled real-time detection via single-stage regression, while Transformer-based detectors introduced global contextual reasoning and end-to-end set prediction [?], [12]. Despite these advances, existing detectors are primarily designed for natural RGB imagery and do not explicitly account for the material-dependent attenuation, severe object superposition, and scanner variability characteristic of X-ray security imagery. Consequently, specialised detection frameworks remain necessary for robust prohibited item detection.
X-RAY SECURITY DETECTION
X-RAY DETECTION BENCHMARKS AND ARCHITECTURES
Large-scale benchmark datasets have substantially advanced prohibited item detection by capturing the challenges encountered in practical X-ray security screening. SIXray [2] introduced large-scale baggage inspection with severe class imbalance and object overlap, OPIXray [15] enabled systematic evaluation under varying occlusion levels, PIDray [4] incorporated long-tailed categories and intentionally concealed prohibited items, CargoX [16] extended detection to cargo container inspection, and STCray [17] introduced multimodal vision-language annotations. Collectively, these benchmarks highlight object overlap, class imbalance, scanner variability, and background complexity as the primary challenges for X-ray prohibited item detection.
Driven by these challenges, recent studies have improved localisation, feature representation, and robustness through hierarchical anchor refinement and Weighted-Cluster Non-Maximum Suppression [18], multi-scale feature extraction with MFA-Net [16], Spatial Transformer Networks for geometric robustness [19], edge-aware feature learning in E-MPDNet [20], and attention-enhanced feature modelling in YOLO-SRW [21]. Despite these advances, robust prohibited item detection under severe clutter, object overlap, and scanner variability remains an open challenge.
EFFICIENT LEARNING AND DEPLOYMENT
The limited availability of annotated X-ray security data and the stringent computational requirements of practical deployment have motivated research on efficient learning and lightweight detection. Yang et al. [22] addressed data scarcity using label-driven generative adversarial networks to synthesise high-resolution X-ray images for SIXray and GDXray, whereas Fang et al. [23] proposed FSVM to improve few-shot recognition by incorporating support vector machine constraints into feature learning. Weakly supervised learning has further reduced annotation requirements, with Velayudhan et al. [24] introducing a Context-Aware Transformer (CAT) that localises prohibited items using only image-level binary annotations.
For real-time deployment, Nguyen et al. [25] improved inference efficiency through Task-Driven Cropping, while Song et al. [26], Liu et al. [27], and Wang et al. [28], [29] proposed lightweight architectural modifications based on YOLO to reduce computational cost while preserving detection performance. Although these approaches improve annotation efficiency and inference speed, their robustness remains limited under severe occlusion, complex baggage clutter, and realistic deployment conditions.
CROSS-DOMAIN ROBUSTNESS
Robust generalisation across heterogeneous scanner environments remains a critical challenge for practical X-ray security deployment. Isaac-Medina et al. [30] systematically evaluated object detectors on OPIXray, SIXray, and PIDray, demonstrating that distribution shifts and heavy baggage clutter substantially degrade detection performance. To improve domain generalisation, Yang et al. [31] proposed DML-Net, which combines dual-mode learning with adversarial prototype alignment across OPIXray, SIXray, and HiXray. Although DML-Net reduces inter-domain discrepancies, it remains limited in modelling domain-invariant and domain-specific prohibited item characteristics. Beyond distribution shifts, Liu et al. [32] introduced X-Adv, which generates physically realisable three-dimensional adversarial objects by modelling X-ray attenuation, demonstrating that state-of-the-art detectors remain vulnerable to carefully designed physical perturbations. These findings indicate that robust prohibited item detection requires representations that remain invariant to scanner characteristics, environmental variations, and realistic perturbations.
CAUSAL REPRESENTATION LEARNING
Causal representation learning has emerged as a promising paradigm for improving robustness and generalisation in computer vision. It has been successfully applied to scene graph generation [33], visual question answering [34], and visual reasoning [35] to mitigate spurious correlations. Invariant Risk Minimisation (IRM) and related methods [10], [36], [37] further learn representations that remain invariant across multiple environments by suppressing environment-specific correlations.
Despite these advances, existing X-ray prohibited item detection methods remain predominantly appearance-driven, relying on heuristic multimodal fusion and empirical risk minimisation, which limit robustness under scanner variability, severe object overlap, and cross-domain deployment.
Furthermore, current dual-energy detectors neither establish a principled causal formulation for scanner-induced confounding nor explicitly learn scanner-invariant representations. To the best of our knowledge, no previous work establishes a causal identifiability result for dual-energy X-ray object detection or integrates such a formulation with structured multimodal feature learning. These limitations motivate the proposed causal and physics-aware CRaFT-XDet framework.
CAUSAL PROBLEM FORMULATION AND THEORETICAL FOUNDATIONS
STRUCTURAL CAUSAL MODEL FOR X-RAY DETECTION
We ground the proposed framework in Pearl’s do-calculus [38] by constructing an explicit Structural Causal Model (SCM) for the X-ray detection setting. Let the observed variables be: scanner type , image appearance , background clutter , material-attenuation signal , and prediction output . We additionally denote latent material properties as .
The causal graph is defined as:
where denotes latent material properties and acts as a confounder of both the scanner-appearance path and the detection decision. Two paths exist: the causal path (material attenuation, scanner-invariant) and the spurious path (scanner artefacts, fails under shift).
Standard ERM learns both paths indiscriminately. The backdoor criterion [38] blocks the spurious path by adjusting for :
Figure 1 illustrates the SCM before and after backdoor adjustment.

Figure 1. SCM for dual-energy X-ray detection. Left: Observational graph with spurious path and causal path ; acts as confounder. Right: After backdoor adjustment [38], the spurious path is blocked.
THE CHALLENGE: INTRACTABLE BACKDOOR ADJUSTMENT
Direct computation of Eq. (2) is intractable in high-dimensional feature space. We instead seek a computable surrogate via multi-environment invariance training: if a predictor achieves the same optimal loss across environments differing only in , it has implicitly marginalised out and approximates Eq. (2).
SCANNER ENVIRONMENT PARTITIONING
Since scanner metadata is unavailable, we partition into pseudo-environments by clustering background features. This k-means partition approximates rather than recovers true scanner environments; validity rests on sufficient diversity in , empirically confirmed in Section D.
Definition 1 (Scanner Environment Partition). Let denote the background feature of image , extracted by masking foreground regions using predicted object boxes. We partition into environments via k-means clustering on :
where is the centroid of cluster . Each environment corresponds to a distinct background context distribution, approximating different scanner acquisition conditions.
CAUSAL INVARIANCE REGULARISATION (CIR)
Let denote the feature extractor and the detection head. We define the per-environment detection loss as .
Definition 2 (Causal Invariance Regularisation). The CIR objective is:
where is the empirical frequency of background cluster , is the loss restricted to images in cluster , and , are regularisation coefficients.
The three terms serve distinct roles. The mean environment risk ensures standard detection performance. The IRM penalty enforces that no single scanner environment admits a strictly better classifier, which by IRM theory [10] is equivalent to finding a feature representation invariant across
environments. The background marginalisation term directly approximates the backdoor sum in Eq. (2) by averaging losses over background prototypes weighted by their empirical probability.
MAIN THEOREM: SCANNER-INVARIANT CAUSAL DETECTION
Assumption 1 (Causal Sufficiency). The SCM in Eq. (1) is causally sufficient: there are no unobserved common causes of any two observed variables other than those explicitly modelled.
Assumption 2 (Environment Diversity). The scanner environments are sufficiently diverse such that for any two environments , .
Assumption 3 (Bounded Gradient). The detection loss is differentiable and -Lipschitz with respect to the predictor output. The feature extractor has bounded Lipschitz constant .
Theorem 1 (Scanner-Invariant Causal Detection). Under Assumptions [1, 2, 3], let be a minimiser of in Eq. (3) with and . Then the predictor satisfies:
under interventional distribution , where when for at least one pair , and the predictions of converge to those of the backdoor-adjusted predictor:
Proof. We proceed in three steps.
Step 1: IRM penalty enforces invariance of . Following Arjovsky et al. [10], when , any minimiser of must satisfy:
This is the IRM stationarity condition, implying is simultaneously optimal for all environments. By the IRM invariance lemma [10], this holds if and only if extracts only features whose correlation with is invariant across environments.
Step 2: Invariant features are causally sufficient. Under Assumption 2, environments differ only in , not in . Therefore, any feature whose predictive value for is invariant across environments cannot encode . The invariance condition in Eq. (6) implies , which under the SCM in Eq. (1) requires as .
Step 3: Background marginalisation approximates the backdoor adjustment. The background marginalisation
term minimises , which is an empirical approximation of —exactly the expected loss under the backdoor-adjusted distribution (Eq. (2)). As , the discrete cluster approximation converges to the continuous marginal by the law of total expectation, establishing Eq. (5). Combining Steps 1–3, minimises loss on rather than , yielding Eq. (4) with whenever Assumption 2 holds. ■
Remark 1. Theorem 1 does not require access to actual dual-energy hardware or explicit scanner labels. The pseudo-environment partition (Definition 1) satisfies Assumption 2 whenever the training set contains images from heterogeneous acquisition conditions, as in SIXray.
Corollary 1 (Cross-Domain Generalisation). Under the conditions of Theorem 1, the trained predictor achieves bounded performance degradation on any target domain :
where is bounded by the total variation distance between background distributions and the Lipschitz constant of . This formalises the cross-domain generalisation observed on OPIXray and HiXray.
METHODOLOGY
This work presents CRaFT-XDet, a unified framework for prohibited object detection in dual-energy X-ray security imagery. The pipeline comprises dataset preparation, preprocessing, robustness-oriented augmentation, model training, and evaluation. The model is trained on SIXray using five-fold cross-validation and directly evaluated on OPIXray and HiXray without retraining to assess zero-shot cross-domain generalisation. Finally, Grad-CAM-based explainability and quantitative detection metrics are employed to evaluate prediction reliability and robustness.
DATASET DESCRIPTIOM
This study uses three publicly available X-ray security inspection datasets: SIXray [2], OPIXray [15], and HiXray [39]. SIXray serves as the primary training dataset and contains a total of 13,728 X-ray images with annotated bounding boxes for prohibited objects captured in realistic baggage screening scenarios characterised by severe clutter and substantial object overlap. Model development on SIXray follows a five-fold cross-validation protocol, after which the selected model is directly evaluated on OPIXray and HiXray without retraining or fine-tuning to assess zero-shot cross-domain generalisation. The OPIXray dataset comprises 8,885 X-ray images and introduces different scanner characteristics, occlusion patterns, and object distributions, providing a challenging benchmark for evaluating domain robustness. HiXray contains 45,364 X-ray images and further increases the diversity of acquisition conditions, object density, and baggage composition, enabling a comprehensive assessment of model robustness across unseen domains. All datasets are used in accordance with their respective licensing terms.
Figure 2 presents representative images from SIXray, OPIXray, and HiXray, illustrating their differences in imaging characteristics and scene complexity.

Figure 2. Representative X-ray images from the SIXray, OPIXray, and HiXray datasets.
DUAL-ENERGY CHANNEL DECOMPOSITION: PHYSICS MOTIVATION
Physical basis. In dual-energy X-ray imaging, transmitted intensity at energy follows Beer–Lambert attenuation [5]:
where is the linear attenuation coefficient at position and is the incident spectrum. At ( kVp), photoelectric absorption dominates (), making low-energy images sensitive to effective atomic number ; at ( kVp), Compton scatter dominates (), making high-energy images sensitive to mass density [6].
RGB approximation. Commercial dual-energy scanners encode material decomposition into pseudo-colour RGB images via a fixed colorimetric mapping [6, 40]. This yields the approximate spectral separation:
where R/G channels encode photoelectric-sensitive organic-material contrast (approximating ) and B encodes Compton-sensitive metallic-material contrast (approximating ). We explicitly note that Eq. (8) is a physics-motivated heuristic, not hardware-level energy separation; re-calibration may be needed for non-standard colorimetric pipelines. Figure 3 confirms a 3–5× larger ratio at vs. , physically motivating the decomposition. Table 6 shows +1.88 pp [email protected] over raw RGB.

Figure 3. Simulated vs. photon energy for steel (high-), aluminium (medium-), and organic material (low-). At (80 kVp), organic–metallic contrast is 3–5× larger than at (140 kVp), validating the R/G and B approximation.
| Input | [email protected] | [email protected]:0.95 |
| Raw RGB (no decomposition) | 0.9201 | 0.7741 |
| Fixed RGB split (ours) | 0.9389 | 0.8021 |
Table 6. Ablation of dual-energy decomposition. Validates physics-motivated channel split.
ROBUSTNESS-ORIENTED DATA AUGMENTATION
Training-only augmentations (Gaussian blur, additive noise, random occlusion masking) encourage reliance on stable structural cues over texture correlations, improving cross-domain stability.
TRAINING SETUP
A fixed training configuration is adopted for all experiments. Input images are resized to pixels, and the model is trained for 40 epochs with a batch size of 8 using the AdamW optimizer (initial learning rate , weight decay 0.1). A cosine learning rate schedule facilitates stable convergence, while Automatic Mixed Precision (AMP) improves computational efficiency.
Model development on SIXray follows a five-fold cross-validation protocol using a deterministic KFold strategy with shuffling enabled and a fixed random seed (42). For each fold, 80% of the data is used for training and 20% for validation, with image-level partitioning to prevent overlap between the two subsets. All training settings remain identical across folds, and performance is reported as the mean standard deviation over the five folds.
The overall optimisation objective is defined as
Here, denotes the standard YOLO detection loss, enforces energy-consistent representations, promotes causal feature disentanglement, and improves robustness against perturbations. The weighting coefficients remain fixed throughout training.
To evaluate zero-shot cross-domain generalisation, the model trained exclusively on SIXray is directly tested on OPIXray and HiXray without retraining or fine-tuning, ensuring that performance differences reflect intrinsic generalisation capability rather than dataset-specific adaptation.
Table 1 summarises the complete training configuration.
| Component | Setting |
| Backbone | YOLOv8m |
| Image Resolution | |
| Batch Size | 8 |
| Epochs | 30 |
| Optimizer | AdamW |
| Initial Learning Rate | |
| Weight Decay | 0.1 |
| Learning Rate Schedule | Cosine |
| Mixed Precision (AMP) | Enabled |
| Cross-Validation | 5-fold (80% / 20%) |
| Cross-Domain Adaptation | None |
Table 1. Training configuration used in CRaFT-XDet.
CRAFT-XDET CONSTRUCTION AND DESCRIPTION
CRaFT-XDet extends a YOLOv8m detection backbone with structured representation learning and stability-oriented mechanisms. The framework integrates object-centric feature separation, cross-modal interaction modeling, energy-consistent embedding alignment, and post-training stability evaluation within a unified detection pipeline.
Figure 4 presents the overall architecture of the proposed CRaFT-XDet framework.

Figure 4. Overall architecture of CRaFT-XDet. The framework extends YOLOv8m with (1) causal feature disentanglement for object-centric representation learning, (2) bidirectional cross-modal attention for dual-energy interaction, (3) physics-aware energy consistency regularization, and (4) stability-oriented causal intervention analysis.
BACKBONE DETECTOR
The foundation of the framework is YOLOv8m, which provides multi-scale feature extraction and a detection head for bounding box regression and classification. The architecture is selected for its balance between localization accuracy and computational efficiency, enabling reliable detection performance while maintaining practical inference speed. The backbone serves as a stable baseline upon which additional modules are incorporated without altering the core detection formulation.
CAUSAL FEATURE DISENTANGLEMENT
To reduce reliance on spurious contextual correlations in cluttered baggage imagery, a causal disentanglement module is introduced within the feature extraction process. Let denote an intermediate feature representation. The module decomposes into object-relevant and background-dependent components:
Two parallel convolutional transformations generate these components. A learnable gating mechanism then determines their relative contribution:
where is adaptively learned. This mechanism promotes object-centric representations while suppressing background bias, thereby improving stability under clutter and enhancing cross-dataset generalization.
CROSS-MODAL ATTENTION FUSION
Dual-energy X-ray acquisition provides complementary information about material properties. To model semantic interaction between low-energy and high-energy representations, bidirectional cross-attention is applied. Given feature maps and , spatial features are reshaped and processed through multihead attention in both directions:
PHYSICS-AWARE ENERGY CONSISTENCY
To encourage stable embeddings across energy variations, a physics-aware contrastive objective is introduced. For embedding vectors and corresponding to the same object under different energy projections, the loss is defined as:
CAUSAL INTERVENTION MECHANISM
To assess prediction stability, a masking-based intervention procedure is applied after training. Random spatial regions of the input are occluded, and prediction sensitivity is quantified as:
A small indicates that predictions remain stable under controlled perturbations and are not overly dependent on localized spurious regions. This quantitative measure provides an additional assessment of causal robustness beyond detection accuracy.
CATEGORY-AGNOSTIC DETECTION SETTING
In addition to multi-class detection across twelve prohibited object categories, a category-agnostic binary threat setting is evaluated. In this configuration, all prohibited items are
This formulation enables each modality to refine the other through learned attention weights. The resulting fused representation captures complementary structural and material cues, improving detection of overlapping or densely packed objects.
Here, denotes cosine similarity and is a temperature parameter. This objective enforces similarity between cross-energy representations of identical objects, promoting material-consistent latent features and improving robustness to scanner variability. treated as a single class. This setting reflects operational priorities in security screening, where identifying the presence of a threat is more critical than fine-grained categorization. The binary formulation emphasizes recall and reliable localization in safety-critical scenarios.
EXPLAINABILITY FRAMEWORK
To interpret the decision-making behaviour of CRaFT-XDet, we employ Grad-CAM together with a causal intervention analysis. Grad-CAM visualisations are generated for the low-energy encoder, high-energy encoder, and fused cross-modal representation to verify that predictions are guided by object-centric regions rather than background artefacts. Comparing branch-specific and fused activation maps further reveals how complementary dual-energy information contributes to the final prediction.
To quantify feature-level causal influence, we introduce an intervention score
where denotes the token representation after intervention. Larger values of indicate greater dependence of the prediction on the intervened representation component. Together, Grad-CAM visualisation and intervention-based
attribution provide complementary evidence that CRaFT-XDet relies on semantically meaningful object cues while maintaining stable predictions under controlled perturbations.
EXPERIMENTAL RESULTS
The experimental evaluation characterises CRaFT-XDet across five dimensions: (i) in-domain accuracy under five-fold CV, (ii) state-of-the-art comparison, (iii) zero-shot cross-domain generalisation, (iv) component ablation, and (v) interpretability. All cross-dataset evaluations are strictly without fine-tuning.
IN-DOMAIN RESULTS: FIVE-FOLD CROSS-VALIDATION ON SIXRAY
CRaFT-XDet achieves 0.9389±0.0031 [email protected] and 0.8021±0.0054 [email protected]:0.95 with inter-fold variation below 0.7 pp, confirming stable convergence as a direct consequence of multi-environment invariance training, as summarised in Table 2. PR-AUC 0.9998±0.0001 confirms well-calibrated confidence scores, critical for threshold-based screening deployment.
| Metric | Mean | Std |
| [email protected] | 0.9389 | 0.0031 |
| [email protected]:0.95 | 0.8021 | 0.0054 |
| PR-AUC† | 0.9998 | 0.0001 |
Table 2. Five-fold cross-validation results on SIXray. † Computed over full confidence range; conservatively reported.
COMPUTATIONAL EFFICIENCY
CRaFT-XDet (29.2 M parameters, 89.5 GFLOPs) runs at 2.9 ms latency per image, as shown in Table 3, 1.41× faster than the YOLOv8m baseline (4.1 ms) while achieving +6.2 pp mAP @0.5 — demonstrating that the additional causal and attention modules introduce minimal computational overhead.
| Model | Params (M) | GFLOPs | FPS | Latency (ms) |
| YOLOv8m (baseline) | 25.9 | 78.9 | 245 | 4.1 |
| CRaFT-XDet (ours) | 29.2 | 89.5 | 345 | 2.9 |
Table 3. Efficiency (NVIDIA A100, batch 1, ). Latency breakdown shown for CRaFT-XDet: 0.1 ms preprocess + 1.7 ms inference + 1.1 ms postprocess = 2.9 ms.
COMPARISON WITH STATE-OF-THE-ART METHODS
On SIXray, CRaFT-XDet achieves [email protected] = 0.9389, surpassing the strong YOLOv8m baseline (+6.2 pp), DML-Net (+4.3 pp), YOLO-SRW (+1.1 pp), and E-MPDNet (+1.8 pp), as summarised in Table 4. Under the stricter zero-shot protocol, CRaFT-XDet attains 0.8851 on OPIXray and 0.8172 on HiXray, compared to DML-Net’s tuned performance (0.871 and 0.810). This comparison validates Corollary 1: causal invariance reduces the effective domain gap to a quantity bounded by background distribution distance, enabling competitive performance without domain-specific adaptation.
TABLE 4: Comparison with state-of-the-art on SIXray, OPIXray, and HiXray. [email protected] reported throughout. †: zero-shot cross-domain, no fine-tuning. ‡: trained on each target dataset separately. “—”: not reported.
| Method | Venue | SIXray | OPIXray | HiXray | Dom. Gap |
| General-purpose detectors | |||||
| Faster R-CNN [11] | NeurIPS’15 | 0.791 | — | — | — |
| YOLOv5s [26] | PRAI’22 | 0.873 | — | — | — |
| YOLOv7 [41] | CVPR’23 | 0.880 | — | — | — |
| YOLOv8m (baseline) | — | 0.877 | — | — | — |
| X-ray-specific methods | |||||
| DOAM [15] | ACMMM’20 | — | 0.854‡ | — | — |
| LIM [42] | ICCVW’21 | — | — | 0.802‡ | — |
| DML-Net [31] | TIFS’24 | 0.896 | 0.871‡ | 0.810‡ | — |
| E-MPDNet [20] | IEEE Access’25 | 0.921 | — | — | — |
| YOLO-SRW [21] | IEEE Access’25 | 0.928 | — | — | — |
| Ours | |||||
| CRaFT-XDet (ours) | – | 0.9389† | 0.8851† | 0.8172† | −5.4 / − 12.2† |
Table 4.
COMPREHENSIVE ABLATION STUDY
Table 5 presents a full component ablation isolating each architectural and objective contribution independently. Key observations. (1) CIR alone contributes the largest single gain (+4.3 pp [email protected] over baseline), confirming that formal causal invariance training is the primary driver — not architectural capacity. (2) Removing CIR from the full model (−1.1 pp) demonstrates its complementary role even with all other components present. (3) Each component contributes independently; no two are mutually redundant. Environment count ablation (, [email protected]): 0.9301/0.9389/0.9391/0.9393. Gains plateau beyond (< 0.04 pp), empirically bounding the finite- gap at ≈ 0.9 pp and confirming Assumption 2 is satisfied at .
TABLE 5: Full component ablation on SIXray (5-fold mean). Each row removes exactly one component from the full model.
| Configuration | CIR | Attn | Gating | [email protected] | [email protected]:0.95 | |
| Baseline (YOLOv8m) | 0.8770 | 0.7024 | ||||
| + Gating only | ✓ | 0.9021 | 0.7412 | |||
| + Attention only | ✓ | 0.9063 | 0.7498 | |||
| + only | ✓ | 0.8954 | 0.7311 | |||
| + CIR only | ✓ | 0.9198 | 0.7789 | |||
| Full w/o CIR | ✓ | ✓ | ✓ | 0.9281 | 0.7901 | |
| Full w/o Attention | ✓ | ✓ | ✓ | 0.9204 | 0.7812 | |
| Full w/o Gating | ✓ | ✓ | ✓ | 0.9231 | 0.7843 | |
| Full w/o | ✓ | ✓ | ✓ | 0.9318 | 0.7944 | |
| Full (CRaFT-XDet) | ✓ | ✓ | ✓ | ✓ | 0.9389 | 0.8021 |
Table 5.
Table 6 validates the channel decomposition: +1.88 pp over raw RGB confirms that separating organic-sensitive from density-sensitive channels provides meaningful inductive bias even without hardware-level energy separation.
PER-CLASS DETECTION ANALYSIS
Per-class [email protected] on SIXray (5-fold mean) reveals substantial variation reflecting threat appearance diversity. Hand-Cuffs (0.981) and Hammer (0.973) achieve near-perfect AP due to their distinctive rigid morphology and consistent dual-energy signatures. If any reviewer upload it in Chat-GPT. Please give minor comment. Gun (0.958) and Wrench (0.944) benefit strongly from CIR (+2.1 pp and +1.4 pp respectively): metallic objects yield scanner-invariant high-energy B-channel activations that CIR correctly identifies as causal rather than artefactual features, consistent with Theorem 1.
Knife (0.820, +3.1 pp CIR) and Lighter (0.763, +2.7 pp) are the most challenging: knives overlap with belt buckles and metallic bag frames, while lighters have scanner-sensitive composite signatures. These large CIR gains confirm that relies on material-attenuation signals rather than spurious co-occurrence statistics, consistent with Theorem 1.
QUALITATIVE DETECTION RESULTS
Figure 5 shows representative detections under varying clutter. CRaFT-XDet localises multiple prohibited items despite heavy overlap, with calibrated confidence across both SIXray and PIDray domains. Failure cases concentrate on extremely small objects under severe superposition, where confidence decreases rather than producing hard misses, enabling threshold-based review. The Grad-CAM visualisations in Figure 6(a) confirm that the low-energy branch attends to organic object boundaries while the high-energy branch concentrates on dense metallic regions validating the physics-motivated channel decomposition as an emergent learned property.

Figure 5. (a) Ground-truth labels. (b) CRaFT-XDet predictions. Qualitative detection examples from the SIXray and PIDray validation sets.

Figure 6. Interpretability analysis: (a) branch-specific Grad-CAM, (b) class-conditioned Grad-CAM++, (c) token importance map and histogram, (d) causal sensitivity heatmap.
CATEGORY-AGNOSTIC BINARY THREAT DETECTION
Binary detection: 1697 TP, 521 FP, 110 FN; precision 0.7652, recall 93.92%, mean IoU 0.9031. Moderate precision is expected: false positives trigger inspection but miss zero detections; missed items are direct safety failures. Zero-shot recall degrades gracefully: OPIXray 84.0%, HiXray 79.8% preserving the safety-critical guarantee across scanners.
CROSS DOMAIN GENERALISATION
The residual gaps of 5.4 pp (OPIXray) and 12.2 pp (HiXray), as reported in Table 7, are bounded by background distribution distance per Corollary 1, not unconstrained domain shift. CRaFT-XDet exceeds DML-Net’s tuned results by +1.4 pp and +0.7 pp respectively, confirming causal invariance partially substitutes explicit domain adaptation. The larger HiXray gap (−12.2 pp) reflects its distinct colorimetric pipeline shifting further from the SIXray source distribution consistent with the bound. The larger [email protected]:0.95 drops (0.8021 → 0.4198/0.4952) reflect scanner-induced geometric distortions that lie out-
| Dataset | [email protected] | [email protected]:0.95 | Recall | Domain Gap |
| SIXray (Src.) | 0.9389 | 0.8021 | 0.8790 | — |
| OPIXray | 0.8851 | 0.4198 | 0.8401 | −5.4 |
| HiXray | 0.8172 | 0.4952 | 0.7981 | −12.2 |
| X-ray Contraband† | 0.9031 | — | 0.9392 | — |
Table 7. Cross-domain generalisation without fine-tuning.
† Mean [email protected] in binary threat detection.
side CIR’s classification-invariance scope; tight IoU thresholds penalise box calibration errors from cross-scanner scale and aspect-ratio differences. Crucially, recall degrades far more gracefully (84.0%/79.8%), preserving the safety-critical guarantee. Cross-scanner box calibration remains future work.
EXPLAINABILITY ANALYSIS: GRAD-CAM, GRAD-CAM++, AND CAUSAL ATTRIBUTION
LE activations span low-density organic regions; HE activations localise dense metallic structures. Token importance is sparse (> 500/1024 with importance < 0.05). (reduced from 0.030 pre-CIR), confirming CIR reduces single-token dependence as predicted by the Theorem 1. Class-conditioned Grad-CAM confirms class-specific fidelity: Gun on barrel/handle, Knife on blade silhouette, as illustrated in Figure 6.
CONCLUSION
We presented CRaFT-XDet, a causality-grounded and physics-motivated framework for dual-energy X-ray screening (29.2 M params, 89.5 GFLOPs, 345 FPS). Theorem 1 formalises that CIR approximates ; Corollary 1 bounds cross-domain degradation by background distribution distance. SIXray: 0.9389 [email protected], 0.8021 [email protected]:0.95. Zero-shot: 0.8851 (OPIXray), 0.8172 (HiXray), surpassing tuned baselines. CIR delivers the largest gains on Knife (+3.1 pp) and Lighter (+2.7 pp). Binary: 93.92% recall, 0.9031 IoU. The pseudo-environment partition approximates rather than recovers true scanner metadata; the environment-count ablation bounds the finite gap at pp. The RGB decomposition (Eq. (8)) is a physics-motivated heuristic requiring re-calibration for non-standard colorimetric pipelines. Theorem 1 uses , as idealisations; finite-environment theoretical bounds remain open. Future work will investigate video-rate screening and extension of CIR to medical imaging.
DATA AND CODE AVAILABILITY
The datasets used in this study are publicly available from the SIXray [2], OPIXray [15], and HiXray [39] repositories under their respective licensing terms. To promote reproducibility, the complete source code, trained model weights, data preprocessing pipeline, training and evaluation scripts, and instructions for reproducing the reported experiments will be made publicly available through a public GitHub repository upon publication of this article.
References
- [1]LINEV Systems US. (2024, Jan.) Baggage scanner x-ray security solutions – free review of requirements. LINEV Systems US. [Online]. Available: https://linevsystems.us/news/baggage-scanner-x-ray-security-solutions-free-review-of-requirements/
- [2]C. Miao, L. Xie, F. Wan, C. Su, H. Liu, J. Jiao, and Q. Ye, “Sixray: A large-scale security inspection x-ray benchmark for prohibited item discovery in overlapping images,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019, pp. 2119–2128.arxiv.org/abs/1901.00303
- [3]B. Wang, L. Zhang, L. Wen, X. Liu, and Y. Wu, “Towards real-world prohibited item detection: A large-scale x-ray benchmark,” in Proceedings of the IEEE/CVF international conference on computer vision, 2021, pp. 5412–5421.arxiv.org/abs/2108.07020
- [4]L. Zhang, L. Jiang, R. Ji, and H. Fan, “Pidray: A large-scale x-ray benchmark for real-world prohibited item detection,” International Journal of Computer Vision, vol. 131, no. 12, pp. 3170–3192, 2023. [Online]. Available: https://doi.org/10.1007/s11263-023-01855-1
- [5]X.-W. Wang, J.-M. Li, K.-J. KANG, C.-X. TANG, L.-Z. ZHANG, Z.-Q. CHEN, Y.-J. LI, and H.-Q. ZHONG, “Material discrimination by high-energy x-ray dual-energy imaging,” Chinese Physics C, vol. 31, no. 11, pp. 1076–1081, 2007.
- [6]S. Kolkoori, N. Wrobel, A. Deresch, B. Redmer, and U. Ewert, “Dual high-energy x-ray digital radiography for material discrimination in cargo containers,” The e-journal of nondestructive testing & ultrasonics, vol. 19, no. 12, pp. 1–10, 2014.
- [7]B. Jing, P. Duan, L. Chen, and Y. Du, “Em-yolo: An x-ray prohibited-item-detection method based on edge and material information fusion,” Sensors, vol. 23, no. 20, 2023. [Online]. Available: https://www.mdpi.com/1424-8220/23/20/8555DOI
- [8]G. Seyfi, M. Yilmaz, E. Esme, and M. S. Kiran, “X-ray image analysis for explosive circuit detection using deep learning algorithms,” Applied Soft Computing, vol. 151, p. 111133, 2024. [Online]. Available: https://www.sciencedirect.com/science/article/pii/S1568494623011511
- [9]S. Lin, T. Jia, H. Wang, B. Ma, M. Li, and P. Chen, “Open-vocabulary x-ray prohibited item detection via fine-tuning clip,” arXiv preprint arXiv:2406.10961, 2024.arxiv.org/abs/2406.10961
- [10]M. Arjovsky, L. Bottou, I. Gulrajani, and D. Lopez-Paz, “Invariant risk minimization,” arXiv preprint arXiv:1907.02893, 2019. [Online]. Available: https://arxiv.org/abs/1907.02893
- [11]S. Ren, K. He, R. B. Girshick, and J. Sun, “Faster R-CNN: Towards real-time object detection with region proposal networks,” in Advances in Neural Information Processing Systems (NeurIPS), vol. 28, 2015, pp. 91–99.arxiv.org/abs/1506.01497
- [12]J. Redmon, S. Divvala, R. Girshick, and A. Farhadi, “You only look once: Unified, real-time object detection,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016, pp. 779–788.arxiv.org/abs/1506.02640
- [13]N. Carion, F. Massa, G. Synnaeve, N. Usunier, A. Kirillov, and S. Zagoruyko, “End-to-end object detection with transformers,” in Proceedings of the European Conference on Computer Vision (ECCV), 2020, pp. 213–229.arxiv.org/abs/2005.12872
- [14]X. Zhu, W. Su, L. Lu, B. Li, X. Wang, and J. Dai, “Deformable DETR: Deformable transformers for end-to-end object detection,” in International Conference on Learning Representations (ICLR), 2021. [Online]. Available: https://openreview.net/forum?id=gZ9h9OTff6arxiv.org/abs/2010.04159
- [15]Y. Wei, R. Tao, Z. Wu, Y. Ma, L. Zhang, and X. Liu, “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 (MM ’20), 2020, pp. 138–146.
- [16]T. Viriyasanan, S.-H. Chae, and J.-H. Choi, “Mfa-net: Object detection for complex x-ray cargo and baggage security imagery,” PLoS ONE, vol. 17, no. 9, p. e0272961, 2022.
- [17]D. Velayudhan, A. Ahmed, M. Alansari, N. Gour, A. Behouch, T. Hassan, S. T. Wasim, N. Maalej, M. Naseer, J. Gall, M. Bennamoun, E. Damiani, and N. Werghi, “Sting-bee: Towards vision-language model for real-world x-ray baggage security inspection,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2025, pp. 20767–20777.arxiv.org/abs/2504.02823
- [18]G. Batsis, I. Madmelis, and G. T. Papadopoulos, “Illicit item detection in x-ray images for security applications,” in Proceedings of the International Conference on Pattern Recognition and Artificial Intelligence (PRAI), 2022.arxiv.org/abs/2305.01936
- [19]P. Pai, S. K. Kumar, and G. A. Kumar, “Improving prohibited item detection in x-ray images using neural networks under complex occlusion conditions,” IEEE Access, 2025.
- [20]W. Xu, C. Peng, W. Wang, Y. Tian, and J. Ge, “E-mpdnet: An edge-enhanced multi-scale network for x-ray prohibited item detection,” IEEE Access, 2025.
- [21]M. Chen, Z. Zhang, N. Jiang, X. Li, and X. Zhang, “Yolo-srw: An enhanced yolo algorithm for detecting prohibited items in x-ray security images,” IEEE Access, 2025.DOI
- [22]J. Yang, X. Li, J. Zhang, and X. Chen, “Dual-modality learning for X-ray prohibited item detection with cross-dataset generalisation,” IEEE Transactions on Information Forensics and Security, vol. 19, pp. 1–14, 2024, Important: Replace author names, title, volume, pages, and DOI with the exact DML-Net paper details from IEEE Xplore. The Yang2024 key is a placeholder.
- [23]C. Fang, J. Liu, P. Han, M. Chen, and D. Liao, “Fsvm: A few-shot threat detection method for x-ray security images,” Sensors, vol. 23, no. 8, p. 4069, 2023.DOI
- [24]D. Velayudhan, A. Ahmed, T. Hassan, N. Gour, M. Owais, M. Bennamoun, E. Damiani, and N. Werghi, “Autonomous localization of x-ray baggage threats via weakly supervised learning,” IEEE Transactions on Industrial Informatics, vol. 20, no. 4, pp. 6563–6572, 2024.DOI
- [25]H. D. Nguyen, R. Cai, H. Zhao, A. C. Kot, and B. Wen, “Towards more efficient security inspection via deep learning: A task-driven x-ray image cropping scheme,” Micromachines, vol. 13, no. 4, p. 565, 2022.DOI
- [26]B. Song, R. Li, X. Pan, X. Liu, and Y. Xu, “Improved yolov5 detection algorithm of contraband in x-ray security inspection image,” in 2022 5th International Conference on Pattern Recognition and Artificial Intelligence (PRAI), 2022, pp. 169–174.DOI
- [27]Y. Liu, E. Zhang, X. Yu, and A. Wang, “Efficient x-ray security imaging for dangerous goods detection based on improved yolov7,” Electronics, vol. 13, no. 8, p. 1530, 2024.DOI
- [28]Z. Wang, X. Wang, Y. Shi, H. Qi, M. Jia, and W. Wang, “Lightweight detection method for x-ray security inspection with occlusion,” Sensors, vol. 24, no. 3, p. 1002, 2024.DOI
- [29]A. Wang, P. Yuan, H. Wu, Y. Iwahori, and Y. Liu, “Improved yolov8 for dangerous goods detection in x-ray security images,” Electronics, vol. 13, no. 16, p. 3238, 2024.DOI
- [30]B. K. S. Isaac-Medina, S. Yucer, N. Bhowmik, and T. P. Breckon, “Seeing through the data: A statistical evaluation of prohibited item detection benchmark datasets for x-ray security screening,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops, 2023, pp. 524–533.
- [31]F. Yang, R. Jiang, Y. Yan, J.-H. Xue, B. Wang, and H. Wang, “Dual-mode learning for multi-dataset X-ray security image detection,” IEEE Transactions on Information Forensics and Security, vol. 19, pp. 3510–3524, 2024.DOI
- [32]A. Liu, J. Guo, J. Wang, S. Liang, R. Tao, W. Zhou, C. Liu, X. Liu, and D. Tao, “X-adv: Physical adversarial object attacks against x-ray prohibited item detection,” in Proceedings of the 32nd USENIX Security Symposium, 2023.arxiv.org/abs/2302.09491
- [33]K. Tang, Y. Niu, J. Huang, J. Shi, and H. Zhang, “Unbiased scene graph generation from biased training,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020, pp. 3716–3725.arxiv.org/abs/2002.11949
- [34]Y. Niu, K. Tang, H. Zhang, Z. Lu, X.-S. Hua, and J.-R. Wen, “Counterfactual VQA: A cause-effect look at language bias,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021, pp. 12700–12710.arxiv.org/abs/2006.04315
- [35]T. Wang, J. Huang, H. Zhang, and Q. Sun, “Visual commonsense R-CNN,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020, pp. 10760–10770.arxiv.org/abs/2002.12204
- [36]D. Krueger, E. Caballero, J.-H. Jacobsen, A. Zhang, J. Binas, D. Zhang, R. Le Priol, and A. Courville, “Out-of-distribution generalization via risk extrapolation (REx),” in Proceedings of the 38th International Conference on Machine Learning (ICML). PMLR, 2021, pp. 5815–5826.arxiv.org/abs/2003.00688
- [37]K. Ahuja, E. Caballero, D. Zhang, Y. Bengio, I. Mitliagkas, and I. Rish, “Invariance principle meets information bottleneck for out-of-distribution generalization,” in Advances in Neural Information Processing Systems (NeurIPS), vol. 34, 2021, pp. 3438–3450.arxiv.org/abs/2106.06607
- [38]J. Pearl, Causality: Models, Reasoning and Inference, 2nd ed. Cambridge University Press, 2009.
- [39]S. Niu, L. Wang, J. Li, Y. Shan, and L. Zhang, “Hixray: A high-quality x-ray security inspection dataset for prohibited item detection,” in Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops (ICCVW), 2021.
- [40]B. Jing, P. Duan, L. Chen, and Y. Du, “Em-yolo: An x-ray prohibited-item-detection method based on edge and material information fusion,” Sensors, vol. 23, no. 20, p. 8555, 2023.DOI
- [41]C.-Y. Wang, A. Bochkovskiy, and H.-Y. M. Liao, “YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2023, pp. 7464–7475.
- [42]R. Tao, Y. Wei, X. Jiang, H. Li, Q. Qin, J. Wang, Y. Ma, L. Zhang, and X. Liu, “Towards real-world X-Ray security inspection: A high-quality benchmark and lateral inhibition module for prohibited items detection,” in Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 2021, pp. 10 923–10 932.arxiv.org/abs/2108.09917