An interactive x-ray security inspection method and system based on improved YOLOv11

CN122551076APending Publication Date: 2026-08-11BELTECNO CORP
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-09
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0005]基于此,本发明的目的是提供一种基于改进YOLOv11的可交互X光安检方法及系统,以解决现有技术在特征提取与多尺度融合层面,普遍存在跨尺度特征融合信息流失严重的技术瓶颈,导致降低了安检效率的问题

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122551076A_ABST
    Figure CN122551076A_ABST
Patent Text Reader

Abstract

This invention provides an interactive X-ray security inspection method and system based on an improved YOLOv11. The method includes: partitioning a pre-defined dataset to generate corresponding training, validation, and test sets; improving the YOLOv11 basic network architecture to generate a corresponding object detection network; iteratively training and tuning the object detection network using the training and validation sets to save the optimal model parameters after convergence, and evaluating the network's performance using the test set; deploying the trained object detection network to an X-ray security inspection system to perform real-time inference detection on input real-time images, video streams, or camera capture streams, outputting the corresponding contraband bounding box coordinates, category labels, and confidence scores, and completing visualization and exporting early warning statistics. This invention can significantly improve the efficiency of X-ray security inspections.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of security inspection technology, and in particular to an interactive X-ray security inspection method and system based on an improved YOLOv11. Background Technology

[0002] With the continuous improvement of public security and prevention systems, X-ray security inspection equipment has become a core security facility in densely populated places such as subways, airports, and rail transit hubs. Deep learning-based intelligent detection technology for contraband is a core technological path to improve security inspection efficiency and reduce manual miss rates. However, existing intelligent detection models often focus on isolated improvements targeting single imaging defects, or only on lightweight model compression, or only on feature enhancement for small targets, without fully considering the complexities of real-world security inspection scenarios. In actual X-ray package imaging, three core imaging defects typically occur simultaneously: strong background noise interference, sparse features of small contraband targets, and mutual occlusion by high-density objects. Existing decentralized improvement strategies cannot achieve synergistic optimization effects, and feature transfer between different functional modules easily leads to mutual constraints. This results in insufficient global adversarial capability of the model under complex imaging conditions, poor stability of detection accuracy in real-world scenarios, and difficulty in consistently meeting the high standards of security and prevention.

[0003] In terms of feature extraction and multi-scale fusion, traditional feature pyramid networks and their derivatives generally suffer from severe technical bottlenecks due to significant information loss during cross-scale feature fusion. These networks achieve multi-scale feature transfer through bidirectional paths (top-down and bottom-up), relying on feature addition or concatenation operations to fuse features at different levels, lacking a reversible bidirectional auxiliary supervision mechanism throughout the process. When faced with heavily layered and occluded contraband targets within packages, the high-level semantic information output by deep networks and the low-level spatial geometric information output by shallow networks are continuously lost during layer-by-layer transmission. Key contour details and weak features of the target are easily obscured by background noise, ultimately leading to a high proportion of catastrophic missed detections, making them unsuitable for the precise screening of contraband in high-density, complex packages.

[0004] Furthermore, existing detection solutions generally struggle to balance improved detection accuracy with increased computational resource consumption. In pursuit of higher contraband recognition rates, some solutions blindly introduce large attention mechanism modules with massive parameter counts or design bloated, ultra-deep detection heads, causing an exponential increase in the overall model parameter count and floating-point computational load. However, security checkpoints in real-world applications such as subways and airports are often resource-constrained embedded edge devices with stringent requirements on model size, inference latency, and real-time throughput. The aforementioned high-precision but computationally expensive solutions cannot meet the hardware requirements for edge deployment, hindering large-scale industrial implementation and application. Summary of the Invention

[0005] Based on this, the purpose of this invention is to provide an interactive X-ray security inspection method and system based on improved YOLOv11, in order to solve the technical bottleneck of severe information loss in cross-scale feature fusion in the feature extraction and multi-scale fusion aspects of existing technologies, which leads to reduced security inspection efficiency.

[0006] The first aspect of the present invention proposes: An interactive X-ray security inspection method based on an improved YOLOv11, wherein the method includes: The preset dataset is divided into training, validation and test sets. The YOLOv11 basic network architecture is improved to generate a corresponding object detection network. The improvement process includes embedding an ECA lightweight attention mechanism module in the feature extraction stage of the backbone network and replacing the original feature pyramid structure of the neck network with an auxiliary reversible bidirectional feature pyramid network ARBFPN. The target detection network is iteratively trained using the training set, and the parameters are tuned during the training process using the validation set to save the optimal model parameters after convergence. The performance of the detection network is evaluated and verified using the test set. The trained target detection network is deployed to the X-ray security inspection and recognition system to perform real-time inference detection on the input real-time images, video streams, or camera capture streams, so as to output the corresponding bounding box coordinates, category labels, and confidence scores of contraband items, and complete the visualization display and export of early warning statistics.

[0007] The beneficial effects of this invention are as follows: This solution constructs a complete data system for training, validation, and testing by standardizing the pre-defined dataset, providing a reliable data foundation for model training and performance validation, and ensuring the model's generalization ability and detection stability. Embedding the ECA lightweight attention mechanism in the YOLOv11 backbone network strengthens the extraction weights of key features of contraband while controlling the number of parameters and computational overhead, suppressing background redundancy interference, and improving feature representation accuracy. Replacing the original feature pyramid structure of the neck area with an auxiliary reversible bidirectional feature pyramid network (ARBFPN) effectively alleviates the technical bottleneck of information loss in cross-scale feature fusion through the auxiliary reversible bidirectional fusion mechanism, achieving efficient complementarity and reuse of multi-scale features, and improving the recognition recall rate of small-target contraband. After iterative training, optimization, and testing evaluation, it is deployed to an X-ray security inspection system, accurately outputting the bounding box coordinates, category labels, and confidence scores of contraband, while also providing visualization and early warning statistical information export capabilities, effectively improving the detection accuracy and overall recognition efficiency of X-ray security inspections, and reducing the probability of missed and false detections.

