A method for X-ray security image contraband extraction and classification

CN121544934BActive Publication Date: 2026-10-27NORTHEASTERN UNIV CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511659921.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-13
Publication Date
2026-10-27
Estimated Expiration
2045-11-13

AI Technical Summary

Technical Problem

然而,现有系统普遍存在两大痛点:(1)行李内物品重叠堆放导致目标物体与背景(如衣物、塑料包装)在X射线衰减系数上差异微弱,形成低对比度图像(典型信噪比<10dB);(2)复杂场景下违禁品形态变异(如刀具折叠、液体封装)导致特征模糊,现有基于阈值分割或模板匹配的算法准确率不足70%,难以满足自动化安检需求

Benefits of technology

[0016]本发明的有益效果:本发明创新性地提出了条件特征生成器和条件扩散模型技术,专门针对X射线违禁品包裹图像处理领域展开研究与应用。该技术聚焦于精准提取X射线违禁品包裹图像中的违禁品信息,通过条件扩散模型算法,能够高效生成单独的X射线违禁品图像以及与之对应的X射线包裹图像。这一成果为安检图像处理提供了全新的解决方案,有效解决了传统方法在图像分离和违禁品提取方面的局限性,为安检工作带来了更高的效率和准确性;

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121544934B_ABST
    Figure CN121544934B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of image processing, and discloses a method for extracting and classifying prohibited articles in X-ray security images. A conditional feature generator is used to initially generate X-ray package images and X-ray prohibited article images in X-ray security images. The generated images are combined with each step of noise images denoised by a diffusion model in a conditional manner, and finally the separation of packages and prohibited articles in the X-ray security images is realized to generate high-quality X-ray package images and X-ray prohibited article images. Compared with the widely used generative adversarial network in the past, the diffusion model network shows higher stability in the training process, effectively avoiding problems such as mode collapse and convergence difficulty. At the same time, the image quality generated by the diffusion model network is higher, the details are more delicate, and the texture is more realistic. In the classification of prohibited articles, a convolutional neural network combined with a fully connected layer is used to classify the prohibited articles extracted from the X-ray security images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method for extracting and classifying contraband from X-ray security inspection images. Background Technology

[0002] With the frequent occurrence of global public safety incidents, the demand for security checks at airports, rail transit, logistics hubs and other places is growing exponentially. As the core means of non-invasive detection, X-ray security checks directly determine the efficiency of security check systems through their image resolution capabilities. However, existing systems generally suffer from two major pain points: (1) overlapping items in luggage result in slight differences in the X-ray attenuation coefficient between the target object and the background (such as clothing and plastic packaging), forming low-contrast images (typical signal-to-noise ratio <10dB); (2) in complex scenarios, the morphological variations of contraband (such as folded knives and liquid packaging) lead to blurred features. Existing algorithms based on threshold segmentation or template matching have an accuracy of less than 70%, which is insufficient to meet the needs of automated security checks.

[0003] X-ray security inspection equipment achieves imaging based on the difference in attenuation of X-rays by materials. Its core principle involves physical processes such as photoelectric effect, Compton scattering and pair electron effect. Materials with different atomic numbers exhibit characteristic false colors in the image. This imaging method has three major technical defects: (1) The penetrating characteristics of X-rays cause overlapping areas of stacked items in the image, resulting in blurred target features; (2) Different manufacturers' equipment adopts different color mapping schemes, making cross-platform image analysis difficult; (3) Traditional attenuation imaging has limited ability to distinguish low-density materials such as plastics and liquids.

[0004] To overcome these challenges, numerous scholars have explored image segmentation and image generation in depth. [Olaf Ronneberger, Philipp Fischer, Thomas Brox. U-Net: Convolutional Networks for Biomedical Image Segmentation. [C], Medical Image Computing and Computer-Assisted Intervention, 2015, 9351: 234-241.] proposed a data-augmented U-Net network architecture, achieving efficient image segmentation with fewer labeled samples and achieving leading performance in related challenges. A network architecture with a contraction path and a symmetric expansion path was designed; the contraction path is used to capture contextual information, while the expansion path is used for accurate localization. The U-Net network achieved superior performance compared to previous methods in structural segmentation tasks.

