NeurIPS 2025

CSPCL: Category Semantic Prior Contrastive
Learning for Deformable DETR-Based Prohibited
Item Detectors
Mingyuan Li1
Tong Jia1,2∗Hao Wang1
Bowen Ma1
Hui Lu1
Shiyi Guo1
Da Cai1
Dongyue Chen1
1 College of Information Science and Engineering, Northeastern University, China
2 State Key Laboratory of Synthetical Automation for Process Industries, Northeastern University
542027743@qq.com, jiatong@ise.neu.edu.cn, ddsywh@yeah.net,
2010285@stu.neu.edu.cn, 2603813543@qq.com, guoshiyi@ise.neu.edu.cn,
2210329@stu.neu.edu.cn, chendongyue@ise.neu.edu.cn
Abstract
Prohibited item detection based on X-ray images is one of the most effective secu-
rity inspection methods. However, the foreground-background feature coupling
caused by the overlapping phenomenon specific to X-ray images makes general
detectors designed for natural images perform poorly. To address this issue, we
propose a Category Semantic Prior Contrastive Learning (CSPCL) mechanism,
which aligns the class prototypes perceived by the classifier with the content queries
to correct and supplement the missing semantic information responsible for classifi-
cation, thereby enhancing the model sensitivity to foreground features. To achieve
this alignment, we design a specific contrastive loss, CSP loss, which comprises
the Intra-Class Truncated Attraction (ITA) loss and the Inter-Class Adaptive Repul-
sion (IAR) loss, and outperforms classic contrastive losses. Specifically, the ITA
loss leverages class prototypes to attract intra-class content queries and preserves
essential intra-class diversity via a gradient truncation function. The IAR loss
employs class prototypes to adaptively repel inter-class content queries, with the
repulsion strength scaled by prototype-prototype similarity, thereby improving
inter-class discriminability, especially among similar categories. CSPCL is general
and can be easily integrated into Deformable DETR-based models. Extensive
experiments on the PIXray, OPIXray, PIDray, and CLCXray datasets d...