Contraband detection method in X-ray images based on multi-scale feature fusion

By adopting a multi-scale feature fusion detection method in X-ray image contraband detection, the problem of time-consuming and inaccurate detection in the prior art is solved, efficient and accurate contraband detection is achieved, and detection performance and stability are improved.

CN119295886BActive Publication Date: 2025-04-18QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES) +6
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411844794.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-04-18
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

The prior art has time-consuming, inaccurate and error-prone problems in the detection of X-ray image contraband, especially in complex scenarios and high load conditions, and it is difficult to effectively identify contraband items.

Method used

Using the X-ray image contraband detection method based on multi-scale feature fusion, a detection model including image branches, adaptive high and low pass filter module, text branches, Neck layer and head head is constructed, and image text is jointly trained, multi-scale features are extracted and fused, improving the accuracy and efficiency of detection.

Benefits of technology

It realizes efficient and accurate contraband detection in complex scenarios and high load conditions, improves detection performance and stability, and enhances the generalization ability and robustness of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119295886B_ABST
    Figure CN119295886B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for detecting contraband in X-ray images based on multi-scale feature fusion, and belongs to the field of image processing technology. It includes the following steps: obtaining an X-ray contraband data set, and dividing the data set into a training set and a test set; constructing an X-ray image contraband target detection model based on multi-scale feature fusion, the model including an image branch, an adaptive high- and low-pass filter module, a text branch, a Neck layer, and a Head; inputting images in the training set into the model to train the model; optimizing the model using a loss function to obtain a trained model; inputting images in the test set into the trained model to obtain contraband detection results. The present invention improves performance in real-time monitoring tasks while being more efficient, reduces computational complexity and memory usage, and solves the problem of blurred image boundary details in complex scenes through joint training of images and texts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of image processing, and in particular relates to an X-ray image contraband detection method based on multi-scale feature fusion. Background Art

[0002] During the security check, an X-ray scanner is usually used to perform X-ray imaging of the passenger's luggage, and then professional security personnel will check whether there are any prohibited items. However, this link is very time-consuming to manually screen dangerous goods, and security personnel need to maintain long-term high-intensity work. In the long run, it is difficult to efficiently and accurately identify prohibited items in a large number of X-ray images, and human errors are prone to occur, resulting in reduced stability and accuracy of the security inspection system. In addition, due to the overlap of covered objects during X-ray scanning, there are serious overlapping occlusions, extreme clutter, coupling of foreground and background information, and edge blurring, so it is difficult to professionally distinguish dangerous objects. In addition, since the staff is prone to fatigue and distraction, manual identification is boring and prone to errors, not to mention catching up with the peak traffic hours and identifying various prohibited items within the specified time. Studies have shown that manual operators can only achieve a success rate of 80-90%. However, the detection of prohibited items requires detailed inspections, which requires both professionalism and vigilance. In recent years, people are in urgent need of proposing a real-time, accurate and efficient security inspection method. Therefore, conducting research on X-ray contraband target detection has important theoretical and practical significance.

[0003] Several automatic contraband detection systems have been proposed to simplify the baggage security screening process. However, unlike the superior results of traditional object detectors in RGB images, the performance of X-ray detectors is limited due to the inherent differences between X-ray and RGB images. In addition to the differences with natural images, other issues include severe class imbalance, limited datasets, severe occlusions, and little prior knowledge. Another issue is that the high classification variance within the contraband category further hinders the performance of contraband detection as these items are barely visible in X-ray scans. Eliminating and concealing these contraband items can lead to serious consequences. Current state-of-the-art methods are not powerful enough to cope with real-life challenges and stay ahead of these evolving contraband.

[0004] Researchers are committed to developing powerful and efficient systems to overcome these loopholes and provide reliable solutions for baggage contraband screening. However, these algorithms have not yet achieved perfect results in baggage security detection. Contraband security detection remains an open challenge. Therefore, it is imperative to develop more powerful, flexible, and real-time methods for baggage scanning contraband identification. The research community must design suitable methods to help effectively detect contraband during security inspections under various complex and changing situations. Therefore, faced with the unique image features of X-ray images and the evolving types of contraband, X-ray image contraband target detection is a more challenging and urgent problem to be solved. Summary of the invention

[0005] In order to solve the above problems, the present invention provides a method for detecting contraband in X-ray images based on multi-scale feature fusion.

