Rail transit X-ray security image contraband intelligent identification method and device
By generating high-quality training data through generative models and conditional generative adversarial networks, and combining lightweight contraband detection networks and temporal correlation analysis, the problem of data scarcity and insufficient detection capability for contraband identification in rail transit X-ray security inspections is solved, achieving high-precision and real-time contraband detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUZHOU HUAQI INTELLIGENT TECH
- Filing Date
- 2026-04-29
- Publication Date
- 2026-07-24
AI Technical Summary
In existing rail transit X-ray security inspection systems, the technology for identifying prohibited items suffers from problems such as data scarcity and uneven distribution, insufficient detection capability for small targets and occluded targets, and missed detections and false detections caused by independent processing of consecutive frame images, making it difficult to meet the needs of efficient and accurate security inspections.
Generative models are used to generate synthetic images of contraband. Conditional generative adversarial networks are combined for domain adaptation adjustments to construct a lightweight contraband detection network. Multi-scale feature pyramids and attention-guided modules are used for feature fusion. Anchor-free detection heads are used for detection, and false detections are filtered out through temporal correlation analysis.
It significantly improves the detection accuracy of small targets and obscured contraband, reduces the false negative rate, meets the real-time and accuracy requirements of high-speed security checks, and achieves efficient contraband identification.
Smart Images