[0008] Furthermore, the step of embedding the ECA lightweight attention mechanism module in the feature extraction stage of the backbone network includes: The input feature map of the backbone network convolution output is subjected to global spatial information aggregation processing. The spatial two-dimensional features of each channel are compressed into scalars through channel-level global average pooling to generate the corresponding global channel descriptor vector. The interaction kernel size is adaptively calculated based on the channel dimension of the feature map. The local interaction kernel size of the one-dimensional convolution is dynamically determined through the channel number mapping function to adapt to the channel scale of different network layers. The global channel descriptor vector is subjected to local cross-channel interaction processing without dimensionality reduction. The dependencies between adjacent channels are captured by one-dimensional convolution with kernel size matching in order to generate the corresponding nonlinear channel attention weight components. The channel attention weights are weighted sequentially with the original input feature map to achieve dynamic recalibration of the channel-level features, thereby outputting the enhanced feature map and passing it to the next layer of the network.

[0009] Furthermore, the step of adaptively calculating the interaction kernel size based on the channel dimension of the feature map and generating nonlinear channel attention weight components includes: The number of channels C of the input feature map is extracted, and the local interaction kernel size k is calculated through an adaptive mapping function. The mapping function calculates the base value based on the logarithmic transformation of the number of channels, and takes the odd number closest to the base value as the kernel size. Construct a local channel set containing the current channel and its k neighboring channels. Calculate the descriptors in the local channel set by weighting them with k learnable parameters shared within the one-dimensional convolutional kernel, and output the attention weight values ​​of the corresponding channels through the Sigmoid activation function. The above weighted calculation is performed sequentially on all channels to form complete channel attention weight components.

[0010] Furthermore, the step of replacing the original feature pyramid structure of the neck network with an auxiliary reversible bidirectional feature pyramid network (ARBFPN) includes: Receive a multi-scale feature map set output by the backbone network after enhancement by the ECA module. The multi-scale feature map set includes shallow feature P3, mid-level feature P4 and deep feature P5. A parallel coupled invertible function mapping channel is established between feature levels of adjacent scales to perform bidirectional invertible fusion processing on cross-scale features, so as to generate intermediate fused features that take into account both spatial details and semantic information. A parallel auxiliary training branch is set up next to the main interaction channel to supervise and refine the intermediate fusion features, and secondary detail optimization of the fusion features is completed through residual convolutional blocks to generate the final multi-scale fusion feature map and send it to the detection head.

[0011] Furthermore, the step of establishing parallel-coupled invertible function mapping channels between feature levels of adjacent scales to perform bidirectional invertible fusion processing of cross-scale features includes: For adjacent low-level and high-level features, the low-level features are compressed in resolution and matched in channel dimension by the residual convolution downsampling mapping function. The extracted contour features are then superimposed on the high-level features to generate high-level intermediate fusion features that preserve edge texture. The updated high-level intermediate fusion features are restored in resolution and adapted to channels by using an upsampling mapping function. Semantic information is then superimposed onto low-level features to generate low-level enhanced features that take into account both global semantics and positioning accuracy. By leveraging the invertible mapping relationship between the downsampling mapping function and the upsampling mapping function, information conservation is achieved during cross-scale feature transmission, supporting lossless reverse reconstruction of the original input features.

[0012] Furthermore, the steps of iteratively training the target detection network using the training set and fine-tuning the parameters of the training process using the validation set include: The X-ray security inspection images in the training set are preprocessed and data augmented to generate standardized training samples and correspondingly labeled with the category and location of contraband. Load the initialization parameters of the target detection network, set the training hyperparameters and perform multiple rounds of iterative training, and monitor the model convergence status in real time through the validation set; During training, the auxiliary loss is calculated synchronously through the auxiliary training branch of ARBFPN, and the backpropagation update of the network parameters is completed in combination with the main detection loss function to obtain the optimal model parameters after convergence.

[0013] Furthermore, the steps of performing real-time inference detection on the input real-time images, video streams, or camera capture streams, and completing the visualization display and export of early warning statistical information include: Load the optimal model parameters into the preset X-ray security inspection and recognition system, and connect to the image, video stream or camera acquisition channel to obtain real-time security inspection images; The detection network is invoked to perform inference calculations on the real-time security inspection images, and the bounding box coordinates, category labels and confidence scores of each prohibited item target are output. The test results are dynamically plotted on the system's visualization window, and the types and quantities of prohibited items detected in the current time period are statistically analyzed. The corresponding early warning statistical information files are automatically generated and exported.

[0014] The second aspect of the present invention proposes: An interactive X-ray security inspection system based on an improved YOLOv11, wherein the system includes: The processing module is used to divide the preset dataset to generate corresponding training, validation and test sets; The building module is used to improve the YOLOv11 basic network architecture to generate the corresponding object detection network. The improvement process includes embedding the ECA lightweight attention mechanism module in the feature extraction stage of the backbone network and replacing the original feature pyramid structure of the neck network with the auxiliary reversible bidirectional feature pyramid network ARBFPN. The evaluation module is used to iteratively train the target detection network using the training set, fine-tune the parameters of the training process using the validation set to save the optimal model parameters after convergence, and evaluate and verify the performance of the detection network using the test set. The detection module is used to deploy the trained target detection network to the X-ray security inspection and recognition system. It performs real-time inference detection on the input real-time images, video streams, or camera capture streams to output the corresponding bounding box coordinates, category labels, and confidence scores of contraband items, and completes the visualization display and export of early warning statistics.