[0006] In order to achieve the above object, the present invention is implemented through the following technical solutions:

[0007] The present invention provides a method for detecting contraband in X-ray images based on multi-scale feature fusion, comprising the following steps:

[0008] S1. Obtain a data set of X-ray contraband items, and divide the data set into a training set and a test set;

[0009] S2. Construct an X-ray image contraband target detection model based on multi-scale feature fusion, the model includes an image branch, an adaptive high-pass and low-pass filter module, a text branch, a Neck layer and a Head; X-ray images in the training set are input into the model to train the model;

[0010] S3. Use the loss function to optimize the model and obtain a trained model;

[0011] S4. The X-ray images in the test set are input into the trained model to obtain the contraband detection results.

[0012] Further, step S1 includes:

[0013] Get an X-ray contraband dataset with N data images , each picture The composition is as follows:

[0014] ,

[0015] ,

[0016] in, Indicates the number of images, Represents a vector that matches the number of categories in the dataset, index represents the specified class that appears in the dataset, =1 means the category appears in middle, =0 means not present middle, Represents the semi-transparent sub-images corresponding to different categories in the image, Target object categories considered as total contraband, Represents all objects in the image that are not related to contraband, called background classes. , Indicates the number of categories in the data set; Representing images Whether the prohibited object category exists, 1 means it exists, and 0 means it does not exist; Indicates the total prohibited items category Individual contraband target object categories in ; Representing images Individual contraband target object categories in ; Represents the total background class A single background class in ; Representing images A single background category in .

[0017] Furthermore, in step S2, in the image branch, the training set X-ray images are input into the improved YOLOv8 backbone network for feature extraction to obtain multi-scale features, specifically:

[0018] The improved YOLOv8 backbone network adopts the C3k2 structure of YOLO11 to replace the C2f structure, and adds the C2PSA module of YOLO11 after the last layer of SPPF module of the backbone network; replaces the C3k convolution operation in the C3k2 structure with a deformable convolution, and the deformable convolution is a deformable convolution network DCN;

[0019] The X-ray images in the training set are input into the improved YOLOv8 backbone network for feature extraction to obtain the first feature , Second feature and the third feature .

[0020] Furthermore, the adaptive high-pass and low-pass filter modules in step S2 are specifically:

[0021] The adaptive high-pass and low-pass filter module includes an adaptive low-pass filter generator and an adaptive high-pass filter generator; the adaptive low-pass filter generator includes a convolution layer, a depth-separable convolution layer, and a reshaping and normalization layer; the adaptive high-pass filter generator includes a convolution layer, a reshaping and normalization layer, and a unit kernel subtraction layer;

[0022] The first feature , Second feature and the third feature After the adaptive high-pass and low-pass filter modules are used for feature fusion enhancement, the first enhanced feature is obtained. , the second enhanced feature And the third enhancement feature , the specific process is:

[0023] The third feature As a high-level feature and a second feature Perform feature fusion enhancement to obtain the second enhanced feature The specific steps are as follows: In the adaptive low-pass filter generator, the second feature After the convolution operation is performed on the convolution layer, the features after convolution in the adaptive low-pass filter generator are obtained. , the features after convolution A depth-wise separable inverse convolution operation is performed through a depth-wise separable convolution layer to generate a feature map group, which is then reshaped and normalized to obtain a low-pass filter kernel. ; The third feature With the generated low-pass filter kernel Perform convolution operation to obtain intermediate features , intermediate features After the depth-separable convolution operation, the enhanced third feature is obtained ; In the adaptive high-pass filter generator, the second feature After the convolution operation is performed on the convolution layer, the features after convolution in the adaptive high-pass filter generator are obtained. , the second feature after convolution After reshaping and normalizing the layer, the low-pass filter kernel in the adaptive high-pass filter generator is obtained , low-pass filter kernel After the unit kernel subtraction layer, the unit kernel E is used for subtraction operation to obtain the anti-kernel, and then the high-pass filter kernel is obtained. , the weight of the unit core E is [[0,0,0], [0,1,0], [0,0,0]]; the second feature With the generated high-pass filter kernel Perform convolution operation and then residual operation to obtain the enhanced second feature ; The enhanced third feature and the enhanced second feature Fusion is performed to obtain the second enhanced feature Similarly, the second enhancement feature As an advanced feature and a first feature Perform feature fusion enhancement to obtain the first enhanced feature ;

