De-occlusion method, device and equipment for security image and storage medium
By constructing a paired dataset with physical consistency in X-ray imaging and training a conditional denoising diffusion probability model, the problem of accurately eliminating specific strong obstructions in security inspection images was solved. The generated image content is consistent with the background, reducing the missed detection rate and improving security inspection efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUNAN SUKE INTELLIGENT TECH CO LTD
- Filing Date
- 2026-05-21
- Publication Date
- 2026-06-19
AI Technical Summary
Existing technologies cannot accurately eliminate specific strong obstructions in security inspection images at the pixel level. They require additional annotation information and are not compatible with the physical characteristics of X-ray imaging, which increases the visual burden on security personnel and the risk of missing prohibited items.
A paired dataset conforming to the physical consistency of X-ray imaging is constructed, a conditional denoising diffusion probability model is trained, and the model is optimized through a cross-attention mechanism and a region-aware weighted loss to directly output an occluded image with specific strong occlusions removed.
It achieves precise positioning and eliminates strong obstructions, and the generated image content is consistent with the background, reducing the missed detection rate and improving security inspection efficiency and security.
Smart Images

Figure CN122243802A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of security inspection image processing technology, specifically a method, apparatus, device, and storage medium for removing occlusion from security inspection images. Background Technology
[0002] In security checks at public transportation hubs such as airports, subways, and train stations, as well as other important locations, X-ray imaging technology, with its strong penetration and high detection efficiency, has become a core technology for screening potentially contraband inside luggage. However, due to the disorderly stacking of items inside luggage and the limitations of X-ray imaging principles, strong obstructions such as laptops, tablets, large power adapters, and umbrellas often completely or partially obscure items behind or below them, creating significant image interference areas. This obstruction not only blurs the outline, texture, and material characteristics of the obscured items but also causes the imaging signals of different items to overlap, greatly increasing the visual burden and cognitive difficulty for security personnel to manually interpret the images. It also significantly increases the risk of missing contraband, posing a potential threat to public safety. Summary of the Invention
[0003] The purpose of this application is to provide a method, apparatus, device and storage medium for removing occlusions from security inspection images, so as to solve the technical problems in the prior art that it is impossible to directly and accurately eliminate specific strong occlusions at the pixel level, requires additional annotation information, and is not compatible with the physical characteristics of X-ray imaging.
[0004] To achieve the above objectives, this application provides a method for removing occlusion from security inspection images, wherein the security inspection image is an image acquired by security inspection equipment through an X-ray device, and the occlusion is an obstruction area formed by a strong obstruction that easily interferes with image interpretation; including: Construct a paired dataset that conforms to the physical consistency of X-ray imaging. This paired dataset includes multiple sets of image pairs, each set of image pairs including an unobstructed image and a corresponding occluded image with a specific strong occluder. Using a paired dataset, a conditional denoising diffusion probability model for mapping from occluded images to unoccluded images is trained. The occluded image is used as the only conditional input, and multi-scale features of the occluded image are injected through a cross-attention mechanism. The conditional denoising diffusion probability model is optimized by combining region-aware weighted loss. The occluded images acquired in real time are input into a pre-trained conditional denoising diffusion probability model, which directly outputs an occluded image by removing specific strong occluders.
[0005] Preferably, a classifier-free guidance strategy is used to train the conditional denoising diffusion probability model, including: During training, conditional inputs are replaced with empty labels with preset probabilities, and conditional and unconditional noise predictions are learned simultaneously. During inference, the constraint strength of the conditional input is amplified by a guiding scale to force the generated content to align and occlude the target; the guiding scale is a preset adjustable parameter.
[0006] Preferably, the conditional denoising diffusion probability model optimized by combining region-aware weighted loss includes: When training the conditional denoising diffusion probability model, a region-aware weighted loss function is constructed using a binary mask of a specific strong occlusion generated during the synthesis stage. The pixel loss in the occluded area is assigned a greater weight than that in the non-occluded area, prioritizing the optimization of the reconstruction accuracy of the occluded area; the synthesis stage is determined based on the construction of the paired dataset.
[0007] Preferably, the conditional denoising diffusion probability model is trained by injecting conditional input through a cross-attention mechanism, including: Extract the multi-scale features corresponding to the conditional input; Using the intermediate features of the conditional denoising network of the conditional denoising diffusion probability model as the query vector, and the multi-scale features as the key and value, the conditional denoising process dynamically focuses on the occlusion region and context information; wherein, the intermediate features are the intermediate feature maps generated by the conditional denoising network at each residual level.
[0008] Preferably, when training the conditional denoising diffusion probability model, a joint probability distribution is established with the occluded image as the only conditional input, so that the entire inverse denoising process is constrained by this conditional input; each step of inverse denoising refers to the input occluded image, so that the generated unoccluded image corresponds one-to-one with the input occluded image.
[0009] Preferably, the core of the conditional denoising diffusion probability model is a conditional denoising network; the input of the conditional denoising network is the noisy image at the current time step, the time step information, and the conditional input, and the output is the Gaussian noise added to the noisy image at that time step.
[0010] Preferably, the determination of the synthesis stage is as follows: for any image pair in the paired dataset, the occluded image of the image pair with a specific strong occluder includes a synthesized image obtained by injecting the specific strong occluder into the corresponding unoccluded image, and the injection process is defined as the synthesis stage.
[0011] To achieve the above objectives, this application also provides a security inspection image de-occlusion device, which applies the security inspection image de-occlusion method described above, including: The pairing construction module is configured to: construct a pairing dataset that conforms to the physical consistency of X-ray imaging. The pairing dataset includes multiple sets of image pairs, each set of image pairs including an unoccluded image and a corresponding occluded image with a specific strong occluder. The model training module is configured to: train a conditional denoising diffusion probability model for mapping from occluded images to unoccluded images, with the occluded image as the only conditional input, inject multi-scale features of the occluded image through a cross-attention mechanism, and optimize the conditional denoising diffusion probability model by combining region-aware weighted loss. The conditional denoising module is configured to input real-time acquired occluded images into a trained conditional denoising diffusion probability model and directly output an occluded image that removes specific strong occluders.
[0012] To achieve the above objectives, this application also provides a device for removing obstructions from security inspection images, including at least one processor, at least one memory, and a data bus; The processor and the memory communicate with each other via the data bus; The memory stores program instructions that can be executed by the processor, which calls the program instructions to execute the security image de-obstruction method as described above.
[0013] To achieve the above objectives, this application also provides a storage medium storing a computer program thereon, which, when executed by a processor, implements the security inspection image de-obstruction method described above.
[0014] The method, apparatus, device, and storage medium for removing occlusion from security inspection images disclosed in this application have at least the following beneficial effects: Training a dedicated model directly for a strongly occluded object, for example, training a conditional denoising diffusion probability model for a laptop computer or a conditional denoising diffusion probability model for an umbrella, can accurately locate and eliminate its image, rather than performing general image completion that may result in distortion.
[0015] High content fidelity: Based on the powerful generation prior of the conditional denoising diffusion probability model and the transformation relationship learned from paired data, the reconstructed content of the occluded area is consistent with the surrounding background and can better restore the key visual features such as the outline and material of the original object. In particular, it has good recovery potential for details of possible contraband.
[0016] Automation and Scalability: By combining automated techniques for injecting contraband into the training data, the costly and time-consuming manual data collection and labeling are avoided. The framework can also be extended to remove other specific types of obstructions, such as large power adapters and stacks of books.
[0017] Improved interpretation efficiency: The generated enhanced image directly removes the main obstructions that interfere with interpretation, providing security personnel with a clearer and more complete view of the baggage interior, which is expected to significantly reduce the missed detection rate and improve the overall efficiency and security of the security checkpoint. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 A flowchart illustrating a method for removing occlusion from security inspection images provided in an embodiment of this application; Figure 2 A structural block diagram of a security inspection image removal device provided in an embodiment of this application; in the figure: 10, pairing construction module; 20, model training module; 30, conditional denoising module; Figure 3 This is an example image of an occluded image provided in an embodiment of this application. In the image, the strong occluder is a laptop computer. Figure 4 The example image provided in this application is for an occluded image, and the corresponding enhanced unoccluded image is obtained by using the security inspection image de-occlusion method of this embodiment.
[0020] The implementation, functional features, and advantages of this invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0021] The technical solutions in the embodiments of this application will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0022] In this document, the term "comprising" is intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0023] The strong obstructions mentioned in this embodiment refer to items that cause significant image interference in X-ray security imaging and are prone to leading to security inspection errors. These mainly include two categories: one is items that X-rays can penetrate but have complex internal structures, such as laptops, tablets, and large power adapters, whose multi-layered metal and non-metal structures will overlap with the imaging signals of background items; the other is high-density items that X-rays cannot penetrate, such as umbrellas and metal containers, which will form a nearly pure black completely obstructing area, resulting in a complete loss of background information. In actual security inspection processes, strong obstructions generally refer to items that need to be inspected separately.
[0024] To address the interference issues in security inspection images caused by strong occlusions, existing technologies have fundamental limitations: Deep learning-based target detection optimization approaches are essentially occlusion-tolerant, meaning they don't eliminate the occluders themselves. They only optimize the algorithm to allow the detection model to extract limited information from unoccluded areas for target recognition even with occlusion features present. This only improves robustness when occlusion is present, but cannot restore the original information of the occluded area at the pixel level. Generative AI-based image synthesis approaches can only achieve forward synthesis of contraband to expand the dataset, without addressing technical solutions for reverse-engineering specific occlusions from real images containing occlusions. General image de-occlusion techniques, such as the DeepFill series image restoration models, LaMa large-mask image restoration models, and contextual attention restoration models, require additional input of occlusion mask annotations, making them unsuitable for unannotated real-time security inspection scenarios and difficult to guarantee the physical consistency of X-ray image restoration content. Furthermore, in real-world security inspection scenarios, it's impossible to obtain a large number of naturally paired images of the same baggage without specific strong occlusions, becoming a core bottleneck restricting the implementation of pixel-level de-occlusion technology.
[0025] Therefore, this embodiment discloses a method, apparatus, device, and storage medium for removing occlusions from security inspection images. In summary, this embodiment is a technique for removing occlusions and reconstructing content in X-ray security inspection images, and is a diffusion-based method for enhancing X-ray security inspection images. This embodiment can process input real security X-ray images containing strong obstructions, remove the strong obstruction areas, and reconstruct the clear background content of the obstructed areas based on image context information and prior data distribution, thereby generating an enhanced image without strong obstructions. It is particularly suitable for eliminating image occlusions caused by strong obstructions in passengers' carry-on luggage, assisting security personnel in making more accurate and efficient interpretations.
[0026] The method, apparatus, device, and storage medium for removing occlusions from security inspection images in this embodiment will now be described in detail.
[0027] Reference Figure 1 , Figure 1 This is a flowchart illustrating a method for removing occlusion from security inspection images provided in an embodiment of this application.
[0028] Firstly, such as Figure 1 As shown, this embodiment discloses a method for removing occlusion from security inspection images. The security inspection image is an image acquired by a security inspection device using an X-ray machine, and the occlusion is a strong obstruction forming an area that easily interferes with image interpretation. The specific steps of this embodiment are as follows. It should be noted that a laptop computer is selected as a typical strong obstruction for the sake of illustration in this embodiment.
[0029] This embodiment aims to achieve end-to-end pixel-level occlusion removal by training a conditional denoising diffusion probability model. A key prerequisite for model training is obtaining high-quality paired training data. Addressing the industry bottleneck of not being able to acquire a large number of naturally paired images of the same luggage without specific strong occlusions in real-world security inspection scenarios, this embodiment first constructs a paired dataset that conforms to the physical characteristics of X-ray imaging through automated synthesis, providing a reliable data foundation for subsequent model training. See S10 for details.
[0030] S10: Construct a paired dataset that conforms to the physical consistency of X-ray imaging. This paired dataset includes multiple image pairs, each of which includes an unobstructed image and a corresponding occluded image with a specific strong occluder.
[0031] Specifically, the determination of the synthesis stage is as follows: for any image pair in the paired dataset, the occluded image of the image pair with a specific strong occluder includes the synthesized image obtained by injecting the specific strong occluder into the corresponding unoccluded image, and the injection process is defined as the synthesis stage.
[0032] In this specific application, an automated contraband injection technique is used to construct a large-scale training set of X-ray security images paired with corresponding strong obstructions. It should be noted that the automated contraband injection technique proposed in this embodiment can be, but is not limited to, an augmentation technique for security X-ray images.
[0033] Taking laptops as an example, a large number of real X-ray security inspection images without laptops are collected as a background image library. Most of these X-ray security inspection images without laptops come from actual security inspection scenarios.
[0034] By utilizing X-ray image augmentation technology, X-ray images of various laptops are intelligently composited into the aforementioned background image at random or specified locations. The compositing process considers the physical consistency of X-ray imaging, such as simulating penetration and attenuation effects under different angles and stacking relationships. This allows for the automated generation of an image corresponding to each background image, including the laptop as a strong obstruction.
[0035] The synthesized images undergo quality screening and correction to ultimately form a high-quality paired dataset. ,in: The original, unobstructed image can be an original image without the laptop computer obstructing it. The corresponding synthesized image with occlusion could be an image obscured by a laptop computer.
[0036] The aforementioned paired dataset, by simulating the physical characteristics of real X-ray imaging, solves the core bottleneck of not being able to obtain naturally paired training samples in real security inspection scenarios, providing high-quality, physically consistent supervision signals for training the generative de-occlusion model, i.e., the conditional denoising diffusion probability model. Based on this paired dataset, this embodiment further trains the conditional denoising diffusion probability model, enabling it to accurately learn the separation rules between the imaging features of specific strong occlusions and background content through targeted conditional injection mechanisms and loss function design. See S20 for details.
[0037] S20: Using a paired dataset, train a conditional denoising diffusion probability model for mapping from occluded images to unoccluded images. With the occluded image as the only conditional input, inject multi-scale features of the occluded image through a cross-attention mechanism, and combine region-aware weighted loss to optimize the conditional denoising diffusion probability model.
[0038] S20 aims to train a conditional denoising diffusion probability model, enabling it to learn from occluded images. To clear, unobstructed images The mapping relationship and underlying data distribution are discussed. The training and output of the conditional denoising diffusion probability model are now elaborated from four parts: mathematical principles, model architecture, conditional injection mechanism, and training objectives.
[0039] The design of the conditional denoising diffusion probability model in this embodiment will now be explained based on the fundamental mathematical definition of the diffusion model.
[0040] Clear, unobstructed images Defined as The diffusion process is divided into two stages: forward noise addition and reverse noise removal.
[0041] For the forward noise addition process, at the total time step Inside, gradually towards Add Gaussian noise to generate a noise sequence The addition process follows a Markov chain, and the mathematical expression for the single-step transition probability is: in: Indicates in Time step Image after adding Gaussian noise; Indicates in The forward diffusion process at the time step, or the noise addition process. Represent a multivariate Gaussian distribution; It is the mean vector of this distribution, which determines the center position of the image after noise is added. For a predefined noise variance table, and ; Represents the identity matrix. It is the covariance matrix of the distribution, which determines the intensity and correlation of noise in each dimension, i.e., in each pixel channel of the image.
[0042] Furthermore, , ,in, This is the index symbol. Due to the linear transformation and additivity properties of the Gaussian distribution, it can be directly derived from... Sampling at any time Noisy image: in: express At time step, a randomly generated noise map, and .
[0043] For the reverse denoising process: the model needs to learn from pure noise Gradually restore The inverse denoising process is approximated by a parameterized neural network: in: This represents the inverse distribution defined by the model; express The values of follow a Gaussian distribution; This represents the mean of the distribution, i.e., the mean of the trained U-Net model based on the input. and time step Predicted Most likely value; This represents the covariance matrix of the distribution, the variance of the distribution predicted by the model, which determines the uncertainty of the prediction. In most implementations, for simplicity, it is often fixed to a value similar to... Related constants.
[0044] In practical applications, the above-mentioned unconstrained reverse diffusion process needs to be modified after introducing the conditional constraint of security image de-occlusion. The occluded input image is injected as the only condition into each step of the reverse denoising process, so that the unoccluded image generated by the model corresponds strictly to the occluded input image, rather than being generated arbitrarily.
[0045] The model architecture of this embodiment will now be described.
[0046] Specifically, when training the conditional denoising diffusion probability model, a joint probability distribution is established with the occluded image as the only conditional input, so that the entire inverse denoising process is constrained by this conditional input; each step of inverse denoising refers to the input occluded image, so that the generated unoccluded image corresponds one-to-one with the input occluded image.
[0047] In a preferred embodiment of this example, the core of the conditional denoising diffusion probability model is a conditional denoising network; the input of the conditional denoising network is the noisy image at the current time step, the time step information, and the conditional input, and the output is the Gaussian noise added to the noisy image at that time step.
[0048] In one specific application of this embodiment, the generation process is constrained by a single input condition, namely, an occluded image. Constraints, establish a conditional diffusion model, define Its joint distribution is defined as: in: It refers to under given conditions Below, the entire image sequence The joint probability distribution of ; Conditional information, i.e., the input image containing occlusion. For example, an X-ray image obscured by a laptop computer serves as a constraint on the entire generation process. The starting point distribution usually refers to standard Gaussian noise; It is a series of inverse conditional processes, emphasizing that each denoising step references the input image with strong occlusions. This ensures that the final sharp image is specific to this image with strong occlusions. The result of the repair is not to arbitrarily generate a clear X-ray image.
[0049] In summary, the core of the conditional denoising diffusion probability model in this embodiment is training the conditional denoising network. Used to predict under given conditions and time step When, add to Noise in .
[0050] The conditional injection mechanism of this embodiment will now be explained.
[0051] Specifically, the conditional denoising diffusion probability model is trained by injecting conditional input through a cross-attention mechanism, including: Extract the multi-scale features corresponding to the conditional input; Using the intermediate features of the conditional denoising network of the conditional denoising diffusion probability model as the query vector, and the multi-scale features as the key and value, the conditional denoising process dynamically focuses on the occlusion region and context information; wherein, the intermediate features are the intermediate feature maps generated by the conditional denoising network at each residual level.
[0052] In the specific application of this embodiment, conditional input Multi-scale features extracted using a lightweight convolutional encoder At each residual level of the conditional denoising network U-Net, conditional inputs are processed through cross-attention. : Using U-Net intermediate features as query vectors Conditional features For key Sum ,calculate: in, Key vector This allows the denoising process to dynamically focus on the occluded areas to be removed and the context to be preserved.
[0053] Thus, full-scale fusion of conditional inputs is achieved based on the aforementioned cross-attention mechanism. To further enhance the controllability of conditional constraints and prevent generated content from deviating from the de-occlusion target, this embodiment introduces a classifier-free guidance strategy to optimize the training and inference process of the conditional denoising diffusion probability model.
[0054] Specifically, the conditional denoising diffusion probability model is trained using a classifier-free guidance strategy, including: During training, conditional inputs are replaced with empty labels with preset probabilities, and conditional and unconditional noise predictions are learned simultaneously. During inference, the constraint strength of the conditional input is amplified by a guiding scale to force the generated content to align and occlude the target; the guiding scale is a preset adjustable parameter.
[0055] In this specific application, a classifier-free guidance strategy is used to enhance conditional control. During training, a preset probability is used. Will Replace with empty tags Model synchronous learning conditional noise prediction With unconditional noise prediction The final noise prediction during inference is: in: This is an unconditional noise prediction, representing the model's prior knowledge of general X-ray images; For conditional noise prediction, it represents the noise predicted after the model observes the occlusion map and the noise map; To guide the scale, amplify the conditional input. The model is designed to force the generated content to strictly align with the goal of removing strong occluders and restoring the background. In other words, the model is based on specific images of strong occluders to remove occlusions, rather than relying on generalized experience to reconstruct the content of the occluded parts. This is the guided noise prediction value that is ultimately used for denoising.
[0056] Therefore, the classifier-free guidance strategy described above in this embodiment strengthens the conditional constraints at the reasoning level. To further improve the model's reconstruction accuracy of occluded regions, this embodiment optimizes the loss function design by introducing a region-aware weighted loss function.
[0057] Specifically, the conditional denoising diffusion probability model optimized by combining region-aware weighted loss includes: When training the conditional denoising diffusion probability model, a region-aware weighted loss function is constructed using a binary mask of a specific strong occlusion generated during the synthesis stage. The pixel loss in the occluded area is assigned a greater weight than that in the non-occluded area, prioritizing the optimization of the reconstruction accuracy of the occluded area; the synthesis stage is determined based on the construction of the paired dataset.
[0058] In this specific application, a binary mask with strong occlusions known during the synthesis stage is introduced. , , Indicates image height, This represents the image width, for example, a binary mask for a laptop.
[0059] Based on binary mask Apply region weighting to the loss function: in: The weighting coefficient for the occluded area is set to a value in this embodiment. ;⊙ indicates element-wise multiplication, forcing the model to prioritize the accuracy of content reconstruction in the notebook area.
[0060] By introducing a binary mask of strong occlusions generated during the synthesis stage to weight the loss function by region, this embodiment specifically strengthens the model's constraints on the reconstruction of occluded regions. This forces the model to prioritize optimizing the prediction accuracy of occluded regions rather than distributing optimization weights evenly, thereby significantly improving the removal effect of strong occlusions such as laptops and the restoration quality of background contraband. It effectively solves the problems of background content distortion and occlusion residue that are prone to occur in general loss functions in de-occlusion tasks.
[0061] The training objective of this embodiment will now be explained.
[0062] In this specific application, a latent space diffusion architecture is employed. The image is encoded and compressed into a low-dimensional latent space by a variational autoencoder before diffusion is performed. The decoder maps the result back to the pixel space, significantly reducing computational overhead. The AdamW optimizer is used, with a learning rate of [missing information]. Batch size 8, trained on 4×A100 GPUs Step, after convergence, the model masters the... arrive The deterministic transformation prior.
[0063] Based on S20, the model training in this embodiment is an end-to-end conditional diffusion model training process with occluded images as the only conditional input. Through the combined design of physically consistent paired data construction, cross-attention conditional injection, classifier-free guided constraints, and region-aware weighted loss, the accurate elimination of specific strong occlusions in security inspection X-ray images is achieved.
[0064] At the data construction level, this embodiment automatically synthesizes and constructs a paired dataset that conforms to the physical consistency of X-rays, which solves the industry bottleneck of no natural paired samples in real security inspection scenarios. Unlike general demasking techniques that rely on additional mask annotations, pixel-level demasking models can be trained without manual annotation.
[0065] At the conditional injection level, this embodiment uses the occluded image as the only conditional input and injects the conditional features into the entire U-Net layer through the cross-attention mechanism. This ensures that each step of inverse denoising references the input image, guaranteeing that the generated result corresponds one-to-one with the input, rather than the unconstrained generation of the general diffusion model. This avoids the defects of existing technologies that are prone to distortion in generalized reconstruction.
[0066] At the control and optimization level, the classifier-free guidance strategy amplifies the strength of conditional constraints, forcing the generated content to align with and remove occlusions of targets; the region-aware weighted loss utilizes the binary mask from the synthesis stage to assign higher weights to the loss of occluded regions, prioritizing the optimization of reconstruction accuracy. This dual control mechanism, combining inference constraints and loss optimization, is a targeted design for security inspection scenarios.
[0067] Overall, this embodiment, through the above-mentioned collaborative design, overcomes the limitations of existing technologies that cannot tolerate occlusion or cannot be trained without annotation, and achieves end-to-end de-occlusion that is physically consistent, precise and controllable without additional annotation.
[0068] The real image to be processed, which contains strong occlusions such as an X-ray security inspection image of a laptop, is input into a trained conditional denoising diffusion probability model. The inverse denoising process is then performed to generate an enhanced, de-occluded image.
[0069] S30: Input the real-time acquired occluded image into the trained conditional denoising diffusion probability model, and directly output the occluded image after removing specific strong occluders.
[0070] In this specific application, the input image is mapped to a latent space by an encoder. In the latent space, starting with random Gaussian noise, and guided by the conditional input (i.e., the occluded input image), multi-step iterative denoising is performed. At each step, the model predicts and removes a portion of the noise based on the current noise state and conditional information, gradually restoring the image content without strong occlusions; for example, restoring the image content without the laptop computer obstructing the view. After denoising, the resulting sharp latent representation is reconstructed back into the pixel space by a decoder, outputting the final enhanced, occluded image.
[0071] Reference Figure 2 , Figure 2 The diagram shows a structural block diagram of a device for removing occlusion from security inspection images provided in an embodiment of this application; in the diagram: 10, pairing construction module; 20, model training module; 30, conditional denoising module.
[0072] Secondly, such as Figure 2 As shown, this embodiment also discloses a security inspection image de-occlusion device, which applies the security inspection image de-occlusion method described above, including: The pairing construction module 10 is configured to construct a pairing dataset that conforms to the physical consistency of X-ray imaging. The pairing dataset includes multiple sets of image pairs, each set of image pairs including an unobstructed image and a corresponding occluded image with a specific strong occluder.
[0073] The model training module 20 is configured to: train a conditional denoising diffusion probability model for mapping from occluded images to unoccluded images, with the occluded image as the only conditional input, inject multi-scale features of the occluded image through a cross-attention mechanism, and optimize the conditional denoising diffusion probability model by combining region-aware weighted loss.
[0074] The conditional denoising module 30 is configured to input the real-time acquired occluded image into the trained conditional denoising diffusion probability model and directly output an occluded image that removes specific strong occluders.
[0075] Thirdly, this embodiment also discloses a security inspection image de-obstruction device, including at least one processor, at least one memory, and a data bus.
[0076] The processor and the memory communicate with each other via the data bus.
[0077] The memory stores program instructions that can be executed by the processor, which calls the program instructions to execute the security image de-obstruction method as described above.
[0078] Fourthly, this embodiment also discloses a storage medium storing a computer program thereon, which, when executed by a processor, implements the security inspection image de-occlusion method described above.
[0079] It should be noted that the image de-occlusion device, equipment, and storage medium in this embodiment correspond to the aforementioned image de-occlusion method for security inspection. Therefore, any content not specifically described in the image de-occlusion device, equipment, and storage medium in this embodiment, including but not limited to functional definitions, working principles, and technical effects, can be referred to the description in the aforementioned image de-occlusion method for security inspection, and will not be repeated here.
[0080] The method, apparatus, device, and storage medium for removing occlusions from security inspection images in this embodiment will now be described with reference to specific examples.
[0081] This specific example aims to eliminate laptop obstruction in X-ray security inspection images. The specific implementation steps are as follows: Data preparation: 10,000 X-ray images without laptops were selected from a rail transit security inspection dataset as backgrounds. Using image augmentation techniques for security X-rays, a laptop was composited at random locations in each background image, using the laptop as the foreground element, generating corresponding occlusion images. During composite processing, the generation intensity was adjusted to simulate the imaging differences between different brands and models of laptops. Finally, 10,000 pairs of images were obtained. The images are divided into training, validation, and test sets in an 8:1:1 ratio.
[0082] Model training: The pre-trained U-Net weights from Stable Diffusion 1.4 were used for initialization.
[0083] In the paired data As conditional input. In U-Net, conditional injection is achieved by adding a cross-attention layer after each residual block, where the key and value come from... Features extracted by a lightweight encoder; Query is derived from intermediate features of U-Net.
[0084] The loss function employs L2 loss based on noise prediction. Simultaneously, a region-weighted loss is introduced: utilizing the laptop mask known at the time of synthesis, higher weights are assigned to the pixel loss within the masked region (e.g., 2.0), while lower weights are assigned to areas outside the masked region (e.g., 0.5), to focus on the reconstruction quality of occluded areas.
[0085] Using the AdamW optimizer, with a learning rate of 1e-5 and a batch size of 8, we trained for 100,000 steps on four NVIDIA A100 GPUs.
[0086] Reasoning Applications: Reference Figure 3 and Figure 4 . Figure 3 This is an example image of an occluded image provided in an embodiment of this application. In the image, the strong occlusion is a laptop computer. Figure 4 This is an example diagram for an occluded image provided in an embodiment of this application, namely... Figure 3 The corresponding enhanced unobstructed image is obtained by using the security inspection image de-occlusion method of this embodiment.
[0087] like Figure 3 and Figure 4 As shown, a real X-ray image of luggage, including a laptop computer obstructing the view, is input into the trained model. The denoising steps are set to 50, and the DDIM sampler is used to balance speed and quality. The model outputs an enhanced, unobstructed image of the same size, where the laptop area has been replaced with reasonable background content inferred from the context. Security personnel can simultaneously view the original and enhanced images, focusing on the previously obstructed area for comprehensive interpretation.
[0088] In summary, the method, apparatus, device, and storage medium for removing occlusions from security inspection images in this embodiment have the following significant advantages compared to the prior art: Precise occlusion removal: This embodiment directly trains a dedicated model for strong occlusion objects. For example, a conditional denoising diffusion probability model for laptops is trained for laptops, and a conditional denoising diffusion probability model for umbrellas is trained for umbrellas. This can accurately locate and eliminate their images, rather than performing general image completion that may be distorted.
[0089] High content fidelity: Based on the powerful generation prior of the conditional denoising diffusion probability model and the transformation relationship learned from paired data, the reconstructed content of the occluded area is consistent with the surrounding background and can better restore the key visual features such as the outline and material of the original object. In particular, it has good recovery potential for details of possible contraband.
[0090] Automation and Scalability: By combining automated techniques for injecting contraband into the training data, the costly and time-consuming manual data collection and labeling are avoided. The framework can also be extended to remove other specific types of obstructions, such as large power adapters and stacks of books.
[0091] Improved interpretation efficiency: The generated enhanced image directly removes the main obstructions that interfere with interpretation, providing security personnel with a clearer and more complete view of the baggage interior, which is expected to significantly reduce the missed detection rate and improve the overall efficiency and security of the security checkpoint.
[0092] In the embodiments provided in this application, it should be understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, code, or any suitable combination thereof. For hardware implementation, the processor may be implemented in one or more of the following: application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, other electronic units designed to implement the functions described herein, or combinations thereof. For software implementation, some or all of the processes of the embodiments may be performed by a computer program instructing the associated hardware. During implementation, the program may be stored in a computer-readable storage medium or transmitted as one or more instructions or code on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein communication media include any medium that facilitates the transmission of a computer program from one place to another. Storage media may be any available medium accessible to a computer. Computer-readable storage media may include, but are not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code having the form of instructions or data structures and accessible to a computer.
[0093] Finally, it should be noted that the above description is only a preferred embodiment of this application and is not intended to limit this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for de-occlusion of a security image, the security image being an image collected by a security device through an X-ray device, the occlusion being an occlusion area formed by a strong occluder which is likely to interfere with image interpretation; characterized in that, include: Construct a paired dataset that conforms to the physical consistency of X-ray imaging. This paired dataset includes multiple sets of image pairs, each set of image pairs including an unobstructed image and a corresponding occluded image with a specific strong occluder. Using a paired dataset, a conditional denoising diffusion probability model for mapping from occluded images to unoccluded images is trained. The occluded image is used as the only conditional input, and multi-scale features of the occluded image are injected through a cross-attention mechanism. The conditional denoising diffusion probability model is optimized by combining region-aware weighted loss. The occluded images acquired in real time are input into a pre-trained conditional denoising diffusion probability model, which directly outputs an occluded image by removing specific strong occluders.
2. The de-occlusion method of security images according to claim 1, wherein, The conditional denoising diffusion probability model is trained using a classifier-free guidance strategy, including: During training, conditional inputs are replaced with empty labels with preset probabilities, and conditional and unconditional noise predictions are learned simultaneously. During inference, the constraint strength of the conditional input is amplified by a guiding scale to force the generated content to align and occlude the target; the guiding scale is a preset adjustable parameter.
3. The method for removing occlusion from security inspection images according to claim 1, characterized in that, The conditional denoising diffusion probability model optimized by combining region-aware weighted loss includes: When training the conditional denoising diffusion probability model, a region-aware weighted loss function is constructed using a binary mask of a specific strong occlusion generated during the synthesis stage. The pixel loss in the occluded area is assigned a greater weight than that in the non-occluded area, prioritizing the optimization of the reconstruction accuracy of the occluded area; the synthesis stage is determined based on the construction of the paired dataset.
4. The method for removing occlusion from security inspection images according to claim 1, characterized in that, The conditional denoising diffusion probability model is trained by injecting conditional input through a cross-attention mechanism, including: Extract the multi-scale features corresponding to the conditional input; Using the intermediate features of the conditional denoising network of the conditional denoising diffusion probability model as the query vector, and the multi-scale features as the key and value, the conditional denoising process dynamically focuses on the occlusion region and context information; wherein, the intermediate features are the intermediate feature maps generated by the conditional denoising network at each residual level.
5. The method for removing occlusion from security inspection images according to claim 1, characterized in that, When training the conditional denoising diffusion probability model, a joint probability distribution is established with the occluded image as the only conditional input, so that the entire inverse denoising process is constrained by this conditional input; each step of inverse denoising refers to the input occluded image, so that the generated unoccluded image corresponds one-to-one with the input occluded image.
6. The method for removing occlusion from security inspection images according to claim 5, characterized in that, The core of the conditional denoising diffusion probability model is the conditional denoising network; the input of the conditional denoising network is the noisy image at the current time step, the time step information, and the conditional input, and the output is the Gaussian noise added to the noisy image at that time step.
7. The method for removing occlusion from security inspection images according to claim 3, characterized in that, The determination of the synthesis stage is specifically as follows: for any image pair in the paired dataset, the occluded image of the image pair with a specific strong occluder includes the synthesized image obtained by injecting the specific strong occluder into the corresponding unoccluded image, and the injection process is defined as the synthesis stage.
8. A device for removing occlusion from security inspection images, employing the method for removing occlusion from security inspection images as described in any one of claims 1 to 7, characterized in that, include: The pairing construction module is configured to: construct a pairing dataset that conforms to the physical consistency of X-ray imaging. The pairing dataset includes multiple sets of image pairs, each set of image pairs including an unoccluded image and a corresponding occluded image with a specific strong occluder. The model training module is configured to: train a conditional denoising diffusion probability model for mapping from occluded images to unoccluded images, with the occluded image as the only conditional input, inject multi-scale features of the occluded image through a cross-attention mechanism, and optimize the conditional denoising diffusion probability model by combining region-aware weighted loss. The conditional denoising module is configured to input real-time acquired occluded images into a trained conditional denoising diffusion probability model and directly output an occluded image that removes specific strong occluders.
9. A device for removing occlusions from security inspection images, characterized in that, Includes at least one processor, at least one memory, and a data bus; The processor and the memory communicate with each other via the data bus; The memory stores program instructions that can be executed by the processor, which invokes the program instructions to execute the method for removing obscuring security inspection images according to any one of claims 1 to 7.
10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for removing occlusion from security inspection images as described in any one of claims 1 to 7.