[0015] Furthermore, the step of embedding the ECA lightweight attention mechanism module in the feature extraction stage of the backbone network includes: The input feature map of the backbone network convolution output is subjected to global spatial information aggregation processing. The spatial two-dimensional features of each channel are compressed into scalars through channel-level global average pooling to generate the corresponding global channel descriptor vector. The interaction kernel size is adaptively calculated based on the channel dimension of the feature map. The local interaction kernel size of the one-dimensional convolution is dynamically determined through the channel number mapping function to adapt to the channel scale of different network layers. The global channel descriptor vector is subjected to local cross-channel interaction processing without dimensionality reduction. The dependencies between adjacent channels are captured by one-dimensional convolution with kernel size matching in order to generate the corresponding nonlinear channel attention weight components. The channel attention weights are weighted sequentially with the original input feature map to achieve dynamic recalibration of the channel-level features, thereby outputting the enhanced feature map and passing it to the next layer of the network.

[0016] Furthermore, the step of adaptively calculating the interaction kernel size based on the channel dimension of the feature map and generating nonlinear channel attention weight components includes: The number of channels C of the input feature map is extracted, and the local interaction kernel size k is calculated through an adaptive mapping function. The mapping function calculates the base value based on the logarithmic transformation of the number of channels, and takes the odd number closest to the base value as the kernel size. Construct a local channel set containing the current channel and its k neighboring channels. Calculate the descriptors in the local channel set by weighting them with k learnable parameters shared within the one-dimensional convolutional kernel, and output the attention weight values ​​of the corresponding channels through the Sigmoid activation function. The above weighted calculation is performed sequentially on all channels to form complete channel attention weight components.

[0017] Furthermore, the step of replacing the original feature pyramid structure of the neck network with an auxiliary reversible bidirectional feature pyramid network (ARBFPN) includes: Receive a multi-scale feature map set output by the backbone network after enhancement by the ECA module. The multi-scale feature map set includes shallow feature P3, mid-level feature P4 and deep feature P5. A parallel coupled invertible function mapping channel is established between feature levels of adjacent scales to perform bidirectional invertible fusion processing on cross-scale features, so as to generate intermediate fused features that take into account both spatial details and semantic information. A parallel auxiliary training branch is set up next to the main interaction channel to supervise and refine the intermediate fusion features, and secondary detail optimization of the fusion features is completed through residual convolutional blocks to generate the final multi-scale fusion feature map and send it to the detection head.

[0018] Furthermore, the step of establishing parallel-coupled invertible function mapping channels between feature levels of adjacent scales to perform bidirectional invertible fusion processing of cross-scale features includes: For adjacent low-level and high-level features, the low-level features are compressed in resolution and matched in channel dimension by the residual convolution downsampling mapping function. The extracted contour features are then superimposed on the high-level features to generate high-level intermediate fusion features that preserve edge texture. The updated high-level intermediate fusion features are restored in resolution and adapted to channels by using an upsampling mapping function. Semantic information is then superimposed onto low-level features to generate low-level enhanced features that take into account both global semantics and positioning accuracy. By leveraging the invertible mapping relationship between the downsampling mapping function and the upsampling mapping function, information conservation is achieved during cross-scale feature transmission, supporting lossless reverse reconstruction of the original input features.

[0019] Furthermore, the steps of iteratively training the target detection network using the training set and fine-tuning the parameters of the training process using the validation set include: The X-ray security inspection images in the training set are preprocessed and data augmented to generate standardized training samples and correspondingly labeled with the category and location of contraband. Load the initialization parameters of the target detection network, set the training hyperparameters and perform multiple rounds of iterative training, and monitor the model convergence status in real time through the validation set; During training, the auxiliary loss is calculated synchronously through the auxiliary training branch of ARBFPN, and the backpropagation update of the network parameters is completed in combination with the main detection loss function to obtain the optimal model parameters after convergence.

[0020] Furthermore, the steps of performing real-time inference detection on the input real-time images, video streams, or camera capture streams, and completing the visualization display and export of early warning statistical information include: Load the optimal model parameters into the preset X-ray security inspection and recognition system, and connect to the image, video stream or camera acquisition channel to obtain real-time security inspection images; The detection network is invoked to perform inference calculations on the real-time security inspection images, and the bounding box coordinates, category labels and confidence scores of each prohibited item target are output. The test results are dynamically plotted on the system's visualization window, and the types and quantities of prohibited items detected in the current time period are statistically analyzed. The corresponding early warning statistical information files are automatically generated and exported.

[0021] The third aspect of the present invention proposes: A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the interactive X-ray security inspection method based on the improved YOLOv11 as described above.

[0022] The fourth aspect of the present invention proposes: A readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the interactive X-ray security inspection method based on the improved YOLOv11 as described above.

[0023] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0024] Figure 1 A flowchart of an interactive X-ray security inspection method based on an improved YOLOv11 provided in the first embodiment of the present invention; Figure 2 A schematic diagram of the network framework in the interactive X-ray security inspection method based on the improved YOLOv11 provided in the second embodiment of the present invention; Figure 3 A schematic diagram of comparative experimental results in the interactive X-ray security inspection method based on the improved YOLOv11 provided in the second embodiment of the present invention; Figure 4 The structural block diagram of the interactive X-ray security inspection system based on the improved YOLOv11 provided in the third embodiment of the present invention.

[0025] The following detailed description, in conjunction with the accompanying drawings, will further illustrate the present invention. Detailed Implementation

[0026] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Several embodiments of the invention are illustrated in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.

[0027] It should be noted that when a component is said to be "fixed to" another component, it can be directly on the other component or there may be an intervening component. When a component is said to be "connected to" another component, it can be directly connected to the other component or there may be an intervening component. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.

[0028] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.

