Introduction
Automating security inspections at transit hubs like airports and train stations remains a significant challenge for computer vision. Unlike natural images, X-ray scans present two primary hurdles: the appearance gap and severe overlapping. X-ray images are generated based on material density and radiation absorption, resulting in a visual style that differs fundamentally from the datasets used to train most foundation models. Furthermore, in a packed suitcase, items are not merely adjacent; they overlap and blend in a 2D projection, making it difficult for traditional instance segmentation models like Mask R-CNN to distinguish boundaries.
To address these challenges, this research introduces a novel instance segmentation pipeline that leverages the Segment Anything Model (SAM) combined with a specialized bilayer mask decoder. This approach explicitly models the relationship between occluding objects and the target items to improve segmentation accuracy in complex, cluttered environments.
Methodology
The proposed architecture bridges the gap between general-purpose foundation models and specialized security imaging through three key components:
1. SAM as a Foundation
The system utilizes a frozen SAM Image Encoder as its backbone. By leveraging the rich, zero-shot priors learned from millions of natural images, the model gains a robust starting point for feature extraction, which is then adapted for the specific visual characteristics of X-ray imagery.
2. The Bilayer Mask Decoder
The core innovation of this work is the bilayer approach to mask prediction. Rather than attempting to regress a single mask for an object in one pass, the model employs two sequential decoders:
- The Occluder Decoder: This stage estimates the "occlusion area"—the specific region where the target object is obscured by another item.
- The Occludee Decoder: Utilizing residual guidance, this stage incorporates information from the occluder decoder to refine the final binary mask of the target item. By explicitly identifying what is blocking the view, the model develops a more sophisticated spatial understanding of the target's true boundaries.
3. Prompt Engineering
To guide the SAM-based decoders, the system converts features from a standard Mask R-CNN (specifically from the Region Proposal Network and ROI Align) into sparse prompt embeddings. This allows the model to benefit from established detection frameworks while utilizing the high-fidelity segmentation capabilities of the bilayer decoder.
Datasets and Evaluation
The researchers enhanced two major X-ray benchmarks to facilitate this study: PIDray-A and PIXray-A. The "A" (Annotated) designation refers to new manual annotations of occlusion areas for prohibited items.
- PIDray-A: Contains over 124,000 images across 12 categories.
- PIXray-A: Covers 15 categories of prohibited items.
These datasets provide the necessary ground truth to train the model to recognize not just the item itself, but the specific pixels where it is being overlapped by other goods.
Results and Key Insights
The proposed model demonstrated superior performance over state-of-the-art methods, including Mask R-CNN, Cascade Mask R-CNN, and the specialized PIDrayNet.
Quantitative Performance
On the PIDray-A dataset, the model achieved a 0.9% improvement in both bounding box mAP and semantic mask mAP compared to the previous leading models. Ablation studies confirmed the importance of the bilayer structure; removing the occluder modeling step resulted in a performance drop of over 1% across all primary metrics.
Qualitative Advantages
Qualitative analysis showed that the model is particularly effective at separating overlapping objects of the same class (such as multiple power banks) and accurately predicting the masks of thin components, such as hammer handles, that are partially obscured. Previous models often failed to maintain mask continuity in these high-overlap scenarios.
Discussion and Future Work
While the bilayer modeling approach significantly improves segmentation for overlapping items, the study identified a limitation regarding "hidden" objects—items intentionally concealed to evade detection. Because the system relies on a standard Region Proposal Network (RPN), it may inherit the RPN's lack of sensitivity to deliberate concealment. Additionally, the use of a ViT-Large backbone from SAM increases computational demands compared to more lightweight, security-specific architectures.
Future research directions include optimizing the RPN specifically for the unique density characteristics of X-ray imaging and exploring graph-based models to better represent the complex, multi-layered relationships between various objects in a single container.
Summary updated