[0024] The third enhanced feature The third feature without any treatment .

[0025] Furthermore, in the text branch of step S2, the training set is passed through the rich text generation module to obtain a rich text representation, and the rich text representation is input into the language model to generate text features, specifically:

[0026] In the rich text generation module, the positioning target center of the prohibited item category in each image in the training set is extracted, and the position of the prohibited item in the entire image is indicated by words with directional expressions, including upper left, upper middle, upper right, middle left, middle, middle right, lower left, lower middle, and lower right; the rich text of the prohibited items in each image is generated through the prescribed sentence template format, and the rich text representation is obtained according to the feature description of the prohibited items in each image and the sentence template filled with category and location information. T ; Rich text representation T Input into the pre-trained RoBERTa model to generate text features W, the formula is as follows:

[0027] ,

[0028] in, Indicates A rich text representation, Indicates the RoBERTa language model input i Rich text representation Generated text features, represents the pre-trained RoBERTa language model, express The number of nouns, Represents the embedding dimension.

[0029] Furthermore, the Neck layer in step S2 includes an upsampling layer, a downsampling layer and a T-CSPLayer module; the first enhanced feature , the second enhanced feature , the third enhanced feature And the text feature W is input into the Neck layer for fusion to obtain the first fusion feature , the second fusion feature , the third fusion feature , the process is as follows:

[0030] The third enhancement feature Perform a 2x upsampling operation, The upsampled features and the second enhanced features Perform splicing in the channel dimension to obtain the first splicing feature , the first splicing feature The text feature W is fused through the T-CSPLayer module to obtain the fused feature , the formula is as follows:

[0031] ,

[0032] in, represents the Sigmoid function, Represents the text feature vectors, max means finding the maximum value; for fusion features Perform a 2x upsampling operation, Upsampled features and first enhanced features Perform splicing in the channel dimension to obtain the second splicing feature , the second splicing feature The text feature W is fused through the T-CSPLayer module to obtain the first fusion feature ;

[0033] For the first fusion feature Perform downsampling operation, Downsampled features and fused features Splicing is performed on the channel dimension to obtain the third splicing feature , the third splicing feature The text feature W is fused through the T-CSPLayer module to obtain the second fusion feature ;

[0034] For the second fusion feature Perform downsampling operation, Downsampled features and third enhanced features Splicing is performed on the channel dimension to obtain the fourth splicing feature , the fourth splicing feature The text feature W is fused through the T-CSPLayer module to obtain the third fusion feature .

[0035] Furthermore, the Head in step S2 includes a text comparison head and a bounding box detection;

[0036] The first fusion feature , the second fusion feature and the third fusion feature Input into the bounding box detection to perform bounding box prediction and obtain the bounding box prediction result; the first fusion feature , the second fusion feature , the third fusion feature And text features Input the text into the text comparison head to calculate the text similarity and obtain the similarity result. The text category with the highest similarity result is the detection category corresponding to the bounding box, and then the contraband detection result is obtained. The formula is as follows:

[0037] ,

[0038] in, represents normalization processing, Indicates that the fused features are convolved to obtain the image feature embedding vector , Indicates the number of targets, represents a learnable scaling factor used to adjust the scale of the score, Represents a zero-initialized learnable offset.

[0039] Furthermore, step S3 is specifically as follows:

[0040] The loss function includes the regional text contrast loss and bounding box regression loss; the bounding box regression loss includes IoU loss and distribution focal loss , the regional text contrast loss , IoU loss and distribution focal loss Combine them to get the overall training loss function, which is expressed as follows:

[0041] ,

[0042] in, Represents the weight factor.

[0043] The advantages of the present invention are:

[0044] The present invention can better capture and express the detailed information in the image through joint training of image and text, and is more efficient while maintaining performance in real-time monitoring tasks, reducing the amount of calculation and memory usage. It solves the problem of blurred image boundary details in complex scenes. In addition, in addition to the basic category set of the training model, the model is more generalized and robust when detecting new contraband objects; it achieves excellent results in the relevant X-ray contraband data set, with higher recognition performance and stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.

[0046] Figure 1 is a flow chart of the steps of the method of the present invention;

[0047] Figure 2 The model architecture of the adaptive high-pass and low-pass filter module in the method of the present invention;

[0048] Figure 3 The adaptive low-pass filter generator model architecture in the adaptive high- and low-pass filter module of the method of the present invention;