[0029] Please see Figure 1 The figure shows the interactive X-ray security inspection method based on improved YOLOv11 provided in the first embodiment of the present invention. The interactive X-ray security inspection method based on improved YOLOv11 provided in this embodiment can accurately output the bounding box coordinates, category labels and confidence scores of contraband items, and has the ability to visualize and export early warning statistical information. It can effectively improve the detection accuracy and overall recognition efficiency of X-ray security inspection, and reduce the probability of missed detection and false detection.

[0030] Specifically, this embodiment provides: An interactive X-ray security inspection method based on an improved YOLOv11, wherein the method includes: Step S10: Divide the preset dataset into training, validation and test sets. Step S20: Improve the YOLOv11 basic network architecture to generate the corresponding target detection network; wherein, the improvement process includes embedding the ECA lightweight attention mechanism module in the feature extraction stage of the backbone network, and replacing the original feature pyramid structure of the neck network with the ARBFPN auxiliary reversible bidirectional feature pyramid network. Step S30: Iteratively train the target detection network using the training set, fine-tune the parameters of the training process using the validation set to save the optimal model parameters after convergence, and evaluate and verify the performance of the detection network using the test set. Step S40: Deploy the trained target detection network to the X-ray security inspection and recognition system to perform real-time inference detection on the input real-time images, video streams, or camera capture streams, so as to output the corresponding bounding box coordinates, category labels, and confidence scores of contraband items, and complete the visualization display and export of early warning statistics.

[0031] Second Embodiment Furthermore, the step of embedding the ECA lightweight attention mechanism module in the feature extraction stage of the backbone network includes: The input feature map of the backbone network convolution output is subjected to global spatial information aggregation processing. The spatial two-dimensional features of each channel are compressed into scalars through channel-level global average pooling to generate the corresponding global channel descriptor vector. The interaction kernel size is adaptively calculated based on the channel dimension of the feature map. The local interaction kernel size of the one-dimensional convolution is dynamically determined through the channel number mapping function to adapt to the channel scale of different network layers. The global channel descriptor vector is subjected to local cross-channel interaction processing without dimensionality reduction. The dependencies between adjacent channels are captured by one-dimensional convolution with kernel size matching in order to generate the corresponding nonlinear channel attention weight components. The channel attention weights are weighted sequentially with the original input feature map to achieve dynamic recalibration of the channel-level features, thereby outputting the enhanced feature map and passing it to the next layer of the network.

[0032] Furthermore, the step of adaptively calculating the interaction kernel size based on the channel dimension of the feature map and generating nonlinear channel attention weight components includes: The number of channels C of the input feature map is extracted, and the local interaction kernel size k is calculated through an adaptive mapping function. The mapping function calculates the base value based on the logarithmic transformation of the number of channels, and takes the odd number closest to the base value as the kernel size. Construct a local channel set containing the current channel and its k neighboring channels. Calculate the descriptors in the local channel set by weighting them with k learnable parameters shared within the one-dimensional convolutional kernel, and output the attention weight values ​​of the corresponding channels through the Sigmoid activation function. The above weighted calculation is performed sequentially on all channels to form complete channel attention weight components.

[0033] Furthermore, the step of replacing the original feature pyramid structure of the neck network with an auxiliary reversible bidirectional feature pyramid network (ARBFPN) includes: Receive a multi-scale feature map set output by the backbone network after enhancement by the ECA module. The multi-scale feature map set includes shallow feature P3, mid-level feature P4 and deep feature P5. A parallel coupled invertible function mapping channel is established between feature levels of adjacent scales to perform bidirectional invertible fusion processing on cross-scale features, so as to generate intermediate fused features that take into account both spatial details and semantic information. A parallel auxiliary training branch is set up next to the main interaction channel to supervise and refine the intermediate fusion features, and secondary detail optimization of the fusion features is completed through residual convolutional blocks to generate the final multi-scale fusion feature map and send it to the detection head.

[0034] Furthermore, the step of establishing parallel-coupled invertible function mapping channels between feature levels of adjacent scales to perform bidirectional invertible fusion processing of cross-scale features includes: For adjacent low-level and high-level features, the low-level features are compressed in resolution and matched in channel dimension by the residual convolution downsampling mapping function. The extracted contour features are then superimposed on the high-level features to generate high-level intermediate fusion features that preserve edge texture. The updated high-level intermediate fusion features are restored in resolution and adapted to channels by using an upsampling mapping function. Semantic information is then superimposed onto low-level features to generate low-level enhanced features that take into account both global semantics and positioning accuracy. By leveraging the invertible mapping relationship between the downsampling mapping function and the upsampling mapping function, information conservation is achieved during cross-scale feature transmission, supporting lossless reverse reconstruction of the original input features.

[0035] Furthermore, the steps of iteratively training the target detection network using the training set and fine-tuning the parameters of the training process using the validation set include: The X-ray security inspection images in the training set are preprocessed and data augmented to generate standardized training samples and correspondingly labeled with the category and location of contraband. Load the initialization parameters of the target detection network, set the training hyperparameters and perform multiple rounds of iterative training, and monitor the model convergence status in real time through the validation set; During training, the auxiliary loss is calculated synchronously through the auxiliary training branch of ARBFPN, and the backpropagation update of the network parameters is completed in combination with the main detection loss function to obtain the optimal model parameters after convergence.

[0036] Furthermore, the steps of performing real-time inference detection on the input real-time images, video streams, or camera capture streams, and completing the visualization display and export of early warning statistical information include: Load the optimal model parameters into the preset X-ray security inspection and recognition system, and connect to the image, video stream or camera acquisition channel to obtain real-time security inspection images; The detection network is invoked to perform inference calculations on the real-time security inspection images, and the bounding box coordinates, category labels and confidence scores of each prohibited item target are output. The test results are dynamically plotted on the system's visualization window, and the types and quantities of prohibited items detected in the current time period are statistically analyzed. The corresponding early warning statistical information files are automatically generated and exported.