[0005] Furthermore, [Hasib Zunair, A. Ben Hamza. Sharp U-Net: Depthwise Convolutional Network for Biomedical Image Segmentation[J], Computers in Biology and Medicine, 2021, 136] proposed a novel deep learning network architecture called Sharp U-Net, which sharpens feature maps through deep convolution to improve the accuracy of image segmentation, achieving performance superior to existing methods. By introducing deep convolution operations on top of U-Net, using a sharpening kernel filter to preprocess the encoder feature map, and then fusing it with the decoder feature map, the clarity of the feature map is improved.

[0006] In the field of image generation, [Alec Radford, Luke Metz, Soumith Chintala. Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks[C], International Conference on Learning Representations, 2016] proposed a novel convolutional neural network architecture—Deep Convolutional Generative Adversarial Networks (DCGANs)—for unsupervised representation learning without labeled data, and effectively learned hierarchical representations from object parts to scenes. DCGANs can learn effective image representations and apply these features to new tasks, demonstrating their applicability as a general image representation.

[0007] To enable timely detection of prohibited items during security checks, a method for extracting and classifying prohibited items from X-ray security images is proposed. Summary of the Invention

[0008] This invention proposes a method for extracting and classifying contraband from X-ray security images. The core of this method lies in a diffusion model based on conditional features and a contraband classification network. A conditional feature generator is used to initially generate X-ray package images and X-ray contraband images from X-ray security images. Using this as a condition, noisy images from each step of the diffusion model's inverse denoising process are conditionally merged, ultimately separating packages and contraband from the X-ray security image and generating high-quality X-ray package and contraband images. Compared to the widely used Generative Adversarial Networks (GANs), the diffusion model network exhibits higher stability during training, effectively avoiding problems such as mode collapse and convergence difficulties. Simultaneously, the images generated by the diffusion model network are of higher quality, with finer details and more realistic textures. In contraband classification, a convolutional neural network combined with fully connected layers is used to classify contraband extracted from X-ray security images. This innovative approach improves the accuracy and reliability of X-ray security inspection systems and provides strong support for ensuring public safety and improving security inspection efficiency.

[0009] The technical solution of this invention is as follows: A method for extracting and classifying contraband from X-ray security inspection images, wherein a contraband extraction network extracts X-ray contraband images and X-ray package images; the contraband extraction network includes forward diffusion, a conditional feature generator, and inverse denoising; the X-ray contraband package image is used to generate an initial X-ray package image and an initial X-ray contraband image through the conditional feature generator; forward diffusion progressively adds Gaussian noise to the original X-ray package image and the original X-ray contraband image to obtain a noisy image; in inverse denoising, based on the initial X-ray package image and the initial X-ray contraband image output by the conditional feature generator, the noise image is progressively denoised to obtain the X-ray package image and the X-ray contraband image; the X-ray contraband image is classified by an X-ray contraband image classification network.

[0010] During the forward diffusion process, according to the time step t Gradually analyze the original X-ray images of contraband. W 0 and original X-ray package image B 0 Add noise that conforms to a standard Gaussian distribution The time step range is: 1 ≤ t ≤ 1000; when t At 1000, noisy X-ray images of contraband. W t and noisy X-ray wrapped images B t All images are pure noise; the forward diffusion process is shown in formula (1): (1) In the formula, Indicates time step t Add weights to noise.

[0011] The conditional feature generator includes a downsampling module, a multi-level feature extraction module, and an upsampling module. The downsampling module mainly consists of a 3×3 convolutional layer with a stride of 1, a batch normalization layer, a ReLU activation function, and a max pooling layer. After the 3×3 convolutional layer slides through a 3×3 window to traverse the feature map of the X-ray contraband package image, it is output sequentially through the batch normalization layer, the ReLU activation function, and the max pooling layer.