[0049] Figure 4 The adaptive high-pass filter generator model architecture in the adaptive high- and low-pass filter module of the method of the present invention;

[0050] Figure 5 This is a visualization result diagram of the method of the present invention in the experiment. DETAILED DESCRIPTION

[0051] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] Example 1

[0053] In this embodiment, Figure 1 As shown, the present invention provides a method for detecting contraband in X-ray images based on multi-scale feature fusion, and the specific steps include:

[0054] S1. Obtain the X-ray contraband dataset and divide it into a training set and a test set.

[0055] Specifically, obtain an X-ray contraband dataset with N data images , each picture The composition is as follows:

[0056] ,

[0057] ,

[0058] in, Indicates the number of images, Represents a vector that matches the number of categories in the dataset, index represents the specified class that appears in the dataset, =1 means the category appears in middle, =0 means not present middle, Represents the semi-transparent sub-images corresponding to different categories in the image, Target object categories considered as total contraband, Represents all objects in the image that are not related to contraband, called background classes. , Indicates the number of categories in the data set; Representing images Whether the prohibited object category exists, 1 means it exists, and 0 means it does not exist; Indicates the total prohibited items category Individual contraband target object categories in ; Representing images Individual contraband target object categories in ; Represents the total background class A single background class in ; Representing images A single background category in .

[0059] S2. Construct an X-ray image contraband target detection model based on multi-scale feature fusion, the model includes an image branch, an adaptive high-pass and low-pass filter module, a text branch, a Neck layer and a Head; the X-ray images in the training set are input into the model to train the model.

[0060] Specifically, in the image branch, an improved YOLOv8 backbone network is used to extract features to obtain multi-scale features:

[0061] The improved YOLOv8 backbone network adopts the C3k2 structure of YOLO11 to replace the C2f structure, and adds the C2PSA module of YOLO11 after the last layer of SPPF module in the backbone network; replaces the C3k convolution operation in the C3k2 structure with a deformable convolution, and the deformable convolution is a deformable convolution network DCN; the X-ray image in the training set is input into the improved YOLOv8 backbone network for feature extraction, and the first feature , Second feature and the third feature .

[0062] Specifically, the adaptive high-pass and low-pass filter module includes an adaptive low-pass filter generator and an adaptive high-pass filter generator; the adaptive low-pass filter generator includes a convolution layer, a depth-separable convolution layer, and a reshaping and normalization layer; the adaptive high-pass filter generator includes a convolution layer, a reshaping and normalization layer, and a unit kernel subtraction layer;

[0063] The first feature , Second feature and the third feature After the adaptive high-pass and low-pass filter modules are used for feature fusion enhancement, the first enhanced feature is obtained. , the second enhanced feature And the third enhancement feature , the specific process is:

[0064] The third feature As a high-level feature and a second feature Perform feature fusion enhancement to obtain the second enhanced feature The specific steps are as follows: In the adaptive low-pass filter generator, the second feature After the convolution operation is performed on the convolution layer, the features after convolution in the adaptive low-pass filter generator are obtained. , the features after convolution A depth-wise separable inverse convolution operation is performed through a depth-wise separable convolution layer to generate a feature map group, which is then reshaped and normalized to obtain a low-pass filter kernel. ; The third feature With the generated low-pass filter kernel Perform convolution operation to obtain intermediate features , intermediate features After the depth-separable convolution operation, the enhanced third feature is obtained ; In the adaptive high-pass filter generator, the second feature After the convolution operation is performed on the convolution layer, the features after convolution in the adaptive high-pass filter generator are obtained. , the second feature after convolution After reshaping and normalizing the layer, the low-pass filter kernel in the adaptive high-pass filter generator is obtained , low-pass filter kernel After the unit kernel subtraction layer, the unit kernel E is used for subtraction operation to obtain the anti-kernel, and then the high-pass filter kernel is obtained. , the weight of the unit core E is [[0,0,0], [0,1,0], [0,0,0]]; the second feature With the generated high-pass filter kernel Perform convolution operation and then residual operation to obtain the enhanced second feature ; The enhanced third feature and the enhanced second feature Fusion is performed to obtain the second enhanced feature Similarly, the second enhancement feature As an advanced feature and a first feature Perform feature fusion enhancement to obtain the first enhanced feature .

[0065] The third enhanced feature The third feature without any treatment .

[0066] Specifically, in the text branch, the training set is passed through the rich text generation module to obtain a rich text representation, which is then input into the language model to generate text features:

[0067] In the rich text generation module, the positioning target center of the prohibited item category in each image in the training set is extracted, and the position of the prohibited item in the entire image is indicated by words with directional expressions, including upper left, upper middle, upper right, middle left, middle, middle right, lower left, lower middle, and lower right; the rich text of the prohibited items in each image is generated through the prescribed sentence template format, and the rich text representation is obtained according to the feature description of the prohibited items in each image and the sentence template filled with category and location information. T ; Rich text representation T Input into the pre-trained RoBERTa model to generate text features W, the formula is as follows:

[0068] ,

[0069] in, Indicates A rich text representation, Indicates the RoBERTa language model input i Rich text representation Generated text features, represents the pre-trained RoBERTa language model, express The number of nouns, Represents the embedding dimension.

[0070] Specifically, the Neck layer includes an upsampling layer, a downsampling layer and a T-CSPLayer module; the first enhanced feature , the second enhanced feature , the third enhanced feature And the text feature W is input into the Neck layer for fusion to obtain the first fusion feature , the second fusion feature , the third fusion feature , the process is as follows:

[0071] The third enhancement feature Perform a 2x upsampling operation, The upsampled features and the second enhanced features Perform splicing in the channel dimension to obtain the first splicing feature , the first splicing feature The text feature W is fused through the T-CSPLayer module to obtain the fused feature , the formula is as follows:

[0072] ,

[0073] in, represents the Sigmoid function, Represents the text feature vectors, max means finding the maximum value; for fusion features Perform a 2x upsampling operation, Upsampled features and first enhanced features Perform splicing in the channel dimension to obtain the second splicing feature , the second splicing feature The text feature W is fused through the T-CSPLayer module to obtain the first fusion feature .

[0074] For the first fusion feature Perform downsampling operation, Downsampled features and fused features Splicing is performed on the channel dimension to obtain the third splicing feature , the third splicing feature The text feature W is fused through the T-CSPLayer module to obtain the second fusion feature .

[0075] For the second fusion feature Perform downsampling operation, Downsampled features and third enhanced features Splicing is performed on the channel dimension to obtain the fourth splicing feature , the fourth splicing feature The text feature W is fused through the T-CSPLayer module to obtain the third fusion feature .

[0076] Specifically, the Head includes a text comparison header and a bounding box detection:

[0077] The first fusion feature , the second fusion feature and the third fusion feature Input into the bounding box detection to perform bounding box prediction and obtain the bounding box prediction result; the first fusion feature , the second fusion feature , the third fusion feature And text features Input the text into the text comparison head to calculate the text similarity and obtain the similarity result. The text category with the highest similarity result is the detection category corresponding to the bounding box, and then the contraband detection result is obtained. The formula is as follows:

[0078] ,

[0079] in, represents normalization processing, Indicates that the fused features are convolved to obtain the image feature embedding vector , Indicates the number of targets, represents a learnable scaling factor used to adjust the scale of the score, Represents a zero-initialized learnable offset.

[0080] S3. Use the loss function to optimize the model and obtain a trained model.

[0081] Specifically, the classification score, bounding box prediction, bounding box distribution prediction and true label predicted by the model are matched, and then the classification loss, bounding box regression loss and distribution regression loss are calculated based on the matching results. The loss function includes regional text contrast loss and bounding box regression loss; the bounding box regression loss includes IoU loss and distribution focal loss , the regional text contrast loss , IoU loss and distribution focal loss Combine them to get the overall training loss function, which is expressed as follows:

[0082] ,

[0083] in, Represents the weight factor.

[0084] S4. The X-ray images in the test set are input into the trained model to obtain the contraband detection results.

[0085] Example 2

[0086] The present invention uses the PIXray dataset, which contains 8885 images of various contraband categories, of which the training set is 7109. The proposed X-ray image contraband detection method based on multi-scale feature fusion is evaluated on the dataset.

[0087] Table 1 Comparison of the performance of the SOTA method and the proposed method on the PIXray dataset

[0088]

[0089] The SOTA method for this dataset refers to the foreground-background specific feature learning framework ForkNet proposed by Tong Jia et al. in 2024, which is used to solve the overlap and occlusion problems of X-ray images. As can be seen from Table 1, the method of the present invention is superior to the initial architecture method in the dataset evaluation. The average detection accuracy of the method of the present invention is significantly higher than that of the SOTA. The experimental results show that the method of the present invention has a good detection effect, and the extracted features have strong discrimination and generalization capabilities.