[0037] In addition, it should be noted in this embodiment that the interactive X-ray security inspection method based on the improved YOLOv11 provided in this embodiment is specifically implemented by the following: The overall solution consists of two core layers cascaded together: an algorithm layer (an improved YOLO11 network) and a system layer (a human-computer interaction visual flow control terminal). The flowchart of the entire solution is as follows: Figure 1 As shown in the diagram, the overall structure of the algorithm layer is as follows: Figure 2 As shown, the complete working process of the entire scheme is described below: Step 1: This invention uses the X-RayBaggage-v3 dataset to train the model. This dataset contains five typical categories of prohibited items (firearms, knives, pliers, scissors, and wrenches) and is widely used in related academic research. The dataset contains 3771 X-ray security inspection images, which are divided into a 70% training set, a 20% validation set, and a 10% test set to ensure sufficient training data for the model. The distribution of the number of each prohibited item in the dataset is shown in Table 1.

[0038]

[0039] Table 1. Distribution of Contraband Quantities Step Two: Improve the YOLOv11 architecture. The detailed structure and workflow of the two core modules improved in this invention are as follows: (1) ECA (Efficient Channel Attention) attention mechanism module Motivation: To effectively suppress strong background noise caused by stacked objects in X-ray images and to target and enhance the features of sparse, small-target contraband items without introducing bloated parameters or blocking channel mapping, the algorithm layer introduces an ECA module in the feature extraction stage of the backbone network. This module achieves accurate and lightweight reconstruction of the channel-level weights of the feature map through a local cross-channel interaction strategy that avoids dimensionality compression. The module structure diagram is shown below. Figure 2 As shown in (a) above, the specific workflow and mathematical modeling are as follows: Global spatial information aggregation: Let the feature map extracted and input from the previous convolutional layer be... Where W is the feature map width, H is the feature map height, and C is the number of channels. To collect global spatial distribution context and remove spatial geometric redundancy, channel-level global average pooling (GAP) is first used to compress the spatial two-dimensional features of each channel into a scalar, generating a global channel descriptor vector. Wherein, the i-th element y of vector y i The expression is:

[0040] Where, x i ( ) indicates pooling processing. Adaptive selection of the interaction kernel size: The channel dimension C typically increases with network depth in powers of 2, and a fixed local interaction range cannot adapt to dynamically changing channel scales. Therefore, this invention establishes an adaptive mapping function for the number of channels C to dynamically calculate the local interaction kernel size (neighborhood size) k of one-dimensional convolution. This design allows shallower (fewer channels) weak semantic features to maintain more refined local interactions, while deeper, higher-level semantic features can obtain a wider range of non-local interactions. The adaptive calculation formula for the kernel size k is: ,in, This indicates taking the odd number closest to the result. b are hyperparameters, which are set to 2 and 1 respectively in this invention, and c represents the number of channels.

[0041] Local cross-channel interaction without dimensionality reduction: This invention uses a parameter matrix Wk applied to the channel vector y, enabling each channel to interact locally only with its k nearest neighbors without reducing dimensionality, thus capturing local channel dependencies. To ensure all channels share the same learning parameters and maintain the module's extreme lightweight nature, this interaction process is implemented through a fast one-dimensional convolution with a kernel size of k. The formula for generating the nonlinear channel attention weight components is: Expanding to the specific weight ω of the i-th channel i Its mathematical expression is: ,in Here is the Sigmoid activation function, where The latter indicates that it contains channel y. i and the set of its k adjacent channels, ω j These are k scalar learnable parameters shared within a one-dimensional convolutional kernel.

[0042] Feature recalibration and output: Finally, the calculated channel attention weights ω are... iTreated as a feature activation operator, it is applied to the corresponding channels of the original input feature map χ by multiplying the elements one channel at a time, thereby completing the dynamic recalibration of the channel-level features and outputting the reconstructed enhanced feature map χS, which is then used as the input to the next layer. Since useless background channels are suppressed and target salient channels are amplified, the robustness of the subsequent network for extracting layered contraband is greatly improved.

[0043] The ECA module completely abolishes dimensionality compression, maintaining the original direct mapping of dimensional feature channels. This ensures that the specific features generated by small-target contraband in dedicated channels are well preserved and receive their due high channel weights, thereby reducing the false negative rate of concealed contraband from the source.

[0044] (2) Auxiliary Reversible Bidirectional Feature Pyramid Network (ARBFPN) Motivation: In standard feature pyramid architectures (such as FPN and PANet), when deep high-level semantic information and shallow low-level spatial geometric information are passed and added (or spliced) layer by layer, the information flow is truncated by traditional irreversible operators (such as strided convolution and regular pooling), which easily leads to the loss of shallow spatial details and the degradation of deep semantic features. When processing X-ray security inspection images with severe overlapping and high-density occlusion, this defect can cause weak features and key boundary contours of small contraband targets to be submerged by background noise, resulting in catastrophic missed detections. To address this, this invention introduces an Auxiliary Reversible Bidirectional Feature Pyramid Network (ARBFPN) into the neck network. By constructing reversible information transmission paths from top to bottom and bottom to top, supplemented by auxiliary training branches, it achieves lossless bidirectional fusion and transfer of cross-scale features, accurately capturing multi-scale targets in complex overlapping scenes.

[0045] Input: Let the multi-scale feature map set output by the backbone network and enhanced by the ECA attention mechanism be {P3, P4, P5}, where P3 represents shallow features containing rich edge geometric information, P5 represents deep features containing high-order abstract semantics, and P4 represents mid-level features that take into account both spatial details and abstract semantics. The ARBFPN module reconstructs these features through bidirectional reversible flow.

