Instructions to use YAQICAI/LAO-X with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sam2
How to use YAQICAI/LAO-X with sam2:
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained("YAQICAI/LAO-X") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): predictor.set_image(<your_image>) masks, _, _ = predictor.predict(<input_prompts>)# Use SAM2 with videos import torch from sam2.sam2_video_predictor import SAM2VideoPredictor predictor = SAM2VideoPredictor.from_pretrained("YAQICAI/LAO-X") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): state = predictor.init_state(<your_video>) # add new prompts and instantly get the output on the same frame frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>) # propagate the prompts to get masklets throughout the video for frame_idx, object_ids, masks in predictor.propagate_in_video(state): ... - Notebooks
- Google Colab
- Kaggle
# Use SAM2 with videos
import torch
from sam2.sam2_video_predictor import SAM2VideoPredictor
predictor = SAM2VideoPredictor.from_pretrained("YAQICAI/LAO-X")
with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16):
state = predictor.init_state(<your_video>)
# add new prompts and instantly get the output on the same frame
frame_idx, object_ids, masks = predictor.add_new_points(state, <your_prompts>)
# propagate the prompts to get masklets throughout the video
for frame_idx, object_ids, masks in predictor.propagate_in_video(state):
...LAO-X
Model weights for "Localize Any Object in X-Ray Security Scans without Human Annotation" (NeurIPS 2026).
Paper ยท Code ยท Project website
LAO-X localizes objects in X-ray security scans without manual masks. The model is a granularity-controllable SAM 2.1 Hiera-S (UnSAMv2 architecture) fine-tuned only on synthetic X-ray images whose labels come from the LAO-X pipeline:
- an object bank mined from unlabeled DET-COMPASS scans (MuSc anomaly heatmaps fused with CutLER proposals),
- physics-guided synthesis: BeerโLambert composition of the banked objects' high/low-energy channels onto one empty container per image,
- oversegmentation pseudo-labels fused with the synthetic object masks,
- an easy โ hard โ extreme curriculum with increasing object count and overlap.
Files
| File | Description |
|---|---|
laox_sam2.1_hiera_small.pt |
Final model (extreme stage, epoch 48), model weights only ({"model": state_dict}), float32, 46.4M parameters |
SHA-256 of laox_sam2.1_hiera_small.pt:
9e7380409e0a51fb4f762db2f3c0fa875bcd299165ee29183b05516276f16d06
Usage
Install the code from the GitHub repository
(see its INSTALL.md), then download the weights:
hf download YAQICAI/LAO-X laox_sam2.1_hiera_small.pt --local-dir checkpoints
Point prompts at a chosen granularity (0 = fine parts, 1 = whole objects):
import numpy as np
from PIL import Image
from sam2.build_sam import build_sam2
from sam2.sam2_image_predictor import SAM2ImagePredictor
model = build_sam2("configs/unsamv2_small.yaml", "checkpoints/laox_sam2.1_hiera_small.pt")
predictor = SAM2ImagePredictor(model)
predictor.set_image(np.array(Image.open("scan.png").convert("RGB")))
masks, scores, _ = predictor.predict(
point_coords=np.array([[420, 300]]), point_labels=np.array([1]),
multimask_output=False, gra=0.5,
)
Whole-image class-agnostic evaluation as in the paper (granularities 0.1โ0.8,
mask threshold 0.5) is run with evaluate.py / scripts/eval_curriculum.sh
in the GitHub repository.
Training
Initialized from SAM 2.1 Hiera-S and trained on 8 GPUs with batch size 2 per GPU; each stage starts from the previous stage's checkpoint.
| Stage | Objects / image | Overlap gamma |
Samples | Base LR | Vision LR | Epochs |
|---|---|---|---|---|---|---|
| easy | 2โ4 | 0.0โ0.05 | 0โ4000 | 1.6e-4 | 4.8e-6 | 80 |
| hard | 4โ7 | 0.0โ0.3 | 0โ6000 | 1.2e-4 | 3.2e-6 | 64 |
| extreme | 6โ9 | 0.0โ0.5 | 0โ8000 | 1e-4 | 3e-6 | 48 |
No manual annotation was used for training.
Intended use and limitations
The model is intended for research on X-ray security imagery. It predicts class-agnostic masks and does not recognize object categories or threats; it must not be used as the sole basis for security decisions. It was trained on synthetic images built from DET-COMPASS scans and may perform worse on scanners with different colour rendering.
License
The weights are released under CC BY-NC-SA 4.0 (non-commercial use only), the same license as the LAO-X code. They are fine-tuned from SAM 2.1 (Apache-2.0).
Citation
@misc{cai2026localizeobjectxraysecurity,
title={Localize Any Object in X-Ray Security Scans without Human Annotation},
author={Yaqi Cai and Mingxuan Liu and Lorenzo Vaquero and Ning Wang and Nan Pu and Feng Xue and Elisa Ricci and Nicu Sebe},
year={2026},
eprint={2610.07326},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2610.07326},
}
- Downloads last month
- 113
Model tree for YAQICAI/LAO-X
Base model
facebook/sam2.1-hiera-small
# Use SAM2 with images import torch from sam2.sam2_image_predictor import SAM2ImagePredictor predictor = SAM2ImagePredictor.from_pretrained("YAQICAI/LAO-X") with torch.inference_mode(), torch.autocast("cuda", dtype=torch.bfloat16): predictor.set_image(<your_image>) masks, _, _ = predictor.predict(<input_prompts>)