[0090] Figure 5 This is a display diagram of the results obtained by the method of the present invention. An input image is subjected to the method of the present invention to obtain a predicted result diagram. From the predicted result diagram obtained by the method of the present invention, it can be seen that the method of the present invention can detect contraband very well, and there is not much difference from the real image. This proves that the method of the present invention can achieve the expected effect.

[0091] Finally, it should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein by equivalents. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for detecting contraband in X-ray images based on multi-scale feature fusion, characterized in that: The following steps are involved: S1. Obtain a data set of X-ray contraband items, and divide the data set into a training set and a test set; S2. Construct an X-ray image contraband target detection model based on multi-scale feature fusion, the model includes an image branch, an adaptive high-pass and low-pass filter module, a text branch, a Neck layer and a Head; X-ray images in the training set are input into the model to train the model; The X-ray image in the training set is input into the image branch for feature extraction to obtain the first feature , Second feature and the third feature The first feature , Second feature and the third feature After the adaptive high-pass and low-pass filter modules are used for feature fusion enhancement, the first enhanced feature is obtained. , the second enhanced feature And the third enhancement feature ; In the text branch, the training set is passed through the rich text generation module to obtain a rich text representation, and the rich text representation is input into the language model to generate text features, specifically: in the rich text generation module, the positioning target center of the prohibited item category of each image in the training set is extracted, and words with directional expressions are used to represent the position of the prohibited items in the entire image. The directional expressions include upper left, upper middle, upper right, middle left, middle, middle right, lower left, lower middle, and lower right; the rich text of the prohibited items in each image is generated through a prescribed sentence template format, and the rich text representation is obtained according to the feature description of the prohibited items in each image and the sentence template filled with category and location information. T ; Rich text representation T Input into the pre-trained RoBERTa model to generate text features W, the formula is as follows: , in, Indicates A rich text representation, Indicates the RoBERTa language model input i Rich text representation Generated text features, represents the pre-trained RoBERTa language model, express The number of nouns, represents the embedding dimension; The Neck layer includes an upsampling layer, a downsampling layer and a T-CSPLayer module; the first enhanced feature , the second enhanced feature , the third enhanced feature And the text feature W is input into the Neck layer for fusion to obtain the first fusion feature , the second fusion feature , the third fusion feature , the process is as follows: The third enhancement feature Perform a 2x upsampling operation, The upsampled features and the second enhanced features Perform splicing in the channel dimension to obtain the first splicing feature , the first splicing feature The text feature W is fused through the T-CSPLayer module to obtain the fused feature , the formula is as follows: , in, represents the Sigmoid function, Represents the text feature vectors, max means finding the maximum value; for fusion features Perform a 2x upsampling operation, Upsampled features and first enhanced features Perform splicing in the channel dimension to obtain the second splicing feature , the second splicing feature The text feature W is fused through the T-CSPLayer module to obtain the first fusion feature ; For the first fusion feature Perform downsampling operation, Downsampled features and fused features Splicing is performed on the channel dimension to obtain the third splicing feature , the third splicing feature The text feature W is fused through the T-CSPLayer module to obtain the second fusion feature ; For the second fusion feature Perform downsampling operation, Downsampled features and third enhanced features Splicing is performed on the channel dimension to obtain the fourth splicing feature , the fourth splicing feature The text feature W is fused through the T-CSPLayer module to obtain the third fusion feature ; The Head includes a text comparison head and a bounding box detection; the first fusion feature , the second fusion feature and the third fusion feature Input into the bounding box detection to perform bounding box prediction and obtain the bounding box prediction result; the first fusion feature , the second fusion feature , the third fusion feature And text features Input to the text comparison head to calculate the text similarity and obtain the similarity result. The text category with the highest similarity result is the detection category corresponding to the bounding box, and then the contraband detection result is obtained. , the formula is as follows: , in, represents normalization processing, Indicates that the fused features are convolved to obtain the image feature embedding vector , Indicates the number of targets, represents a learnable scaling factor used to adjust the scale of the score, represents the zero-initialized learnable offset; S3. Use the loss function to optimize the model and obtain a trained model; S4. The X-ray images in the test set are input into the trained model to obtain the contraband detection results.