[0046] Reversible bidirectional information transmission: To ensure information integrity during the fusion and transfer of cross-scale features, the module establishes a pair of parallel-coupled reversible function mapping channels between adjacent scale levels. Taking low-level feature X... low (e.g., P3) and high-level feature X high Taking the fusion interaction of (such as P4) as an example, that is Figure 2 As shown in (c), the forward propagation flow is strictly decoupled into two interdependent recursive branches: 1. Spatial-to-Semantic Downsampling Forward Flow: First, the low-level spatial feature map extracts fine contour features through the downsampling mapping function D(), and then superimposes these features onto the high-level feature channels. This function employs a residual convolution structure with a stride of 2, adaptively compressing the spatial resolution of the feature map (W×H) while reconstructing the channel dimensions to match X. high Exact match. Generates intermediate blending features Y that preserve edge texture. high Y high =X high +D(X low ).

[0047] 2. Semantic-to-spatial upsampling forward flow: utilizing the updated high-level semantic features Y high The upsampling mapping function U() is applied inversely to the lower-level channels to generate enhanced features Y that simultaneously take into account global contextual semantics and precise localization information. low Y low =X low +U(Y high ).

[0048] Because this mapping architecture strictly satisfies mathematical reversibility, the original input can be reconstructed without loss through the reverse decoupling formula during reverse computation or feature tracing. Through this forward bidirectional integration and mathematically reversible design, the deep semantic graph and the shallow spatial graph achieve "information conservation" during layer-by-layer transmission, completely eliminating the defects of small target and overlapping edge information loss caused by unidirectional truncation in the general feature pyramid.

[0049] Parallel Assisted Training Supervision and Feature Refinement: To further enhance the model's boundary awareness on hidden targets, ARBFPN introduces a parallel auxiliary training branch alongside the main interaction channel. This branch does not participate in the inference phase computation; it only refines the intermediate fused features during training using an independent auxiliary loss function. Finally, residual convolutional blocks are used to perform nonlinear detail refinement on the bidirectional fused features, generating the final multi-scale fused feature map, which is then submitted to the downstream dynamically decoupled detection head.

[0050] Step 3: Train the improved YOLOv11 network (YOLOv11-ECA-ARBFPN) of this invention using the training dataset, save the model parameters after training, and evaluate the detection performance of the improved network using the test dataset.

[0051] Figure 3The visualization of the comparative experiments of various models shows that even with overlap and occlusion, the present invention can still accurately identify contraband. In the figures, a is the original image, b is the SSD image, c is the YOLO11 image, d is the Cascade R-CNN image, and e is the YOLOv11-ECA-ARBFPN image. Specific comparison data is shown in Table 2 below.

[0052] Table 2 Comparison of Evaluation Indicators for Each Model Step 4: This invention develops an X-ray security inspection image contraband recognition system based on the PyQt5 framework. The system structure is as follows: Figure 2 As shown in the figure, this system adopts a modular design concept, dividing the entire security inspection item recognition system into four core modules: a data preprocessing module, a model training module, an inference and detection module, and a user interface module. This modular design not only improves the maintainability and scalability of the system but also facilitates the independent development and testing of each module. The system's workflow is as follows: First, the data preprocessing module cleans, converts, and augments the original security inspection images, generating a standardized dataset that meets training requirements. The model training module trains the detection model based on the preprocessed data, obtaining the best-performing detection model through hyperparameter tuning and model optimization. Next, the inference and detection module loads the trained model and performs fast and accurate detection and analysis on new security inspection images. Finally, the user interface module provides a user-friendly interactive interface, enabling functions such as model management, detection, and result display. The embodiment demonstrates the system's UI interface and operation logic.

[0053] Step 5: Train the improved YOLOv11-ECA-ARBFPN network of this invention and load it into the automated X-ray security inspection image contraband recognition system. When the system reads the input real-time image, video stream or camera capture stream, it triggers the detection algorithm with one click and dynamically draws the final output bounding box coordinates, category labels (guns, knives, pliers, scissors, wrenches) and corresponding confidence scores on the visualization window of the graphical user interface, and automatically exports the contraband warning statistics.

[0054] Please see Figure 4 The third embodiment of the present invention provides: An interactive X-ray security inspection system based on an improved YOLOv11, wherein the system includes: The processing module is used to divide the preset dataset to generate corresponding training, validation and test sets; The building module is used to improve the YOLOv11 basic network architecture to generate the corresponding object detection network. The improvement process includes embedding the ECA lightweight attention mechanism module in the feature extraction stage of the backbone network and replacing the original feature pyramid structure of the neck network with the auxiliary reversible bidirectional feature pyramid network ARBFPN. The evaluation module is used to iteratively train the target detection network using the training set, fine-tune the parameters of the training process using the validation set to save the optimal model parameters after convergence, and evaluate and verify the performance of the detection network using the test set. The detection module is used to deploy the trained target detection network to the X-ray security inspection and recognition system. It performs real-time inference detection on the input real-time images, video streams, or camera capture streams to output the corresponding bounding box coordinates, category labels, and confidence scores of contraband items, and completes the visualization display and export of early warning statistics.

[0055] Furthermore, the step of embedding the ECA lightweight attention mechanism module in the feature extraction stage of the backbone network includes: The input feature map of the backbone network convolution output is subjected to global spatial information aggregation processing. The spatial two-dimensional features of each channel are compressed into scalars through channel-level global average pooling to generate the corresponding global channel descriptor vector. The interaction kernel size is adaptively calculated based on the channel dimension of the feature map. The local interaction kernel size of the one-dimensional convolution is dynamically determined through the channel number mapping function to adapt to the channel scale of different network layers. The global channel descriptor vector is subjected to local cross-channel interaction processing without dimensionality reduction. The dependencies between adjacent channels are captured by one-dimensional convolution with kernel size matching in order to generate the corresponding nonlinear channel attention weight components. The channel attention weights are weighted sequentially with the original input feature map to achieve dynamic recalibration of the channel-level features, thereby outputting the enhanced feature map and passing it to the next layer of the network.