[0012] The multi-level feature extraction module is divided into a multi-branch feature extraction stage and a feature aggregation stage; the output of the downsampling module, after passing through the multi-branch feature extraction stage, is then processed by the feature aggregation stage to obtain the final downsampled features. The multi-branch feature extraction stage adopts a three-way heterogeneous convolution parallel architecture, including a 7×7 large kernel convolution branch, a 5×5 medium kernel convolution branch, and a 3×3 small kernel convolution branch, which are connected in parallel. All three convolutional branches embed a hybrid attention enhancement module; the hybrid attention enhancement module consists of a dual-branch collaborative mechanism of spatial attention and channel attention: the spatial attention branch uses deformable convolutional kernels to dynamically allocate spatial weights and automatically focus on the target region; the channel attention branch is based on the SE-Net architecture, captures the inter-channel dependencies through global average pooling and max pooling, and uses a gating mechanism to adaptively adjust the feature channel response intensity; the output features of the spatial attention branch and the channel attention branch are added element-wise and then concatenated with the original input features to form a dual-stream fusion mechanism of "feature enhancement - preservation of original information"; In the feature aggregation stage, cross-channel information interaction and dimension alignment are achieved by using 1×1 convolution on the output features of the multi-branch feature extraction stage. Then, a hybrid attention mechanism module is introduced to perform weight allocation to complete the deep fusion of the three features, generating features that have global semantic consistency, mid-level structural robustness and local detail sharpness.

[0013] The upsampling module employs a symmetric encoding / decoding structure. In each upsampling step, a transposed convolution is first used to achieve a 2x spatial dimension expansion, followed by a cascaded 3×3 depthwise separable convolution module. A multi-level skip connection channel is constructed to adaptively fuse the shallow features obtained from each downsampling step with the features obtained from each upsampling step, enhancing semantic consistency and achieving feature complementarity. Finally, the initial X-ray contraband image is obtained. C w and initial X-ray package image C b .