Figure CN122454547A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and computer vision technology, specifically to a method and device for intelligent identification of prohibited items in X-ray security inspection images of rail transit. Background Technology
[0002] With the continuous growth of passenger volume in urban rail transit, the requirements for the efficiency and accuracy of security checks are increasing. Currently, urban rail transit security check systems mainly rely on operators manually interpreting X-ray images. This manual interpretation method is labor-intensive and subject to significant subjective factors. Under long working hours or high passenger flow, the missed detection rate increases significantly, making it difficult to meet the growing security check demands.
[0003] Existing technologies for identifying contraband from X-ray security images mainly fall into two categories: Existing recognition methods based on traditional image processing identify contraband through edge detection, template matching, and other means. However, these methods suffer from low accuracy, high false alarm rate, and poor robustness when dealing with targets that are varied in shape, occluded, or similar to ordinary items, making them difficult to meet the needs of practical applications.
[0004] Existing object detection methods based on convolutional neural networks (CNNs), such as the YOLO series and Faster R-CNN, have been introduced into the security inspection field, improving automatic recognition capabilities to some extent. However, these methods have the following shortcomings in the specific scenarios of rail transit security inspections: (1) Data scarcity and imbalanced distribution: There are few X-ray images of contraband in real-world scenarios, especially for small targets, severely obscured objects, or rare angles. This leads to insufficient model training and weak generalization ability. Conventional data augmentation methods such as flipping and cropping cannot fundamentally solve the problem of sample scarcity. (2) Insufficient detection capability for small targets and occluded targets: Contraband often presents small size features in X-ray images, and the outline is often incomplete or occluded due to overlapping of luggage items. Existing general detection models have limited feature extraction capabilities for small targets and occluded targets, resulting in a high false negative rate. (3) Existing methods process consecutive frame images independently without utilizing inter-frame temporal information, resulting in target omission and false detection problems in high-speed continuous scanning scenarios. Summary of the Invention
[0005] To address the aforementioned issues, this invention provides a method and apparatus for intelligent identification of prohibited items in X-ray security inspection images of rail transit. This method can effectively expand high-quality training data, significantly improve the detection accuracy of small targets and obscured prohibited items, and achieve high-accuracy detection of prohibited items and improved efficiency of the security inspection process.
[0006] The technical solution is as follows: an intelligent identification method for prohibited items in X-ray security inspection images of rail transit, comprising the following steps: S1: Obtain real X-ray images of contraband in rail transit security inspection scenarios as seed samples, and construct a text description library corresponding to the contraband category, pose, and degree of occlusion; based on the seed samples and the text description library, generate X-ray composite images of contraband through a generative model, and use a conditional generative adversarial network to perform domain adaptation adjustment on the X-ray composite images of contraband to obtain an augmented dataset consistent with the distribution of real X-ray images. S2: Based on the target size and occlusion ratio, assign sampling weights to the samples in the augmented dataset, and perform adaptive oversampling according to the sampling weights to increase the sampling probability of small target samples and occluded samples during the training process, thereby obtaining a balanced augmented training dataset; S3: Construct a contraband detection network, which includes a lightweight backbone network, a multi-scale feature pyramid, an attention-guided feature fusion module, a context enhancement module, and an Anchor-Free detection head. The lightweight backbone network is used to extract feature maps at different scales. The multi-scale feature pyramid is used to fuse features at different scales. The attention-guided feature fusion module is used to perform channel weighting and spatial weighting on cross-scale features. The context enhancement module is used to inject global context information into the feature maps. The Anchor-Free detection head is used to predict the feature maps and output the category, location, and confidence level of the contraband. S4: Train the contraband detection network using a balanced augmentation training dataset and real X-ray images to obtain a trained contraband detection model; S5: Input the continuous X-ray image sequence to be detected into the trained contraband detection model, perform temporal correlation analysis on the detection results of adjacent frames, including target association matching based on position intersection-union ratio and appearance feature similarity, trajectory prediction and completion for temporarily occluded targets, filter out false detections, and output contraband detection results.
[0007] Furthermore, in step S1, the generative model is a diffusion model, and the text description library includes at least three dimensions of descriptive information: prohibited item category, placement posture, and occlusion level. By adjusting the text prompt words, small target prohibited item samples, partially occluded prohibited item samples, and overlapping prohibited item samples are generated.
[0008] Furthermore, in step S1, the conditional generative adversarial network includes a generator and a discriminator. The generator receives the synthesized image and its semantic conditions and outputs the adjusted image. The discriminator receives the image and the semantic conditions and outputs the image patch-level authenticity judgment result. The training loss of the conditional generative adversarial network includes at least adversarial loss, content preservation loss and cycle consistency loss.
[0009] Furthermore, step S2 is executed as follows: Calculate the target size and occlusion ratio. The target size is the ratio of the area of the target bounding box to the area of the entire image. The occlusion ratio is the ratio of the area of the target occluded by other objects to the total area of the target, or, when only the bounding box is labeled, the ratio of the proportion of non-target pixels within the target box.
[0010] Based on the target size and occlusion ratio, the sampling weight w for each sample i is... i From the target size s i and occlusion ratio o i The following weighting function was jointly adopted: w i =α· +β·o i +γ Where α and β are balance coefficients. γ is a constant, and it is the base weight. The sampling weights are updated before each training cycle, and when constructing training batches, they are determined according to the sampling weights w. i Non-uniform probability random sampling is performed so that the sampling probability of small targets and highly occluded samples is higher than that of regular samples.
[0011] Furthermore, in step S2, additional data augmentation is performed on the sampled image, including random rotation and color jitter.
[0012] Furthermore, the lightweight backbone network includes depthwise separable convolutional blocks and inverted residual structure blocks. Each inverted residual structure block is expanded using a fixed expansion rate. The lightweight backbone network outputs basic feature maps at least three scales. The multi-scale feature pyramid performs channel alignment, upsampling, and feature fusion on the base feature map to obtain multi-scale feature maps of different scales. The attention-guided feature fusion module includes a cross-scale attention fusion module and a context enhancement module. The cross-scale attention fusion module includes: The channel attention submodule is used to generate channel weights through global average pooling and fully connected layers; The spatial attention submodule is used to generate a spatial location weight map through convolution operations; the channel weights and spatial location weights are used to weight and enhance the multi-scale feature map, and output a weighted fused feature map. The context enhancement module is used to perform global average pooling on multi-scale features to obtain a global context feature vector, which is then compressed and expanded by a fully connected layer and added to the original feature map to inject global context information into the feature map. The weighted fusion feature map is fused with the feature map injected with global context information to output enhanced feature maps at multiple scales; The Anchor-Free detection head processes the enhanced feature maps at each scale through multiple convolutional layers; it merges and decodes the prediction results from multiple scales, performs non-maximum suppression, and outputs the final detection box's category, location coordinates, and confidence score.
[0013] Furthermore, in step S4, the contraband detection network is trained using a multi-task joint loss, which includes at least classification loss, localization loss, and focusing loss, wherein the focusing loss is used to enhance the learning ability for small target samples and occluded samples.
[0014] The multi-task joint loss function is: L total =λ cls L cls +λ loc L loc +λ focal L focal Among them, L cls For the classification cross-entropy loss of all prohibited item categories, L loc To predict the Smooth L1 localization loss between the bounding box and the ground truth box, L focal For the focusing loss of the small target classification branch, λ cls , λ loc , λ focal These are the weight coefficients corresponding to the loss, and λ loc Greater than λ cls To enhance positioning accuracy, λ focal Greater than λ cls To enhance the learning of small targets and occluded targets.
[0015] Target association matching is performed based on location intersection-union ratio and appearance feature similarity. Trajectory prediction and completion are performed for temporarily occluded targets to filter out false detections. Furthermore, in step S5, the target association matching is specifically performed as follows: The intersection-union ratio (IUR) of the current frame detection box and the trajectory prediction box of the previous frame is calculated, and the IUR exceeding the first threshold is used as a candidate matching condition. The appearance feature vector of the detection box is calculated through a lightweight appearance feature extraction network, and the cosine similarity exceeding the second threshold is used as a matching confirmation condition. Combining the two conditions, the Hungarian algorithm is used to perform global optimal matching, and the unmatched detection boxes are processed as new targets, and the unmatched trajectories enter the occlusion processing process.
[0016] In step S5, trajectory prediction and completion for temporarily occluded targets are performed as follows: when a matched target has no corresponding detection box in the current frame, the Kalman filter is activated to predict the position of the current frame based on the target's historical motion state, and the predicted box is used to participate in the association of subsequent frames; if the detection box and the predicted box in the subsequent frame match successfully, normal tracking is resumed and the filter state is updated; if the number of consecutive disappearing frames exceeds the maximum tolerable number of frames, the trajectory of the target is terminated.
[0017] In step S5, the filtering of false detections is performed as follows: for newly appearing detection boxes with a confidence level lower than the third threshold, if there are no detection boxes overlapping with its position or similar features in the N frames before and after it, it is determined to be an isolated false detection and discarded; for new detection boxes with a high confidence level, they are marked as candidate targets, and are converted into formal targets only when they can be associated with the target in the subsequent M consecutive frames.
[0018] Furthermore, in step S5, a dynamic inference acceleration strategy is executed. The dynamic inference acceleration strategy includes: dynamically adjusting the input image resolution or triggering the network to exit early based on the real-time inference latency and system load, in order to achieve real-time detection of contraband and alarm output under high-speed conditions.
[0019] Furthermore, the dynamic resolution adjustment is specifically performed as follows: the system monitors the inference latency and input queue length in real time. When the average inference latency of several consecutive frames exceeds the upper threshold or the queue length continues to increase, the input image resolution is reduced by a fixed step size, and the scaling factor is not lower than the lower limit. When the latency is lower than the lower threshold and the queue is empty, the resolution is restored to the highest value.
[0020] Furthermore, the early exit mechanism is implemented as follows: an early exit branch is set in the lightweight backbone network. The early exit branch includes a convolutional layer, a global average pooling layer, and a fully connected layer to output the confidence scores for each category. When the maximum confidence score output by the early exit branch exceeds the early exit threshold and the predicted category is non-prohibited, the subsequent layer calculations are immediately terminated and a non-prohibited conclusion is output. When the predicted category is prohibited, early exit is not triggered regardless of the confidence score.
[0021] A computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the intelligent identification method for contraband in X-ray security inspection images of rail transit as described above.
[0022] A computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements the intelligent identification method for contraband in X-ray security inspection images of rail transit as described above.
[0023] A computer program product includes a computer program / instructions that, when executed by a processor, implement the steps of the method described above.
[0024] The present invention provides an intelligent identification method for contraband in X-ray security inspection images of rail transit. Through a generative diffusion model combined with textual prompts indicating the attributes of contraband, it can generate a large number of synthetic images covering different categories, poses, and degrees of occlusion at low cost. A conditional generative adversarial network is used for domain adaptation adjustment to ensure the consistency of the distribution between the synthetic images and the real X-ray images, solving the problem of domain offset between the synthetic and real images. Simultaneously, an adaptive oversampling mechanism is used to increase the sampling probability of difficult samples such as small targets and those with high occlusion, balancing the distribution of the training dataset and enabling the model to fully learn the features of difficult samples, significantly improving the model's generalization ability. The contraband detection network constructed in this invention integrates deep semantic information with shallow detail information through a multi-scale feature pyramid, adapting to the detection of contraband of different sizes. A cross-scale attention fusion module enhances the network's focus on key feature channels and spatial locations of contraband, suppressing interference from irrelevant background information. A context enhancement module injects global contextual information to assist the network in identifying occluded or incompletely contoured contraband. Combined with an anchor-free detection head, no pre-set anchor boxes are required, adapting to the detection of contraband with varying shapes, significantly reducing the false negative rate for small targets and occluded contraband.
[0025] The method of this invention achieves a balance between detection accuracy and inference speed, meeting the real-time requirements of high-speed security checks. The contraband detection network constructed in this invention significantly reduces the number of model parameters and computational load through a lightweight backbone network design. By utilizing temporal frame correlation analysis and combining information from adjacent frames for trajectory prediction and occlusion completion, false detections are filtered out, improving detection stability in continuous scanning scenarios. Furthermore, through dynamic resolution adjustment and a network early exit mechanism, the inference strategy is dynamically adjusted according to the real-time load, significantly reducing the inference time per frame while ensuring contraband detection accuracy, thus meeting the real-time requirements of high-speed security inspection machines. Attached Figure Description
[0026] Figure 1This is a schematic diagram illustrating the steps of the intelligent identification method for prohibited items in X-ray security inspection images of rail transit in the embodiment. Figure 2 This is a flowchart illustrating the steps of the method in the embodiment; Figure 3 This is a schematic diagram of the contraband detection network constructed in the embodiment; Figure 4 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0027] like Figure 1 , 2 As shown, this invention provides an intelligent identification method for prohibited items in X-ray security inspection images of rail transit, comprising at least the following steps: S1: Obtain real X-ray images of contraband in rail transit security inspection scenarios as seed samples, and construct a text description library corresponding to the contraband category, pose and degree of occlusion; based on the seed samples and text description library, generate X-ray composite images of contraband through a generative model, and use a conditional generative adversarial network to perform domain adaptation adjustment on the X-ray composite images of contraband to obtain an augmented dataset consistent with the distribution of real X-ray images. S2: Based on the target size and occlusion ratio, assign sampling weights to the samples in the augmented dataset, and perform adaptive oversampling according to the sampling weights to increase the sampling probability of small target samples and occluded samples during the training process, thus obtaining a balanced augmented training dataset; S3: Construct a contraband detection network, which includes a lightweight backbone network, a multi-scale feature pyramid, an attention-guided feature fusion module, and an Anchor-Free detection head. The lightweight backbone network is used to extract feature maps at different scales, the multi-scale feature pyramid is used to fuse features at different scales, the attention-guided feature fusion module is used to perform channel weighting and spatial weighting on cross-scale features, the context enhancement module is used to inject global context information into the feature maps, and the Anchor-Free detection head is used to predict the feature maps and output the category, location, and confidence of the contraband. S4: The contraband detection network is trained using a balanced augmentation training dataset and real X-ray images to obtain a trained contraband detection model; S5: Input the continuous X-ray image sequence to be detected into the trained contraband detection model, perform temporal correlation analysis on the detection results of adjacent frames, including target association matching based on position intersection-union ratio and appearance feature similarity, trajectory prediction and completion for temporarily occluded targets, filter out false detections, and output contraband detection results.
[0028] In one specific embodiment of the present invention, step S1 is performed as follows: Step S101: Collect a small number of real X-ray images of contraband as seed data, covering 12 common contraband items such as knives, firearms, and explosive-related tools, including samples with different postures and different degrees of obstruction; Step S102: Based on the seed data, construct a text description library. The text description library contains attribute tags such as the category, pose, degree of occlusion, and placement environment of the contraband. For example: Prohibited items include: folding knives, handguns, lighters, etc. Posture description: such as "facing up", "side down", "at an angle", etc.; Occlusion severity is defined in three levels: no occlusion, partial occlusion, and severe occlusion; where partial occlusion is defined as an occlusion area of less than 50%; and severe occlusion is defined as an occlusion area of more than 50%. Background descriptions include phrases such as "wrapped in clothing," "placed under a book," and "overlapping with a metal object."
[0029] The attributes in the text description library can be flexibly combined to form a rich variety of text prompts, such as "the knife is partially obscured by clothing and placed sideways in the luggage" and "the pistol is facing up and overlapping with metal debris," which are used to guide the diffusion model to generate synthetic images of specific scenes.
[0030] Step S103: Using a pre-trained diffusion model, such as StableDiffusionXL, fine-tuning it to fit the X-ray image domain, and combining it with prompts from a text description library, synthetic images are generated, focusing on small targets and severely occluded scenes, ultimately producing a large number of high-fidelity synthetic X-ray images of contraband.
[0031] In one specific embodiment, StableDiffusionXL is fine-tuned using 1,000 real images as seed data to generate 50,000 diverse synthetic images, covering various poses and occlusion combinations of 12 types of contraband.
[0032] The synthesized image generated by the diffusion model still exhibits domain differences compared to the real X-ray image, mainly in terms of texture details, X-ray-specific noise patterns, and grayscale distribution. To bridge this difference, the embodiment also includes: Step S104: Use a conditional generative adversarial network to perform domain adaptation adjustment, as follows: Conditional Generative Adversarial Networks (GANs) consist of a generator G and a discriminator D. The generator uses a U-Net architecture to generate synthetic images x using a diffusion model. syn Using its semantic label as condition c, the adjusted image x is output. adj =G(x syn c); The discriminator adopts the PatchGAN structure, which takes the image and conditions as input and outputs the true and false probabilities of each image patch.
[0033] The training loss function of a conditional generative adversarial network consists of three parts: first, an adversarial loss in the form of LSGAN, which drives the generated image distribution to approximate the distribution of real X-ray images; second, a content-preserving loss, which uses a pre-trained feature extraction network such as VGG to compute and adjust the image x in the feature space. adj With synthetic images syn The L1 distance between them ensures that the key structural information of the contraband does not shift; the third is the cycle consistency loss, which is achieved by adjusting the image x through the inverse generator G′. adj Map back to the synthesis domain and compute the result with respect to the original image. syn To prevent the generator from excessively modifying the semantics of the content, the three losses are jointly optimized by weighted summation, so that the generated image has the noise texture, grayscale distribution and superimposed effect unique to real X-ray images while maintaining the semantics of contraband, resulting in an augmented dataset with a distribution consistent with real X-ray images.
[0034] The embodiment employs a pre-trained diffusion model combined with a text description library for conditional generation technology. Domain adaptation is achieved through a conditional generative adversarial network, and adversarial training mechanism is used to eliminate the domain difference between synthetic images and real X-ray images. This enables the low-cost and efficient generation of high-quality contraband training images covering various complex scenarios from a small amount of real seed data, especially small targets and occluded scenarios, thus solving the problem of scarce and imbalanced training data in existing technologies.
[0035] In step S2 of the embodiment, adaptive oversampling is performed on small target contraband samples in the augmented dataset. The sampling weights are dynamically adjusted according to the target size and occlusion ratio, so that small targets and difficult samples are fully learned during training.
[0036] To address the scarcity of small targets and severely occluded samples, an adaptive oversampling mechanism is designed in this embodiment. This mechanism dynamically adjusts the sampling probability of each sample during training, allowing difficult samples to be used more frequently for model updates.
[0037] Calculate the target size and occlusion ratio. The target size is the ratio of the area of the target bounding box to the area of the entire image. The occlusion ratio is the ratio of the area of the target occluded by other objects to the total area of the target. For data that only provides the bounding box, the proportion of non-target pixels (such as other objects or background) within the target box can be used as an approximation to estimate the degree of occlusion, or the thickness information from depth estimation can be used as an aid. The occlusion ratio ranges from [0,1], with a larger value indicating more severe occlusion.
[0038] Based on the target size and occlusion ratio, the sampling weight w for each sample i is... i From the target size s i and occlusion ratio o iThe following weighting function was jointly adopted: w i =α· +β·o i +γ Where α and β are balance coefficients. α is a constant, and γ is the base weight; in the example, α is empirically set to 0.5 and β to 2.0. It is a constant, such as 10 -5 To prevent division by zero, γ=0.1, ensuring that all samples have the minimum sampling probability. The weighting function makes the sample with the smaller target and the more severe the occlusion, the greater the weight, and the higher the probability of it being selected in the training set. In other embodiments, the balance coefficient and the basic weight can be adjusted accordingly.
[0039] The sampling weights are updated before each training cycle, and when constructing training batches, they are calculated according to the sampling weights w. i Non-uniform probability random sampling is performed so that the sampling probability of small targets and occluded samples is higher than that of regular samples. At the same time, in order to prevent overfitting, additional data augmentation is performed on the sampled images, such as random rotation and color jitter, to finally obtain a balanced augmented training dataset.
[0040] like Figure 3 As shown, in step S3 of this embodiment, the contraband detection network constructed in this embodiment includes a lightweight backbone network, a multi-scale feature pyramid, an attention-guided feature fusion module, and an Anchor-Free detection head.
[0041] The lightweight backbone network includes depthwise separable convolutional blocks and inverted residual structure blocks. Each inverted residual structure block is expanded using a fixed expansion rate. The lightweight backbone network outputs basic feature maps at least three scales. Multi-scale feature pyramids perform channel alignment, upsampling, and feature fusion on the base feature map to obtain multi-scale feature maps of different scales. The attention-guided feature fusion module includes: The channel attention submodule is used to generate channel weights through global average pooling and fully connected layers; The spatial attention submodule is used to generate a spatial location weight map through convolution operations; channel weights and spatial location weights are used to weight and enhance the multi-scale feature map, and output a weighted fused feature map. The context enhancement module is used to perform global average pooling on multi-scale features to obtain a global context feature vector, which is then compressed and expanded by a fully connected layer and added to the original feature map to inject global context information into the feature map. The weighted fusion feature map is fused with the feature map injected with global context information to output enhanced feature maps at multiple scales.
[0042] The Anchor-Free detection head processes the enhanced feature maps at each scale through multiple 3×3 convolutional layers; it merges and decodes the prediction results from multiple scales, performs non-maximum suppression, and outputs the final detection box's category, location coordinates, and confidence score.
[0043] In this embodiment, the lightweight backbone network uses depthwise separable convolution and inverse residual structures to progressively extract image features: First stage: Depthwise separable convolutional block with a stride of 2, inputting a 640×640×3 X-ray image and outputting a 320×320×16 feature map; Second stage: Inverted residual structure block, expansion rate of 6, output feature map of 160×160×24; Third stage: Inverted residual structure block, expansion rate 6, output 80×80×40 feature map, denoted as C3; Fourth stage: Inverted residual structure block, expansion rate 6, output 40×40×112 feature map, denoted as C4; Fifth stage: Inverted residual structure block, expansion rate 6, output 20×20×160 feature map, denoted as C5; Among them, depthwise separable convolution decomposes standard convolution into channel-wise spatial convolution and 1×1 pointwise convolution, significantly reducing the number of parameters and computational cost. The inverse residual block first expands the number of input channels to 6 times the original number through 1×1 convolution, then performs 3×3 depthwise separable convolution to extract spatial features, and finally compresses the number of channels back to the target dimension through 1×1 convolution and introduces residual connections.
[0044] Feature maps at three scales (C3, C4, and C5) extracted from the lightweight backbone network are fused at multiple scales using a multi-scale feature pyramid. C5 is convolved with 1×1 to adjust the number of channels to 256, resulting in P5 with a scale of 20×20×256; P5 is upsampled by 2x to a scale of 40×40, and its features are added to the result of C4 after adjusting the number of channels to 256 through 1×1 convolution. Then, the features are refined by 3×3 convolution to obtain P4 with a scale of 40×40×256. P4 is upsampled by 2x to a scale of 80×80, and its features are added to the result of C3 after adjusting the number of channels to 256 through a 1×1 convolution. Then, the features are refined by a 3×3 convolution to obtain P3 with a final scale of 80×80×256.
[0045] This yields feature maps at three different scales: P3, P4, and P5. P3 has high resolution and is suitable for detecting small targets, while P5 has strong semantic information and is suitable for recognizing large targets.
[0046] This embodiment introduces an attention-guided feature fusion module after the multi-scale feature pyramid, further enhancing P3, P4, and P5. The attention-guided feature fusion module includes a cross-scale attention fusion module and a context enhancement module.
[0047] The cross-scale attention fusion module includes: The channel attention submodule performs global average pooling on the input feature map to obtain global statistical information for each channel, generating channel descriptor vectors. The channel descriptor vectors are then input into two fully connected layers. The first fully connected layer compresses the dimension to 1 / 16 of the original, while the second fully connected layer restores the original dimension. The weight vectors for each channel are generated by the Sigmoid activation function. The weight vectors are then multiplied with the original feature map channel by channel to enhance channels with high information content and suppress redundant channels.
[0048] The spatial attention submodule performs max pooling and average pooling operations on the channel dimension to obtain two single-channel feature maps. The two feature maps are concatenated on the channel dimension and input into a 7×7 convolutional layer to generate a spatial weight map. After Sigmoid activation, the spatial weight map is multiplied with the feature map to focus on the spatial location containing key information about contraband.
[0049] In this embodiment, the context enhancement module performs global average pooling on the enhanced feature maps at each scale to obtain a global feature vector. The global feature vector is then compressed in dimension by a first fully connected layer at a compression ratio of 1 / 4, and then expanded back to the channel dimension of the original feature map by a second fully connected layer. The expanded vector is then broadcast to the original feature map size and added to the original feature map, thereby injecting global context information into local features. This helps the network to complete the contour semantics of contraband when, for example, the contraband is occluded or the local features are incomplete, using global information.
[0050] After attention fusion and context enhancement, the output enhanced feature map F3 is 80×80×256, feature map F4 is 40×40×256, and feature map F5 is 20×20×256.
[0051] In this embodiment, an anchor-free detection head is used to detect feature maps at three scales: F3, F4, and F5. Each scale's detection head contains three 3×3 convolutional layers for channel adjustment and outputs three prediction branches respectively. Center point heatmap: predicts the probability of the existence of the target center point at each spatial location, with dimensions of H×W×C, where C is the number of center point channels, and H and W are the length and width, respectively.
[0052] Size offset: Predicts the width and height of the target bounding box corresponding to each spatial location, with dimensions of H×W×2.
[0053] Category probability: Predicts the category of the target corresponding to each spatial location, with dimensions H×W×K, where K is the number of prohibited item categories.
[0054] The prediction results from the three scales are merged, decoded, and non-maximum suppression is applied to output the final detection box, which includes the contraband category, location coordinates, and confidence level.
[0055] The embodiment employs adaptive oversampling based on target size and occlusion ratio. By dynamically calculating the sampling weights of each sample, the training process automatically focuses on small targets and occluded samples. Combined with the synergistic effect of the cross-scale fusion module guided by both channel attention and spatial attention in the lightweight multi-scale feature fusion network, as well as the context enhancement module, the attention mechanism is used to adaptively weight the key feature channels and spatial positions of contraband and supplement global context information. This achieves high-precision detection of small targets and occluded contraband, significantly reducing the false negative rate and solving the technical problem of insufficient detection capability for small targets and occluded targets in the prior art.
[0056] In step S4 of the embodiment, the lightweight multi-scale feature fusion network constructed in step S3 is trained end-to-end using the balanced augmented training dataset obtained in step S2. The contraband detection network is trained using multi-task joint loss, which includes at least classification loss, localization loss and focusing loss. The focusing loss is used to enhance the learning ability of small target samples and occluded samples.
[0057] In this embodiment, the joint loss function for multiple tasks is: L total =λ cls L cls +λ loc L loc +λ focal L focal Among them, L cls The classification cross-entropy loss is used to distinguish prohibited item categories by including background information; L loc To predict the Smooth L1 localization loss between the bounding box and the ground box, the difference between the predicted bounding box and the ground box is calculated. Since localization accuracy is crucial for security checks, it is given a high weight. L focal The focusing loss for the small target classification branch is formulated as L. focal =-α f (1-p t ) γf log(p t ), where p t In this embodiment, α is set to represent the model's prediction probability for the correct category.f =0.25, γf=2.0, used to enhance learning of small targets and occluded target samples that are difficult to classify; λ cls , λ loc , λ focal These are the weight coefficients corresponding to the loss, and λ loc Greater than λ cls To enhance positioning accuracy, λ focal Greater than λ cls To enhance the learning of small targets and occluded targets.
[0058] In the embodiment, the weight λ is taken. cls =1.0, weight λ loc =5.0, weight λ focal =2.0, the weighting ratio has been verified through a large number of experiments. While ensuring the overall classification and localization accuracy, it can significantly improve the recall rate of small targets. The initial value can be fine-tuned according to the performance of the validation set during training, but the above initial value can already achieve good results.
[0059] In step S5 of the embodiment, the continuous X-ray image sequence to be detected is input into the trained contraband detection model, and temporal correlation analysis is performed on the detection results of adjacent frames. This embodiment designs a temporal correlation analysis based on multi-feature fusion for the continuously scanned X-ray image sequence, including target correlation matching, occlusion trajectory prediction and completion, and false detection filtering.
[0060] The target association matching is specifically executed as follows: The intersection-union ratio (IUR) of the current frame detection box and the trajectory prediction box of the previous frame is calculated, and the IUR exceeding the first threshold is used as a candidate matching condition. The appearance feature vector of the detection box is calculated through a lightweight appearance feature extraction network, and the cosine similarity exceeding the second threshold is used as a matching confirmation condition. Combining the two conditions, the Hungarian algorithm is used to perform global optimal matching, and the unmatched detection boxes are processed as new targets, and the unmatched trajectories enter the occlusion processing process. In this embodiment, target association matching is performed as follows: calculate the detection box B of the current frame. t The Intersection over Union (IoU) ratio with all trajectory prediction boxes in the previous frame is used to determine the maximum IoU value. If the maximum IoU is greater than the first threshold T, then... iou A similarity of 0.5 or less is considered a candidate match. Simultaneously, a lightweight ReID network extracts 128-dimensional appearance feature vectors for each detection box, and calculates the cosine similarity between the current frame's detection box features and the corresponding trajectory features from the previous frame. If the similarity is greater than a second threshold T... cos A match is successful if the IoU and appearance similarity are considered. The Hungarian algorithm is used for global optimal matching, and unmatched detection boxes are regarded as new targets. Unmatched trajectories are then processed for occlusion.
[0061] When a target is occluded and fails to be detected for several consecutive frames, trajectory prediction and completion are performed on the temporarily occluded target. Specifically, the following steps are taken: When a matched target has no corresponding detection box in the current frame, a Kalman filter is activated to predict the position of the target in the current frame based on its historical motion state. The predicted box is then used to participate in the association of subsequent frames. If the detection box and the predicted box match successfully in subsequent frames, normal tracking is resumed and the filter state is updated. If the number of consecutive missing frames exceeds the maximum tolerable number of frames, the corresponding target trajectory is terminated.
[0062] In the embodiment, when a matched target is not associated with any detection box in the current frame, the number of consecutive frames f in which it disappears is determined. lost Is it less than the maximum tolerable frame count F? max =10 frames, corresponding to approximately 0.5 seconds at a security scanner operating speed of 0.3 m / s; if so, the target is considered to be in a state of temporary occlusion, and the Kalman filter is activated to predict the target position in the current frame based on the target's historical motion state. The predicted bounding box is used as a temporary detection result in subsequent frame association. If a detection box in a subsequent frame successfully matches the predicted bounding box, normal tracking is resumed and the Kalman filter parameters are updated. If the number of consecutive missing frames exceeds the maximum tolerable frame number F... max If a frame still cannot be matched, it is assumed that the target has left the scene, and the corresponding target trajectory is terminated.
[0063] The specific steps for filtering out false positives are as follows: Isolation judgment: For newly appearing detection boxes with a confidence level lower than the third threshold, if there are no detection boxes overlapping with its position or similar features in the N frames before and after it, it is judged as an isolated false detection and discarded. Continuity verification: New detection boxes with high confidence are marked as candidate targets, and are converted into official targets only when they can be associated with the target in the subsequent M consecutive frames.
[0064] In the embodiment, for detection boxes that appear suddenly and cannot be associated with historical trajectories, if their confidence level is lower than the threshold T... conf If the confidence level is 0.4 and there are no detection boxes overlapping with its position or having similar features in the preceding and following 3 frames, it is judged as an isolated false detection and discarded. For new detection boxes with high confidence, they are marked as candidate targets. If they can be associated with the same target in the following 2 consecutive frames, they are converted into official targets; otherwise, they are filtered out as false detections.
[0065] In step S5, in order to adapt to high-speed scanning and real-time requirements while ensuring high accuracy, the present invention designs a dynamic inference acceleration strategy, including: dynamically adjusting the input image resolution or triggering the network to exit early according to the real-time inference latency and system load, so as to realize real-time contraband detection and alarm output under high-speed conditions.
[0066] The dynamic resolution adjustment is performed as follows: The system monitors the inference latency and input queue length in real time. When the average inference latency of several consecutive frames exceeds the upper threshold or the queue length continues to increase, the input image resolution is reduced by a fixed step size, and the scaling factor is not lower than the lower limit. When the latency is lower than the lower threshold and the queue is empty, the resolution is restored to the highest value.
[0067] In this embodiment, the system monitors the inference latency L in real time. inf Given an input queue length Q, if the average latency of 5 consecutive frames exceeds a threshold T... delay If the latency is 80ms or the queue length continues to increase, the input image resolution will be scaled down proportionally, with the scaling factor r decreasing by 0.1 each time, starting from 1.0, and not falling below 0.5. If the latency is lower than the low threshold T, the input image resolution will be reduced accordingly. low If the timeout period is 40ms and the queue is empty, the resolution will be gradually increased to 1.0. During peak hours, the low resolution will be maintained to ensure high throughput, and during off-peak hours, the high resolution will be automatically restored to ensure the detection rate of small targets.
[0068] The network early exit mechanism is implemented as follows: An early exit branch is set up in the lightweight backbone network. The early exit branch includes convolutional layers, global average pooling layers, and fully connected layers to output the confidence scores for each category. When the maximum confidence score output by the early exit branch exceeds the early exit threshold and the predicted category is non-prohibited, the subsequent layer calculations are immediately terminated and a non-prohibited conclusion is output. When the predicted category is prohibited, early exit is not triggered regardless of the confidence score; the prohibited item must be located using the complete prohibited item detection model.
[0069] In this embodiment, early exit branches are added after the inverted residual blocks in the third and fifth stages of the backbone network, respectively. Each early exit branch acts as an auxiliary classifier, containing a convolutional layer, a global average pooling layer, and a fully connected layer, outputting the confidence scores for each class. When the image forward propagates to a particular early exit branch, the maximum confidence score p is calculated. max If p max Greater than the exit threshold T exit If the confidence level is 0.95 and the predicted category is non-contraband, then the calculation of subsequent layers should be stopped immediately, and the prediction result of this branch should be output. If the prediction is contraband, even if the confidence level is high, the algorithm should not exit prematurely. The entire network must be used for fine-grained localization and classification to ensure the accuracy of contraband detection. The exit threshold T is [not specified in the original text]. exit The value can be dynamically adjusted according to the security level of the scenario. It can be increased to 0.99 at important sites or special periods to reduce the risk of missed detections, and appropriately reduced during normal operation to improve efficiency.
[0070] Through the aforementioned temporal frame correlation analysis and dynamic reasoning acceleration mechanism, this invention can simultaneously ensure high accuracy and real-time performance in high-speed security inspection at speeds of 0.3 m / s.
[0071] The contraband detection network constructed in this embodiment adopts a lightweight backbone network with depthwise separable convolution and inverse residual structures, as well as an Anchor-Free detection head. By reducing the number of model parameters and computational load, combined with dynamic resolution adjustment and network early exit mechanism, and utilizing real-time load perception to achieve adaptive allocation of computing resources, the model can significantly improve computational efficiency while maintaining high accuracy in identifying contraband, thus solving the problem that the large computational load of existing models cannot meet the real-time requirements of high-speed scanning. In this embodiment, multi-feature fusion cross-frame target association matching based on position intersection-union ratio and appearance feature similarity is used, combined with Kalman filtering for occlusion trajectory prediction and completion, and false detection filtering through isolation judgment and continuity verification. By utilizing the temporal consistency information in the continuous scanning image sequence, temporal verification and enhancement of detection results can be achieved, improving detection stability in real-world environments such as image quality fluctuations and temporary target occlusion, thus solving the problems of false detection and missed detection due to frame-by-frame independent detection in existing technologies.
[0072] This embodiment was verified on the security screening machine of Beijing Daxing Airport Line: Implementation scenario: AT100100D security inspection machine on Beijing Daxing Airport Line, operating speed 0.3m / s, image input resolution 640×640, acquisition frame rate 25fps; The complete implementation process of data augmentation: using 1,000 real X-ray images of contraband as seeds, a text description library of 12 types of contraband with 3 levels of occlusion is constructed. StableDiffusionXL is fine-tuned to generate 50,000 synthetic images. After adaptation by the conditional generative adversarial network domain, the images are mixed into a training set with a ratio of real to synthetic images of 1:5. Network model implementation parameters: The lightweight backbone network adopts the improved MobileNetV3-Large structure, and the FPN outputs feature maps at three scales: P3, P4, and P5, with a uniform number of channels of 256; the attention-guided feature fusion module and the context enhancement module are applied to the feature maps at the three scales respectively; the detection head adopts the Anchor-Free CenterNet structure. Training rules: Adam optimizer, initial learning rate 1e -4 batchsize=16, training for 100 epochs, loss function weights for classification and localization: FocalLoss=1:5:2; Test results show that the accuracy rate of identifying typical prohibited items (covering 1,000 prohibited items in the publicly available prohibited item database) is close to 100%, and the false negative rate is close to 0. The average inference time per frame is about 182ms. The image judgment time for a single piece of luggage is reduced by 85% compared with the existing manual image judgment scheme. The existing manual method takes an average of 1.2s, while this scheme takes an average of 0.182s, which meets the real-time requirements after the security check process is accelerated.
[0073] In an embodiment of the present invention, a computer device is also provided, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the intelligent identification method for contraband in X-ray security inspection images of rail transit as described above.
[0074] The computer device can be a terminal, and its internal structure diagram can be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When executed by the processor, the computer program implements an intelligent identification method for contraband in X-ray security inspection images of rail transit. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0075] Memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), and Electrically Erasable Programmable Read-Only Memory (EEPROM). Memory stores programs, and the processor executes these programs after receiving execution instructions.
[0076] A processor can be an integrated circuit chip with signal processing capabilities. The aforementioned processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc. The processor can also be other general-purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate Arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. A general-purpose processor can be a microprocessor or any conventional processor.
[0077] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. A specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0078] In an embodiment of the present invention, a computer-readable storage medium is also provided, on which a program is stored, characterized in that: when the program is executed by a processor, it implements the intelligent identification method for contraband in X-ray security inspection images of rail transit as described above.
[0079] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, computer devices, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0080] The embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, computer apparatuses, or computer program products according to embodiments of the invention. These computer program instructions may be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart illustrations and / or block diagrams.
[0081] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means that implement the functions specified in the flowchart.
[0082] In an embodiment of the present invention, a computer program product is also provided, including a computer program / instructions, characterized in that the computer program / instructions, when executed by a processor, implement the steps of the above-described method.
[0083] In practical applications, the aforementioned computer program products include, but are not limited to, smartphones, desktop computers, laptops, tablets, host computers, and server platforms, etc., without specific restrictions.
[0084] The above provides a detailed description of the application of the intelligent identification method / computer device, computer-readable storage medium, and computer program product for contraband in X-ray security inspection images of rail transit provided by this invention. Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.
Claims
1. A method for intelligent identification of prohibited items in X-ray security inspection images of rail transit, characterized in that, Includes the following steps: S1: Obtain real X-ray images of contraband in rail transit security inspection scenarios as seed samples, and construct a text description library corresponding to the contraband category, pose, and degree of occlusion; based on the seed samples and the text description library, generate X-ray composite images of contraband through a generative model, and use a conditional generative adversarial network to perform domain adaptation adjustment on the X-ray composite images of contraband to obtain an augmented dataset consistent with the distribution of real X-ray images. S2: Based on the target size and occlusion ratio, assign sampling weights to the samples in the augmented dataset, and perform adaptive oversampling according to the sampling weights to increase the sampling probability of small target samples and occluded samples during the training process, thereby obtaining a balanced augmented training dataset; S3: Construct a contraband detection network, which includes a lightweight backbone network, a multi-scale feature pyramid, an attention-guided feature fusion module, and an Anchor-Free detection head. The lightweight backbone network is used to extract feature maps at different scales. The multi-scale feature pyramid is used to fuse features at different scales. The attention-guided feature fusion module is used to perform channel weighting and spatial weighting on cross-scale features and to inject global context information into the feature maps. The Anchor-Free detection head is used to predict the feature maps and output the category, location, and confidence level of the contraband. S4: Train the contraband detection network using a balanced augmentation training dataset and real X-ray images to obtain a trained contraband detection model; S5: Input the continuous X-ray image sequence to be detected into the trained contraband detection model, perform temporal correlation analysis on the detection results of adjacent frames, including target association matching based on position intersection-union ratio and appearance feature similarity, trajectory prediction and completion for temporarily occluded targets, filter out false detections, and output contraband detection results.
2. The intelligent identification method for prohibited items in X-ray security inspection images of rail transit according to claim 1, characterized in that: In step S1, the generative model is a diffusion model, and the text description library includes description information in at least three dimensions: prohibited item category, placement posture, and occlusion level. Small target prohibited item samples, partially occluded prohibited item samples, and overlapping prohibited item samples are generated by adjusting the text prompt words.
3. The intelligent identification method for prohibited items in X-ray security inspection images of rail transit according to claim 2, characterized in that: In step S1, the conditional generative adversarial network includes a generator and a discriminator. The generator receives the synthesized image and its semantic conditions and outputs the adjusted image. The discriminator receives the image and the semantic conditions and outputs the image patch-level authenticity determination result. The training loss of the conditional generative adversarial network includes at least adversarial loss, content preservation loss, and cycle consistency loss.
4. The intelligent identification method for prohibited items in X-ray security inspection images of rail transit according to claim 2, characterized in that: Step S2 is executed as follows: Calculate the target size and occlusion ratio. The target size is the ratio of the area of the target bounding box to the area of the entire image. The occlusion ratio is the ratio of the area of the target occluded by other objects to the total area of the target. Alternatively, when only the bounding box is labeled, the occlusion ratio is obtained from the proportion of non-target pixels within the target box. Based on the target size and occlusion ratio, the sampling weight w for each sample i is... i From the target size s i and occlusion ratio o i The following weighting function was jointly adopted: w i =a· +b·o i +g Where α and β are balance coefficients. γ is a constant, and it is the base weight. The sampling weights are updated before each training cycle, and when constructing training batches, they are determined according to the sampling weights w. i Non-uniform probability random sampling is performed so that the sampling probability of small targets and occluded samples is higher than that of regular samples.
5. The intelligent identification method for prohibited items in X-ray security inspection images of rail transit according to claim 4, characterized in that: In step S2, additional data augmentation is performed on the sampled image, including random rotation and color jitter.
6. The intelligent identification method for prohibited items in X-ray security inspection images of rail transit according to claim 1, characterized in that: The lightweight backbone network includes depthwise separable convolutional blocks and inverted residual structure blocks. Each inverted residual structure block is expanded using a fixed expansion rate. The lightweight backbone network outputs basic feature maps at least three scales. The multi-scale feature pyramid performs channel alignment, upsampling, and feature fusion on the base feature map to obtain multi-scale feature maps of different scales. The attention-guided feature fusion module includes a cross-scale attention fusion module and a context enhancement module. The cross-scale attention fusion module includes: The channel attention submodule is used to generate channel weights through global average pooling and fully connected layers; The spatial attention submodule is used to generate a spatial location weight map through convolution operations; the channel weights and spatial location weights are used to weight and enhance the multi-scale feature map, and output a weighted fused feature map. The context enhancement module is used to perform global average pooling on multi-scale features to obtain a global context feature vector, which is then compressed and expanded by a fully connected layer and added to the original feature map to inject global context information into the feature map. The weighted fusion feature map is fused with the feature map injected with global context information to output enhanced feature maps at multiple scales; The Anchor-Free detection head processes the enhanced feature maps at each scale through multiple convolutional layers; it merges and decodes the prediction results from multiple scales, performs non-maximum suppression, and outputs the final detection box's category, location coordinates, and confidence score.
7. The intelligent identification method for prohibited items in X-ray security inspection images of rail transit according to claim 1, characterized in that: In step S4, the contraband detection network is trained using a multi-task joint loss, which includes at least classification loss, localization loss, and focusing loss, wherein the focusing loss is used to enhance the learning ability for small target samples and occluded samples. The multi-task joint loss function is: L total =λ cls L cls +λ loc L loc +λ focal L focal Among them, L cls For the classification cross-entropy loss of all prohibited item categories, L loc To predict the Smooth L1 localization loss between the bounding box and the ground truth box, L focal For the focusing loss of the small target classification branch, λ cls , λ loc , λ focal These are the weight coefficients corresponding to the loss, and λ loc Greater than λ cls To enhance positioning accuracy, λ focal Greater than λ cls To enhance the learning of small targets and occluded targets.
8. The intelligent identification method for prohibited items in X-ray security inspection images of rail transit according to claim 1, characterized in that: In step S5, the target association matching is performed as follows: The intersection-union ratio (IUR) of the current frame detection box and the trajectory prediction box of the previous frame is calculated, and the IUR exceeding the first threshold is used as a candidate matching condition. The appearance feature vector of the detection box is calculated through a lightweight appearance feature extraction network, and the cosine similarity exceeding the second threshold is used as a matching confirmation condition. Combining the two conditions, the Hungarian algorithm is used to perform global optimal matching, and the unmatched detection boxes are processed as new targets, and the unmatched trajectories enter the occlusion processing process. The trajectory prediction and completion for temporarily occluded targets is performed as follows: When a matched target has no corresponding detection box in the current frame, the Kalman filter is activated to predict the position of the current frame based on the target's historical motion state, and the predicted box is used to participate in the association of subsequent frames; if the detection box and the predicted box in the subsequent frame match successfully, normal tracking is resumed and the filter state is updated; if the number of consecutive disappearing frames exceeds the maximum tolerable number of frames, the trajectory of the target is terminated. The specific steps for filtering out false detections are as follows: For newly appearing detection boxes with a confidence level below the third threshold, if there are no detection boxes overlapping with its position or having similar features in the preceding and following N frames, it is determined to be an isolated false detection and discarded; for new detection boxes with a high confidence level, they are marked as candidate targets, and are converted into official targets only when they can be associated with the target in the subsequent M consecutive frames.
9. The intelligent identification method for prohibited items in X-ray security inspection images of rail transit according to claim 1, characterized in that: Step S5 also includes: executing a dynamic inference acceleration strategy, which includes: dynamically adjusting the input image resolution or triggering the network to exit early based on the real-time inference latency and system load, in order to achieve real-time detection of contraband and alarm output under high-speed conditions.
10. The intelligent identification method for prohibited items in X-ray security inspection images of rail transit according to claim 9, characterized in that: The dynamic resolution adjustment is performed as follows: The system monitors the inference latency and input queue length in real time. When the average inference latency of several consecutive frames exceeds the upper threshold or the queue length continues to increase, the input image resolution is reduced by a fixed step size, and the scaling factor is not lower than the lower limit. When the latency is lower than the lower threshold and the queue is empty, the resolution is restored to the highest value.
11. The intelligent identification method for prohibited items in X-ray security inspection images of rail transit according to claim 9, characterized in that: The network early exit mechanism is implemented as follows: An early exit branch is set in the lightweight backbone network. The early exit branch includes a convolutional layer, a global average pooling layer, and a fully connected layer to output the confidence scores for each category. When the maximum confidence score output by the early exit branch exceeds the early exit threshold and the predicted category is non-prohibited, the subsequent layer calculations are immediately terminated and a non-prohibited conclusion is output. When the predicted category is prohibited, early exit is not triggered regardless of the confidence score.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the intelligent identification method for contraband in X-ray security inspection images of rail transit as described in any one of claims 1 to 11.
13. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by the processor, it implements the intelligent identification method for contraband in X-ray security inspection images of rail transit as described in any one of claims 1 to 11.
14. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method according to any one of claims 1 to 11.