[0056] Furthermore, the step of adaptively calculating the interaction kernel size based on the channel dimension of the feature map and generating nonlinear channel attention weight components includes: The number of channels C of the input feature map is extracted, and the local interaction kernel size k is calculated through an adaptive mapping function. The mapping function calculates the base value based on the logarithmic transformation of the number of channels, and takes the odd number closest to the base value as the kernel size. Construct a local channel set containing the current channel and its k neighboring channels. Calculate the descriptors in the local channel set by weighting them with k learnable parameters shared within the one-dimensional convolutional kernel, and output the attention weight values ​​of the corresponding channels through the Sigmoid activation function. The above weighted calculation is performed sequentially on all channels to form complete channel attention weight components.

[0057] Furthermore, the step of replacing the original feature pyramid structure of the neck network with an auxiliary reversible bidirectional feature pyramid network (ARBFPN) includes: Receive a multi-scale feature map set output by the backbone network after enhancement by the ECA module. The multi-scale feature map set includes shallow feature P3, mid-level feature P4 and deep feature P5. A parallel coupled invertible function mapping channel is established between feature levels of adjacent scales to perform bidirectional invertible fusion processing on cross-scale features, so as to generate intermediate fused features that take into account both spatial details and semantic information. A parallel auxiliary training branch is set up next to the main interaction channel to supervise and refine the intermediate fusion features, and secondary detail optimization of the fusion features is completed through residual convolutional blocks to generate the final multi-scale fusion feature map and send it to the detection head.

[0058] Furthermore, the step of establishing parallel-coupled invertible function mapping channels between feature levels of adjacent scales to perform bidirectional invertible fusion processing of cross-scale features includes: For adjacent low-level and high-level features, the low-level features are compressed in resolution and matched in channel dimension by the residual convolution downsampling mapping function. The extracted contour features are then superimposed on the high-level features to generate high-level intermediate fusion features that preserve edge texture. The updated high-level intermediate fusion features are restored in resolution and adapted to channels by using an upsampling mapping function. Semantic information is then superimposed onto low-level features to generate low-level enhanced features that take into account both global semantics and positioning accuracy. By leveraging the invertible mapping relationship between the downsampling mapping function and the upsampling mapping function, information conservation is achieved during cross-scale feature transmission, supporting lossless reverse reconstruction of the original input features.

[0059] Furthermore, the steps of iteratively training the target detection network using the training set and fine-tuning the parameters of the training process using the validation set include: The X-ray security inspection images in the training set are preprocessed and data augmented to generate standardized training samples and correspondingly labeled with the category and location of contraband. Load the initialization parameters of the target detection network, set the training hyperparameters and perform multiple rounds of iterative training, and monitor the model convergence status in real time through the validation set; During training, the auxiliary loss is calculated synchronously through the auxiliary training branch of ARBFPN, and the backpropagation update of the network parameters is completed in combination with the main detection loss function to obtain the optimal model parameters after convergence.

[0060] Furthermore, the steps of performing real-time inference detection on the input real-time images, video streams, or camera capture streams, and completing the visualization display and export of early warning statistical information include: Load the optimal model parameters into the preset X-ray security inspection and recognition system, and connect to the image, video stream or camera acquisition channel to obtain real-time security inspection images; The detection network is invoked to perform inference calculations on the real-time security inspection images, and the bounding box coordinates, category labels and confidence scores of each prohibited item target are output. The test results are dynamically plotted on the system's visualization window, and the types and quantities of prohibited items detected in the current time period are statistically analyzed. The corresponding early warning statistical information files are automatically generated and exported.

[0061] The fourth embodiment of the present invention provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the interactive X-ray security inspection method based on the improved YOLOv11 as described above.

[0062] The fifth embodiment of the present invention provides a readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the interactive X-ray security inspection method based on the improved YOLOv11 as described above.

[0063] In summary, the interactive X-ray security inspection method and system based on the improved YOLOv11 provided in the above embodiments of the present invention can effectively improve the detection accuracy and overall recognition efficiency of X-ray security inspection, and reduce the probability of missed detection and false detection.

[0064] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can reside in the same processor; or the above modules can be located in different processors in any combination.

[0065] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0066] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0067] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0068] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0069] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the appended claims.

Claims

1. An interactive X-ray security inspection method based on an improved YOLOv11, characterized in that, The method includes: The preset dataset is divided into training, validation and test sets. The YOLOv11 basic network architecture is improved to generate a corresponding object detection network. The improvement process includes embedding an ECA lightweight attention mechanism module in the feature extraction stage of the backbone network and replacing the original feature pyramid structure of the neck network with an auxiliary reversible bidirectional feature pyramid network ARBFPN. The target detection network is iteratively trained using the training set, and the parameters are tuned during the training process using the validation set to save the optimal model parameters after convergence. The performance of the detection network is evaluated and verified using the test set. The trained target detection network is deployed to the X-ray security inspection and recognition system to perform real-time inference detection on the input real-time images, video streams, or camera capture streams, so as to output the corresponding bounding box coordinates, category labels, and confidence scores of contraband items, and complete the visualization display and export of early warning statistics.