2. The X-ray image contraband detection method based on multi-scale feature fusion according to claim 1 is characterized in that: Step S1 includes: Get an X-ray contraband dataset with N data images , each picture The composition is as follows: , , in, Indicates the number of images, Represents a vector that matches the number of categories in the dataset, index represents the specified class that appears in the dataset, =1 means the category appears in middle, =0 means not present middle, Represents the semi-transparent sub-images corresponding to different categories in the image, Target object categories considered as total contraband, Represents all objects in the image that are not related to contraband, called background classes. , Indicates the number of categories in the data set; Representing images Whether the prohibited object category exists, 1 means it exists, and 0 means it does not exist; Indicates the total prohibited items category Individual contraband target object categories in ; Representing images Individual contraband target object categories in ; Represents the total background class A single background class in ; Representing images A single background category in .

3. The X-ray image contraband detection method based on multi-scale feature fusion according to claim 1 is characterized in that: Step S2, in the image branch, the training set X-ray images are input into the improved YOLOv8 backbone network for feature extraction to obtain multi-scale features, specifically: The improved YOLOv8 backbone network adopts the C3k2 structure of YOLO11 to replace the C2f structure, and adds the C2PSA module of YOLO11 after the last layer of SPPF module of the backbone network; replaces the C3k convolution operation in the C3k2 structure with a deformable convolution, and the deformable convolution is a deformable convolution network DCN; The X-ray images in the training set are input into the improved YOLOv8 backbone network for feature extraction to obtain the first feature , Second feature and the third feature .

4. The X-ray image contraband detection method based on multi-scale feature fusion according to claim 3 is characterized in that: Step S2: The adaptive high-pass and low-pass filter modules are specifically: The adaptive high-pass and low-pass filter module includes an adaptive low-pass filter generator and an adaptive high-pass filter generator; the adaptive low-pass filter generator includes a convolution layer, a depth-separable convolution layer, and a reshaping and normalization layer; the adaptive high-pass filter generator includes a convolution layer, a reshaping and normalization layer, and a unit kernel subtraction layer; The first feature , Second feature and the third feature After the adaptive high-pass and low-pass filter modules are used for feature fusion enhancement, the first enhanced feature is obtained. , the second enhanced feature And the third enhancement feature , the specific process is: The third feature As a high-level feature and a second feature Perform feature fusion enhancement to obtain the second enhanced feature The specific steps are as follows: In the adaptive low-pass filter generator, the second feature After the convolution operation is performed on the convolution layer, the features after convolution in the adaptive low-pass filter generator are obtained. , the features after convolution A depth-wise separable inverse convolution operation is performed through a depth-wise separable convolution layer to generate a feature map group, which is then reshaped and normalized to obtain a low-pass filter kernel. ; The third characteristic With the generated low-pass filter kernel Perform convolution operation to obtain intermediate features , intermediate features After the depth-separable convolution operation, the enhanced third feature is obtained ; In the adaptive high-pass filter generator, the second feature After the convolution operation is performed on the convolution layer, the features after convolution in the adaptive high-pass filter generator are obtained. , the second feature after convolution After reshaping and normalizing the layer, the low-pass filter kernel in the adaptive high-pass filter generator is obtained , low-pass filter kernel After the unit kernel subtraction layer, the unit kernel E is used for subtraction operation to obtain the anti-kernel, and then the high-pass filter kernel is obtained. , the weights of the unit core E are [[0,0,0], [0,1,0], [0,0,0]]; Second feature With the generated high-pass filter kernel Perform convolution operation and then residual operation to obtain the enhanced second feature ; The enhanced third feature and the enhanced second feature Fusion is performed to obtain the second enhanced feature ; Similarly, the second enhancement feature As an advanced feature and a first feature Perform feature fusion enhancement to obtain the first enhanced feature ; The third enhanced feature The third feature without any treatment .

5. The X-ray image contraband detection method based on multi-scale feature fusion according to claim 4 is characterized in that: Step S3 is specifically as follows: The loss function includes the regional text contrast loss and bounding box regression loss; the bounding box regression loss includes IoU loss and distribution focal loss , the regional text contrast loss , IoU loss and distribution focal loss Combine them to get the overall training loss function, which is expressed as follows: , in, Represents the weight factor.

Citation Information

Patent Citations

  • X-ray image contraband detection method

    CN117058606A

  • Image and delivery information fusion multi-mode contraband parcel detection method

    CN118397552A