[0014] The reverse denoising process uses the initial X-ray contraband image.C w and X-ray package images C b As a condition, the noisy image at each step is merged into channels and then progressively denoised using a denoising network. The denoising network includes a multi-layer downsampling module and an upsampling module. The downsampling module consists of six 3×3 convolutional layers with a stride of 1, batch normalization layers, ReLU activation functions, and max pooling layers. The downsampling module extracts features from the noisy image obtained by forward diffusion of the diffusion model to obtain local texture and structural information. The upsampling module is a deconvolutional layer that performs upsampling based on the feature information extracted by the multi-layer downsampling module to progressively predict noise. The input to the denoising network is the first... n Step image [ W n ; B n The output is the [number]th [item]. n -1 step to add noise to the image [ W n-1 ; B n-1 ]; At time step t The noise introduced during the forward diffusion process is optimized by designing a loss function so that the predicted noise gradually approaches the introduced noise during training. The inverse denoising loss function at each time step t is defined as follows: (2) in, Represents real noise. Indicates predicted noise; Predict noise at each time step Calculate the variance of the random generation module and mean As shown in formula (3): (3) Indicates time step t -1 adds weight to the noise; The time step is obtained from the mean and variance according to formula (3). t Time to step t -1 image distribution, when t When =1, clean X-ray images of contraband and clean X-ray images of packages are obtained: (4).

[0015] The X-ray contraband image classification network adopts a hierarchical feature extraction-global decision architecture, achieving accurate identification of contraband types through multi-scale feature fusion. The network consists of a 5-level downsampling feature encoder and a 3-level fully connected decision module. In the feature encoding stage, each downsampling module follows a standardized processing flow of "convolution-normalization-activation-pooling" to progressively extract multi-level features from edge contours to object components from the X-ray contraband image, ultimately generating a 32×32×512-dimensional high-dimensional semantic feature tensor. In the global decision stage of the X-ray contraband image classification network, the 3-level fully connected layers constitute the feature extraction-global decision module. The progressive processing pipeline of feature weighting, dimensionality compression, and category mapping is as follows: The first fully connected layer achieves cross-channel feature fusion through 1024 neurons; the middle fully connected layer adopts a bottleneck structure to suppress overfitting; and the last fully connected layer, in conjunction with the Softmax activation function, completes the projection from the feature space to the category label space. The entire decision-making process uses the alternating effects of linear transformation of the weight matrix and nonlinear activation of ReLU or Softmax to perform global correlation analysis and probabilistic category prediction of the high-dimensional semantic feature tensor. Finally, an N-dimensional probability vector is output, where the category corresponding to the maximum probability value is the determination result of the contraband in the X-ray contraband image.

[0016] The beneficial effects of this invention: This invention innovatively proposes a conditional feature generator and conditional diffusion model technology, specifically for research and application in the field of X-ray contraband package image processing. This technology focuses on accurately extracting contraband information from X-ray contraband package images. Through the conditional diffusion model algorithm, it can efficiently generate separate X-ray contraband images and their corresponding X-ray package images. This achievement provides a completely new solution for security inspection image processing, effectively overcoming the limitations of traditional methods in image separation and contraband extraction, bringing higher efficiency and accuracy to security inspection work. The conditional feature generator designed in this invention plays a crucial preprocessing role. When an X-ray image of a contraband package is input, the conditional feature generator uses advanced image analysis algorithms to perform a comprehensive and detailed analysis of the image. It accurately identifies various feature elements in the image, including the shape and outline of the contraband, as well as the overall structure of the package and background features. Through comprehensive analysis and processing of these features, a series of representative and discriminative conditional features are initially generated. These conditional features can guide the diffusion model to more accurately locate and extract the contraband image, thereby significantly improving the diffusion model's extraction effect on X-ray contraband images and laying a solid foundation for subsequent high-quality image separation. The algorithm of this invention possesses powerful automatic separation capabilities, enabling rapid and accurate separation of X-ray images of contraband and X-ray images of packages without extensive manual intervention. In real-world security inspection scenarios, security personnel process a large number of X-ray package images daily. Traditional manual inspection methods are not only inefficient but also prone to missed or false detections. The method of this invention can significantly shorten image analysis time, improve security inspection efficiency, and allow security personnel to process more packages in a shorter time. This invention's X-ray contraband image classification network, relying on cutting-edge deep learning algorithms and image recognition technology, possesses powerful automatic classification capabilities. Once the contraband image is accurately extracted from the X-ray image of the package, the classification network quickly activates its intelligent analysis engine to conduct a detailed feature analysis of each contraband image. It comprehensively considers multiple dimensions such as the image's shape, contour, and texture, comparing and matching it with a model pre-trained on massive amounts of data to quickly and accurately classify the contraband image into the corresponding category, such as knives or flammable and explosive items. This automatic classification method clearly and intuitively presents the specific details of the contraband hidden inside the package, eliminating the need for security personnel to spend considerable time manually identifying and judging blurry images. This significantly improves the efficiency and accuracy of information acquisition, ensuring that security checks can be conducted quickly and orderly, providing a solid and reliable guarantee for public safety. Attached Figure Description

[0017] Figure 1 The following is a general technical roadmap of the present invention: (a) is an X-ray contraband extraction network, and (b) is an X-ray contraband image classification network. Figure 2 This is a schematic diagram of the inverse denoising process in the random generation module; Figure 3 The X-ray contraband image generation results of the present invention are compared with those of other excellent methods: (a) Method 1; (b) Method 2; (c) The method of the present invention; Figure 4 The classification results of the X-ray images of contraband according to the present invention are as follows: (a) classification results of knives; (b) classification results of firecrackers; (c) classification results of guns; (d) classification results of scissors. Detailed Implementation

[0018] This invention relates to a method for extracting and classifying contraband from X-ray security inspection images. The method flow is as follows: Figure 1As shown, X-ray package images and X-ray contraband images are generated using a conditional feature generator. The diffusion model consists of forward diffusion and backward denoising. Forward diffusion progressively adds Gaussian noise to the target image to obtain a noisy image. In backward denoising, the image is gradually denoised using the initialization conditions of the conditional feature generator to obtain X-ray package images and X-ray contraband images. The extracted contraband is classified by combining a convolutional neural network and a fully connected layer.

[0019] The contraband extraction network comprises forward diffusion, a conditional feature generator, and inverse denoising. During forward diffusion, noise is added to the original X-ray contraband image and X-ray package image. The conditional feature generator generates the initial X-ray package image and X-ray contraband image. Inverse denoising performs progressive denoising based on the output of the conditional feature generator, generating high-quality X-ray contraband image and X-ray package image.

[0020] During forward diffusion, according to time steps t Gradually analyze the original X-ray images of contraband. W 0 and X-ray package images B 0 Add noise that conforms to a standard Gaussian distribution The time step range is: 1 ≤ t ≤ 1000; when t X-ray image of contraband at 1000 W t and X-ray package images B t All images are pure noise; the forward diffusion process is shown in formula (1): (1) In the formula, Indicates time step t Add weights to noise.

[0021] The conditional feature generator comprises a downsampling module, a multi-level feature extraction module, and an upsampling module. The downsampling module consists of a 3×3 convolutional layer with a stride of 1, a batch normalization layer, a ReLU activation function, and a max-pooling layer. The convolutional layer slides through the feature maps of the X-ray contraband package image using a 3×3 window, thereby capturing multi-scale semantic information; the batch normalization layer accelerates training and alleviates overfitting; the ReLU activation function maps the linear output to a non-linear one, enabling the network to learn complex patterns; the max-pooling layer uses a 2×2 sliding window with a stride of 2 to reduce the size of the feature map at each step. The input is 512. The X-ray image of contraband, 512, was subjected to four rounds of downsampling feature extraction to obtain 64. Feature map of 64.

[0022] Multi-level feature extraction module, such as Figure 2 As shown, an innovative three-way heterogeneous convolutional parallel architecture is adopted, which achieves multi-scale feature complementarity and fusion through differentiated receptive field design: the 7×7 large kernel convolutional branch uses the extended receptive field to capture long-range dependent global contextual information, effectively modeling the semantic association of distant targets in the image; the 5×5 medium kernel convolutional branch focuses on extracting structured features with intermediate granularity while balancing computational efficiency and feature representation ability; and the 3×3 small kernel convolutional branch accurately depicts detailed features such as edges and textures through dense local receptive fields.

[0023] All three convolutional branches embed a hybrid attention enhancement module, which consists of a dual-branch collaborative mechanism of spatial attention and channel attention. The spatial attention branch uses deformable convolutional kernels to dynamically allocate spatial weights and automatically focus on the target region. The channel attention branch borrows from the SE-Net architecture, capturing inter-channel dependencies through global average pooling and max pooling, and employs a gating mechanism to adaptively adjust the response intensity of feature channels. The output features of the spatial and channel attention branches are element-wise summed and then concatenated with the original input features to form a dual-stream fusion mechanism that "enhances features and preserves original information."

[0024] In the feature aggregation stage, 1×1 convolution is first used to achieve cross-channel information interaction and dimensional alignment of the output features from the multi-branch feature extraction stage. Then, a hybrid attention mechanism module is introduced: this module adopts multi-scale attention weight allocation in the channel dimension and highlights significant features by enhancing the contrast of local regions in the spatial dimension. Finally, feature concatenation and soft attention weighting are used to complete the deep fusion of the three-way features, generating a multi-level feature representation that has global semantic consistency, robustness of the mid-level structure and sharpness of local details.

[0025] The upsampling module is designed with a symmetric encoding / decoding structure. In each upsampling step, transposed convolution is first used to achieve a 2x spatial dimension expansion, followed by cascading 3×3 depthwise separable convolutional modules. Deconvolution operations effectively compensate for information loss during downsampling and reconstruct high-frequency details. Through parameterized feature calibration, the convolutional layers can eliminate checkerboard artifacts that may be introduced by deconvolution and enhance the nonlinear expressive power between feature channels. A multi-level skip connection channel is constructed to adaptively fuse the shallow features obtained from each downsampling step and the features obtained from each upsampling step, enhancing semantic consistency, achieving feature complementarity, and finally obtaining the initial X-ray contraband conditional image. C w and X-ray encapsulation condition images C b .

[0026] The reverse denoising process uses the initial X-ray contraband image. C wand X-ray package images C b As a condition, the noisy image at each step is merged into channels and then progressively denoised using a denoising network. The denoising network includes a multi-layer downsampling module and an upsampling module. The downsampling module consists of six 3×3 convolutional layers with a stride of 1, batch normalization layers, ReLU activation functions, and max pooling layers. The downsampling module extracts features from the noisy image obtained by forward diffusion of the diffusion model, acquiring local texture and structural information of the noisy image. The upsampling module is a deconvolutional layer that performs upsampling based on the feature information extracted by the multi-layer downsampling module to progressively predict noise. The input to the denoising network is the first... n Step-by-step noise image [ W n ; B n The output is the first... n -1 step to add noise to the image [ W n-1 ; B n-1 ].

[0027] At time step t The noise introduced during the forward diffusion process is optimized by designing a loss function so that the predicted noise gradually approaches the introduced noise during training. The inverse denoising loss function at each time step t is defined as follows: (2) in, Represents real noise. Indicates predicted noise; Predict noise at each time step Calculate the variance of the random generation module and mean As shown in formula (3): (3) Indicates time step t -1 adds weight to the noise; The time step is obtained from the mean and variance according to formula (3). t Time to step t -1 image distribution, when t When =1, clean X-ray images of contraband and clean X-ray images of packages are obtained: (4) The X-ray contraband image classification network adopts a hierarchical feature extraction-global decision architecture, achieving accurate identification of contraband types through multi-scale feature fusion. The network consists of a 5-level downsampling feature encoder and a 3-level fully connected decision module. In the feature encoding stage, each downsampling module follows a standardized processing flow of "convolution-normalization-activation-pooling", specifically including a 3×3 convolutional layer with a stride of 1 (for local feature extraction), a batch normalization layer (to accelerate convergence and improve generalization), a ReLU nonlinear activation function (to introduce the model's nonlinear expressive power), and a 2×2 max pooling layer (to achieve downsampling operation that halves the feature map size). This design progressively extracts multi-level features from edge contours to object parts from the original X-ray image through a step-by-step abstraction mechanism, ultimately generating a 32×32×512-dimensional high-dimensional semantic feature tensor. During the decision-making phase, a three-level fully connected layer constitutes a progressive processing pipeline of feature recalibration, dimensionality compression, and class mapping: the first fully connected layer achieves cross-channel feature fusion through 1024 neurons; the middle fully connected layer employs a bottleneck structure to suppress overfitting; and the final fully connected layer, in conjunction with the Softmax activation function, completes the projection from the feature space to the class label space. The entire decision-making process achieves global correlation analysis and probabilistic class prediction of contraband features through the alternating effects of linear transformation of the weight matrix and nonlinear activation of ReLU / Softmax. Finally, the network outputs an N-dimensional probability vector, where the class corresponding to the maximum probability value is the determination result of the contraband in the X-ray image.

[0028] We qualitatively compared the X-ray contraband image extraction algorithm proposed in this invention with several currently popular algorithms, selecting Method 1 ("Olaf Ronneberger, Philipp Fischer, Thomas Brox. U-Net: Convolutional Networks for Biomedical Image Segmentation. [C], Medical Image Computing and Computer-Assisted Intervention, 2015, 9351: 234-241.") and Method 2 ("Alec Radford, Luke Metz, Soumith Chintala. Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks[C], International Conference on Learning Representations, 2016"), which are classic algorithms for image segmentation and image generation, respectively. In this X-ray contraband image extraction experiment, we used knives, a common and representative contraband, as the extraction target. The experimental comparison results are presented intuitively in... Figure 3After detailed observation and analysis of the extraction results, we found that the algorithm of Olaf Ronneberger et al. (Method 1) has significant shortcomings in extracting X-ray images of contraband. The extracted knife images are incomplete in shape, differing greatly from the knife shapes in real X-ray images of contraband packages, as if missing crucial parts, making it difficult to accurately represent the true characteristics of the contraband. Moreover, the X-ray package image left after extraction shows color deviation, with a significant difference in color distribution from the original image, which may interfere with subsequent image analysis and recognition. The algorithm of Alec Radford et al. (Method 2) shows some improvement over Method 1. The extracted knife images are better in terms of overall outline and shape, more clearly presenting the approximate shape of the knife. However, it still has some flaws; the details of the image are not clear enough, and the edges are slightly blurred. Furthermore, in terms of color, it still differs from real X-ray images of contraband packages; the color reproduction is not high enough, failing to accurately reflect the actual color of the contraband within the package. In stark contrast, the algorithm of this invention demonstrates superior performance in extracting X-ray images of contraband. Both the extracted X-ray images of contraband and the preserved X-ray package images show significant improvements in quality. The extracted knife images have complete outlines and rich details, accurately representing all parts of the knife and highly consistent with knives in real X-ray images of contraband packages. The overall image fidelity is high, and the colors are accurate, realistically reflecting the original state of the contraband within the package. In conclusion, through this rigorous and comprehensive comparative experiment, we can clearly see the significant advantages of this invention in extracting X-ray images of contraband, providing more accurate and reliable support for image processing and analysis in the security inspection field.

[0029] Figure 4This paper presents the detailed results of a classification experiment conducted on X-ray images of contraband. In this experiment, we carefully selected four highly representative contraband categories—knives, firecrackers, firearms, and scissors—as the core verification objects. These contraband items frequently appear in security checkpoints and pose a significant threat; accurate classification is crucial for ensuring public safety. During the experiment, we utilized the X-ray contraband classification algorithm of this invention. Based on advanced image processing technology and deep learning models, this algorithm can deeply mine the unique features of contraband in X-ray images. From texture details to shape contours, the algorithm performs meticulous analysis, thereby constructing a comprehensive and accurate feature description. Experimental results demonstrate that the X-ray contraband classification algorithm of this invention exhibits superior performance. It can achieve extremely accurate classification of single X-ray contraband images extracted from complex backgrounds. Whether it's the sharp edge of a knife, the complex structure of a firearm, or the unique shape of scissors, the algorithm can accurately identify and classify them into the corresponding categories, providing reliable technical support for security checks and effectively improving the efficiency and accuracy of contraband detection.

Claims

1. A method for extracting and classifying contraband from X-ray security inspection images, characterized in that, A contraband extraction network extracts X-ray images of contraband and X-ray packages. The contraband extraction network includes forward diffusion, a conditional feature generator, and inverse denoising. The X-ray contraband package image is used by the conditional feature generator to generate initial X-ray package images and initial X-ray contraband images. Forward diffusion progressively adds Gaussian noise to the original X-ray package images and original X-ray contraband images to obtain noisy images. In inverse denoising, based on the initial X-ray package images and initial X-ray contraband images output by the conditional feature generator, the noise images are progressively denoised to obtain the X-ray package images and X-ray contraband images. The X-ray contraband images are then classified by an X-ray contraband image classification network.

2. The method for extracting and classifying contraband from X-ray security images according to claim 1, characterized in that, During the forward diffusion process, according to the time step t Gradually analyze the original X-ray images of contraband. W 0 and original X-ray package image B 0 Add noise that conforms to a standard Gaussian distribution The time step range is: 1 ≤ t ≤ 1000; when t At 1000, noisy X-ray images of contraband. W t and noisy X-ray wrapped images B t All images are pure noise; the forward diffusion process is shown in formula (1): (1) In the formula, Indicates time step t Add weights to noise.

3. The method for extracting and classifying contraband from X-ray security images according to claim 2, characterized in that, The conditional feature generator includes a downsampling module, a multi-level feature extraction module, and an upsampling module. The downsampling module mainly consists of a 3×3 convolutional layer with a stride of 1, a batch normalization layer, a ReLU activation function, and a max pooling layer. After the 3×3 convolutional layer slides through a 3×3 window to traverse the feature map of the X-ray contraband package image, it is output sequentially through the batch normalization layer, the ReLU activation function, and the max pooling layer.

4. The method for extracting and classifying contraband from X-ray security images according to claim 3, characterized in that, The multi-level feature extraction module is divided into a multi-branch feature extraction stage and a feature aggregation stage; the output of the downsampling module, after passing through the multi-branch feature extraction stage, is then processed by the feature aggregation stage to obtain the final downsampled features. The multi-branch feature extraction stage adopts a three-way heterogeneous convolution parallel architecture, including a 7×7 large kernel convolution branch, a 5×5 medium kernel convolution branch, and a 3×3 small kernel convolution branch, which are connected in parallel. All three convolutional branches are embedded with a hybrid attention enhancement module; the hybrid attention enhancement module consists of a dual-branch collaborative mechanism of spatial attention and channel attention: the spatial attention branch uses deformable convolutional kernels to dynamically allocate spatial weights and automatically focus on the target region; the channel attention branch is based on the SE-Net architecture, captures the inter-channel dependencies through global average pooling and max pooling, and adopts a gating mechanism to adaptively adjust the response intensity of the feature channels; The output features of the spatial attention branch and the channel attention branch are added element by element and then concatenated with the original input features to form a two-stream fusion mechanism of "feature enhancement - preservation of original information". In the feature aggregation stage, cross-channel information interaction and dimension alignment are achieved by using 1×1 convolution on the output features of the multi-branch feature extraction stage. Then, a hybrid attention mechanism module is introduced to perform weight allocation to complete the deep fusion of the three features, generating features that have global semantic consistency, mid-level structural robustness and local detail sharpness.

5. The method for extracting and classifying contraband from X-ray security images according to claim 4, characterized in that, The upsampling module employs a symmetric encoding / decoding structure. In each upsampling step, a transposed convolution is first used to achieve a 2x spatial dimension expansion, followed by a cascaded 3×3 depthwise separable convolution module. A multi-level skip connection channel is constructed to adaptively fuse the shallow features obtained from each downsampling step with the features obtained from each upsampling step, enhancing semantic consistency and achieving feature complementarity. Finally, the initial X-ray contraband image is obtained. C w and initial X-ray package image C b .

6. The method for extracting and classifying contraband from X-ray security images according to claim 5, characterized in that, The reverse denoising process uses the initial X-ray contraband image. C w and X-ray package images C b As a condition, the noisy image at each step is merged into channels and then progressively denoised using a denoising network. The denoising network includes a multi-layer downsampling module and an upsampling module. The downsampling module consists of six 3×3 convolutional layers with a stride of 1, batch normalization layers, ReLU activation functions, and max pooling layers. The downsampling module extracts features from the noisy image obtained by forward diffusion of the diffusion model to obtain local texture and structural information. The upsampling module is a deconvolutional layer that performs upsampling based on the feature information extracted by the multi-layer downsampling module to progressively predict noise. The input to the denoising network is the first... n Step image [ W n ; B n The output is the [number]th [item]. n -1 step to add noise to the image [ W n-1 ; B n-1 ]; At time step t The noise introduced during the forward diffusion process is optimized by designing a loss function so that the predicted noise gradually approaches the introduced noise during training. The inverse denoising loss function at each time step t is defined as follows: (2) in, Represents real noise. Indicates predicted noise; Predict noise at each time step Calculate the variance of the random generation module and mean As shown in formula (3): (3) Indicates time step t -1 adds weight to the noise; The time step is obtained from the mean and variance according to formula (3). t Time to step t -1 image distribution, when t When =1, clean X-ray images of contraband and clean X-ray images of packages are obtained: (4)。 7. The method for extracting and classifying contraband from X-ray security images according to claim 1, characterized in that, The X-ray contraband image classification network adopts a hierarchical feature extraction-global decision architecture, achieving accurate identification of contraband types through multi-scale feature fusion. The network consists of a 5-level downsampling feature encoder and a 3-level fully connected decision module. In the feature encoding stage, each downsampling module follows a standardized processing flow of "convolution-normalization-activation-pooling" to progressively extract multi-level features from edge contours to object components from the X-ray contraband image, ultimately generating a 32×32×512-dimensional high-dimensional semantic feature tensor. In the global decision stage of the X-ray contraband image classification network, the 3-level fully connected layers constitute the feature extraction-global decision module. The progressive processing pipeline of feature weighting, dimensionality compression, and category mapping is as follows: The first fully connected layer achieves cross-channel feature fusion through 1024 neurons; the middle fully connected layer adopts a bottleneck structure to suppress overfitting; and the last fully connected layer, in conjunction with the Softmax activation function, completes the projection from the feature space to the category label space. The entire decision-making process uses the alternating effects of linear transformation of the weight matrix and nonlinear activation of ReLU or Softmax to perform global correlation analysis and probabilistic category prediction of the high-dimensional semantic feature tensor. Finally, an N-dimensional probability vector is output, where the category corresponding to the maximum probability value is the determination result of the contraband in the X-ray contraband image.

Citation Information

Patent Citations

  • Training method of security check image feature enhancement model and security check image processing method

    CN117237872A

  • Diffusion model and generative adversarial network-based image segmentation method and apparatus

    WO2025050542A1