2. The interactive X-ray security inspection method based on improved YOLOv11 according to claim 1, characterized in that, The step of embedding the ECA lightweight attention mechanism module in the feature extraction stage of the backbone network includes: The input feature map of the backbone network convolution output is subjected to global spatial information aggregation processing. The spatial two-dimensional features of each channel are compressed into scalars through channel-level global average pooling to generate the corresponding global channel descriptor vector. The interaction kernel size is adaptively calculated based on the channel dimension of the feature map. The local interaction kernel size of the one-dimensional convolution is dynamically determined through the channel number mapping function to adapt to the channel scale of different network layers. The global channel descriptor vector is subjected to local cross-channel interaction processing without dimensionality reduction. The dependencies between adjacent channels are captured by one-dimensional convolution with kernel size matching in order to generate the corresponding nonlinear channel attention weight components. The channel attention weights are weighted sequentially with the original input feature map to achieve dynamic recalibration of the channel-level features, thereby outputting the enhanced feature map and passing it to the next layer of the network.

3. The interactive X-ray security inspection method based on the improved YOLOv11 according to claim 2, characterized in that, The steps of adaptively calculating the interaction kernel size based on the channel dimension of the feature map and generating nonlinear channel attention weight components include: The number of channels C of the input feature map is extracted, and the local interaction kernel size k is calculated through an adaptive mapping function. The mapping function calculates the base value based on the logarithmic transformation of the number of channels, and takes the odd number closest to the base value as the kernel size. Construct a local channel set containing the current channel and its k neighboring channels. Calculate the descriptors in the local channel set by weighting them with k learnable parameters shared within the one-dimensional convolutional kernel, and output the attention weight values ​​of the corresponding channels through the Sigmoid activation function. The above weighted calculation is performed sequentially on all channels to form complete channel attention weight components.

4. The interactive X-ray security inspection method based on improved YOLOv11 according to claim 1, characterized in that, The steps of replacing the original feature pyramid structure of the neck network with the Auxiliary Reversible Bidirectional Feature Pyramid Network (ARBFPN) include: Receive a multi-scale feature map set output by the backbone network after enhancement by the ECA module. The multi-scale feature map set includes shallow feature P3, mid-level feature P4 and deep feature P5. A parallel coupled invertible function mapping channel is established between feature levels of adjacent scales to perform bidirectional invertible fusion processing on cross-scale features, so as to generate intermediate fused features that take into account both spatial details and semantic information. A parallel auxiliary training branch is set up next to the main interaction channel to supervise and refine the intermediate fusion features, and secondary detail optimization of the fusion features is completed through residual convolutional blocks to generate the final multi-scale fusion feature map and send it to the detection head.

5. The interactive X-ray security inspection method based on the improved YOLOv11 according to claim 4, characterized in that, The step of establishing parallel coupled invertible function mapping channels between feature levels of adjacent scales and performing bidirectional invertible fusion processing on cross-scale features includes: For adjacent low-level and high-level features, the low-level features are compressed in resolution and matched in channel dimension by the residual convolution downsampling mapping function. The extracted contour features are then superimposed on the high-level features to generate high-level intermediate fusion features that preserve edge texture. The updated high-level intermediate fusion features are restored in resolution and adapted to channels by using an upsampling mapping function. Semantic information is then superimposed onto low-level features to generate low-level enhanced features that take into account both global semantics and positioning accuracy. By leveraging the invertible mapping relationship between the downsampling mapping function and the upsampling mapping function, information conservation is achieved during cross-scale feature transmission, supporting lossless reverse reconstruction of the original input features.

6. The interactive X-ray security inspection method based on improved YOLOv11 according to claim 1, characterized in that, The steps of iteratively training the object detection network using the training set and fine-tuning the parameters during the training process using the validation set include: The X-ray security inspection images in the training set are preprocessed and data augmented to generate standardized training samples and correspondingly labeled with the category and location of contraband. Load the initialization parameters of the target detection network, set the training hyperparameters and perform multiple rounds of iterative training, and monitor the model convergence status in real time through the validation set; During training, the auxiliary loss is calculated synchronously through the auxiliary training branch of ARBFPN, and the backpropagation update of the network parameters is completed in combination with the main detection loss function to obtain the optimal model parameters after convergence.

7. The interactive X-ray security inspection method based on improved YOLOv11 according to claim 6, characterized in that, The steps of performing real-time inference detection on the input real-time images, video streams, or camera capture streams, and completing the visualization display and export of early warning statistics include: Load the optimal model parameters into the preset X-ray security inspection and recognition system, and connect to the image, video stream or camera acquisition channel to obtain real-time security inspection images; The detection network is invoked to perform inference calculations on the real-time security inspection images, and the bounding box coordinates, category labels and confidence scores of each prohibited item target are output. The test results are dynamically plotted on the system's visualization window, and the types and quantities of prohibited items detected in the current time period are statistically analyzed. The corresponding early warning statistical information files are automatically generated and exported.

8. An interactive X-ray security inspection system based on an improved YOLOv11, characterized in that, The system includes: The processing module is used to divide the preset dataset to generate corresponding training, validation and test sets; The building module is used to improve the YOLOv11 basic network architecture to generate the corresponding object detection network. The improvement process includes embedding the ECA lightweight attention mechanism module in the feature extraction stage of the backbone network and replacing the original feature pyramid structure of the neck network with the auxiliary reversible bidirectional feature pyramid network ARBFPN. The evaluation module is used to iteratively train the target detection network using the training set, fine-tune the parameters of the training process using the validation set to save the optimal model parameters after convergence, and evaluate and verify the performance of the detection network using the test set. The detection module is used to deploy the trained target detection network to the X-ray security inspection and recognition system. It performs real-time inference detection on the input real-time images, video streams, or camera capture streams to output the corresponding bounding box coordinates, category labels, and confidence scores of contraband items, and completes the visualization display and export of early warning statistics.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the interactive X-ray security inspection method based on the improved YOLOv11 as described in any one of claims 1 to 7.

10. A readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the interactive X-ray security inspection method based on the improved YOLOv11 as described in any one of claims 1 to 7.