A method for processing dangerous goods injection in vehicle X-ray images
By preprocessing and rotary embedding technology on automotive X-ray images, high-quality training data is generated, which solves the problem of lack of training data in the existing technology and realizes the intelligent development of automotive X-ray detection.
Patent Information
- Application Number
- CN202510845961.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2045-06-24
AI Technical Summary
The prior art is difficult to effectively use high-resolution automotive X-ray images for automated hazardous product detection, mainly due to the lack of sufficient quantity of training data containing hazardous products, and the existing hazardous product injection scheme is not suitable for automotive X-ray detection scenarios.
By preprocessing automobile X-ray images containing and without hazardous goods, the hazardous goods brightness matrix and vehicle area matrix are generated, and a large number of hazardous goods-containing images are synthesized using rotation and embedding technology to provide training data.
Use a small amount of dangerous goods images and hazardous goods images to synthesize high-quality training data to promote the intelligent development of vehicle X-ray detection technology.
Smart Images

Figure CN120375293B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of vehicle security inspection, and in particular relates to a method for processing dangerous goods injection in vehicle X-ray images. Background Art
[0002] Vehicle X-ray inspection systems, with their ability to generate high-resolution top-surface X-ray images, have become a crucial tool for identifying potentially hazardous materials. These images provide an intuitive and efficient means of quickly screening vehicles potentially carrying hazardous materials, ensuring port security. However, with the widespread application of artificial intelligence (AI) in image recognition, the effective application of these high-resolution X-ray images for automated object detection, particularly hazardous materials detection, has become a critical challenge.
[0003] Currently, the performance of AI-powered object detection algorithms is highly dependent on large amounts of high-quality training data. For vehicle X-ray inspection, this means collecting and labeling a large number of vehicle X-ray images containing hazardous materials in order to train accurate and reliable detection models. However, this approach presents numerous challenges: First, the vast majority of vehicle images do not contain hazardous materials, making it extremely difficult to directly collect a sufficient number of positive samples (i.e., images containing hazardous materials). Second, even manually placing hazardous materials in vehicles and producing scanned images is an extremely time-consuming and labor-intensive process, and it is difficult to ensure the authenticity and diversity of the images. Furthermore, manually placing hazardous materials may not cover all possible types and locations of hazardous materials, further limiting the richness of the training data.
[0004] In the prior art, although there are some dangerous goods injection schemes, most of these schemes are designed for baggage security inspection machines and are not directly applicable to the whole vehicle X-ray inspection scenario. There are significant differences in image characteristics between baggage security inspection machines and car X-ray inspections, and these differences are largely caused by the different sizes of cars and luggage. Specifically, due to the small actual space of baggage security inspection machines, the injection of dangerous goods needs to be limited to the vacant area of the luggage, and the size of the injected dangerous goods is relatively fixed, and there is no need to consider the perspective change of "near big, far small". However, the injection of dangerous goods in car X-ray images can be carried out in any area of the car body, and large dangerous goods such as drones and shovels need to be injected and identified. The size of these dangerous goods will have a certain "near big, far small" change due to their position in the car body. At the same time, the volume of the dangerous goods themselves can also have a large degree of random change. In response to the above problems, the present invention has developed a dangerous goods image injection processing method for car top surface X-ray scanning images. Summary of the Invention
[0005] In order to overcome the problems in the prior art, the present invention proposes a method for processing dangerous goods injection in vehicle X-ray images.
[0006] The technical solution of the present invention to solve the above technical problems is as follows:
[0007] The present invention provides a method for processing dangerous goods injection in vehicle X-ray images, comprising the following steps:
[0008] Scanning a vehicle containing hazardous materials to generate an original X-ray image of the hazardous materials, cropping an area containing only the hazardous materials from the original X-ray image to generate a hazardous materials sub-image, and representing the hazardous materials sub-image as a hazardous materials brightness matrix; preprocessing the hazardous materials brightness matrix to obtain a hazardous materials white background matrix and a hazardous materials pixel labeling matrix;
[0009] Scan the vehicle without any hazardous materials to generate an original X-ray image without any hazardous materials, and represent the original X-ray image without any hazardous materials as a brightness matrix without any hazardous materials; pre-process the brightness matrix without any hazardous materials to obtain an approximate area matrix of the vehicle;
[0010] Generate a matrix for injection of non-hazardous goods, rotate the white background matrix of hazardous goods by an angle and embed it into the matrix for injection of non-hazardous goods to generate a matrix for hazardous goods to be injected; generate a pixel-level segmentation matrix for hazardous goods, rotate the pixel labeling matrix for hazardous goods by an angle and embed it into the pixel-level segmentation matrix for hazardous goods to generate a matrix for the approximate area of the vehicle to be injected with hazardous goods; determine whether the pixel-level segmentation matrix for hazardous goods falls within the approximate area matrix of the vehicle; if so, inject the matrix for hazardous goods to be injected into the brightness matrix of non-hazardous goods.
[0011] Furthermore, the dangerous goods brightness matrix is preprocessed to obtain a dangerous goods white background matrix, including:
[0012] Expand the hazmat brightness matrix into a one-dimensional hazmat brightness vector;
[0013] Clustering the vectors in the one-dimensional dangerous goods brightness vector into multiple one-dimensional Gaussian distributions, wherein the distribution with the largest mean among the multiple one-dimensional Gaussian distributions is the distribution of background brightness, and obtaining the mean and standard deviation of the background brightness distribution;
[0014] Perform a linear transformation on the pixel values in the dangerous goods brightness matrix to obtain a dangerous goods brightness matrix with values between 0 and 1. Set the pixels in the brightness matrix between 0 and 1 whose pixel values are greater than or equal to the mean of the background brightness distribution to 1, and set the rest to 0 to obtain a dangerous goods white background matrix.
[0015] Furthermore, the dangerous goods brightness matrix is preprocessed to obtain a dangerous goods pixel labeling matrix, including:
[0016] Based on the mean and standard deviation of the background brightness distribution, a first brightness threshold is preset. Based on the first brightness threshold, each pixel in the hazardous materials brightness matrix is compared with the first brightness threshold. Pixels smaller than the first brightness threshold are hazardous materials areas and are marked as 1; pixels greater than the first brightness threshold are background areas and are marked as 0, thus obtaining a hazardous materials pixel labeling matrix.
[0017] Furthermore, the first brightness threshold is the mean of the background brightness distribution minus six times the standard deviation of the background brightness distribution.
[0018] Furthermore, the brightness matrix of the non-hazardous objects is preprocessed to obtain the approximate area matrix of the vehicle, including:
[0019] Performing Gaussian blur on the non-hazardous material brightness matrix to obtain a Gaussian blurred non-hazardous material brightness matrix; expanding the pixel values in the Gaussian blurred non-hazardous material brightness matrix into a one-dimensional non-hazardous material brightness vector;
[0020] A one-dimensional Gaussian mixture clustering algorithm is used to cluster the values in the one-dimensional non-hazardous material brightness vector into at least two one-dimensional Gaussian distributions. The one with the largest mean among the at least two Gaussian distributions is the background brightness distribution in the Gaussian blurred non-hazardous material brightness matrix. The mean and standard deviation of the background brightness distribution in the Gaussian blurred non-hazardous material brightness matrix are obtained.
[0021] Based on the background brightness distribution mean and background brightness distribution standard deviation in the Gaussian blurred non-hazardous goods brightness matrix, the Gaussian blurred non-hazardous goods brightness matrix is segmented to obtain the approximate area matrix of the vehicle.
[0022] Furthermore, based on the background brightness distribution mean and background brightness distribution standard deviation in the Gaussian blur non-hazardous goods brightness matrix, the Gaussian blur non-hazardous goods brightness matrix is segmented to obtain the approximate area matrix of the vehicle, including:
[0023] Presetting a second brightness threshold based on the background brightness distribution mean and background brightness distribution standard deviation in the Gaussian blurred non-hazardous material brightness matrix;
[0024] Compare each pixel of the Gaussian blurred non-hazardous material brightness matrix with the second brightness threshold. The pixels below the second brightness threshold are vehicle areas, which are recorded as 1; the pixels above the second brightness threshold are background areas, which are recorded as 0, and the approximate area matrix of the vehicle is obtained.
[0025] Furthermore, the second brightness threshold is the mean of the background brightness distribution in the Gaussian blurred non-hazardous article brightness matrix minus 0.5 times the standard deviation of the background brightness distribution in the Gaussian blurred non-hazardous article brightness matrix.
[0026] Compared with the prior art, the present invention has the following technical effects:
[0027] The present invention can use a small number of dangerous goods X-ray images and car X-ray images without dangerous goods to synthesize a large number of high-quality car X-ray images containing dangerous goods, providing sufficient training data for artificial intelligence target detection algorithms, thereby promoting the intelligent development of vehicle X-ray detection technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0029] Figure 1 It is a schematic diagram of the process of the present invention;
[0030] Figure 2 is an image of the area containing only hazardous materials;
[0031] Figure 3 It is an image of dangerous goods with a white background;
[0032] Figure 4 Label images for hazardous material pixels;
[0033] Figure 5 The histogram is the probability distribution of pixel brightness;
[0034] Figure 6 An image of a car without hazardous materials to be injected;
[0035] Figure 7 This is the image of the car without hazardous materials after Gaussian blurring;
[0036] Figure 8 for the reason Figure 7 Generated schematic diagram of the area to be injected;
[0037] Figure 9 This is an image of a car with multiple dangerous goods injected into it. The colored boxes are the dangerous goods target boxes, and the text labels on the boxes represent them.
[0038] Figure 10 for Figure 6 Pixel-level semantic segmentation map of the shown image. DETAILED DESCRIPTION
[0039] To further illustrate the technical means and effects adopted by the present invention to achieve the intended purpose of the invention, the following, in conjunction with the accompanying drawings and preferred embodiments, describes in detail the specific implementation methods, structures, features, and effects of the technical solutions proposed by the present invention. Specific features, structures, or characteristics in one or more embodiments may be combined in any suitable form. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which the present invention belongs.
[0040] In one embodiment of the present invention, referring to Figures 1-10 , provides a method for processing dangerous goods injection in vehicle X-ray images, comprising the following steps:
[0041] Scanning a vehicle containing hazardous materials to generate an original X-ray image of the hazardous materials, cropping an area containing only the hazardous materials from the original X-ray image to generate a hazardous materials sub-image, and representing the hazardous materials sub-image as a hazardous materials brightness matrix; preprocessing the hazardous materials brightness matrix to obtain a hazardous materials white background matrix and a hazardous materials pixel labeling matrix;
[0042] Scan the vehicle without any hazardous materials to generate an original X-ray image without any hazardous materials, and represent the original X-ray image without any hazardous materials as a brightness matrix without any hazardous materials; pre-process the brightness matrix without any hazardous materials to obtain an approximate area matrix of the vehicle;
[0043] Generate a matrix for injection of non-hazardous goods, embed the white background matrix of hazardous goods into the matrix for injection of non-hazardous goods, and generate a matrix for hazardous goods to be injected; generate a pixel-level segmentation matrix for hazardous goods, rotate the pixel labeling matrix of hazardous goods and embed it into the pixel-level segmentation matrix of hazardous goods, and generate a rough area matrix for the vehicle to be injected with hazardous goods; determine whether the pixel-level segmentation matrix of hazardous goods falls within the rough area matrix of the vehicle; if so, inject the matrix for hazardous goods to be injected into the brightness matrix of non-hazardous goods.
[0044] The following is a detailed explanation of each of the above steps:
[0045] Step 100: Scan the vehicle containing the dangerous goods to generate an original X-ray image of the dangerous goods, crop the area containing only the dangerous goods from the original X-ray image of the dangerous goods to generate a dangerous goods sub-image, and represent the dangerous goods sub-image as a dangerous goods brightness matrix.
[0046] An X-ray scanner is used to scan objects or vehicles containing hazardous materials to generate an original X-ray image of the hazardous materials. Subsequently, image annotation tools (such as LabelImg, VGG Image Annotator, etc.) are used to accurately annotate the hazardous materials area in the image, using bounding boxes or pixel-level segmentation to mark the location of the hazardous materials.
[0047] Based on the annotation information, the original X-ray image of the dangerous goods is cropped to identify the region containing only the dangerous goods, generating a dangerous goods sub-image. This cropping process preserves the complete morphological features of the dangerous goods while removing background interference, allowing subsequent algorithms to focus on learning the features of the dangerous goods themselves.
[0048] To enhance the generalization capabilities of the model, during the data collection phase, scan the same hazardous material from multiple angles or collect image data from different scenarios. Ensure that the collected hazardous material images cover various forms (e.g., size, shape, material) and angles (e.g., different placement orientations, perspective distortion) of the target hazardous material.
[0049] The pixel value of the X-ray image reflects the actual radiation flux received by the pixel during the scanning process, and its value range is an integer from 0 to 65535. To facilitate calculation and processing, the cropped hazardous material image, that is, the hazardous material sub-image, is represented as a hazardous material brightness matrix, which is recorded as The hazardous material brightness matrix is three-dimensional and has a size of [image height, image width, 1], where the last dimension represents a single-channel grayscale image. Each element of the hazardous material brightness matrix corresponds to a pixel in the image, and its value is proportional to the radiant flux at that pixel.
[0050] To further improve the robustness of the model, data augmentation operations can be performed on the brightness matrix, such as random rotation, scaling, translation, and flipping, to simulate complex scenarios in real applications. At the same time, normalizing the pixel values (such as linearly mapping them to the 0-1 range) helps accelerate model convergence and improve detection accuracy.
[0051] Step 200: Preprocess the dangerous goods brightness matrix to obtain a dangerous goods white background matrix and a dangerous goods pixel labeling matrix.
[0052] In this step 200, the following sub-steps may be included:
[0053] Step 210: DG Brightness Matrix The values in are flattened into a one-dimensional hazardous material brightness vector .
[0054] ;
[0055] Step 220: Use the one-dimensional Gaussian mixture clustering algorithm to cluster the one-dimensional dangerous goods brightness vector The values in are clustered into multiple one-dimensional Gaussian distributions, and the one with the largest mean among the multiple one-dimensional Gaussian distributions is the distribution of background brightness, and the background brightness distribution mean of the dangerous goods brightness matrix is obtained. and background brightness distribution standard deviation .
[0056] Setting the number of clusters to 6 ensures that the Gaussian distribution with the largest mean is exactly the background brightness. If the number of clusters is set too small, the distribution may also include areas with higher brightness in dangerous goods. If the number of clusters is too large, the background brightness may be split into multiple Gaussian distributions.
[0057] Step 230: Perform a linear transformation on the pixel values in the dangerous goods brightness matrix to obtain a brightness matrix with values between 0 and 1. Set the pixels in the brightness matrix between 0 and 1 whose pixel values are greater than or equal to the mean of the background brightness distribution to 1, and set the rest to 0, to obtain a dangerous goods white background matrix.
[0058] Reference Figure 2 , for the brightness matrix of dangerous goods The pixel values in are linearly transformed to obtain the dangerous goods brightness matrix with values between 0 and 1. The pixel value is greater than or equal to the background brightness distribution mean The pixels of the dangerous goods are set to 1 and the rest are set to 0 to obtain the white background matrix of the dangerous goods. :
[0059] ;
[0060] Step 240: Segment the hazardous material brightness matrix based on the background brightness distribution mean and the background brightness distribution standard deviation to obtain a pixel-level labeling matrix of the hazardous material area, namely, a hazardous material pixel labeling matrix.
[0061] Reference Figure 3 ,by The first brightness threshold is used for segmentation, and the brightness matrix of dangerous goods is divided into Each pixel in the image is compared with the first brightness threshold. The pixels with brightness less than the first brightness threshold are in the dangerous goods area and are marked as 1; the pixels with brightness greater than or equal to the first brightness threshold are in the background area and are marked as 0. The pixel labeling matrix of dangerous goods is obtained. :
[0062] ;
[0063] Standard deviation of background brightness distribution The coefficient is set to 6. If the coefficient is set too large, the segmented area will not include the brighter parts in the dangerous goods area. If the coefficient is set too small, the segmented area will include the lower brightness noise in the background area.
[0064] Step 300: Scan the vehicle without any hazardous materials to generate an original X-ray image without any hazardous materials, and represent the original X-ray image without any hazardous materials as a brightness matrix without any hazardous materials.
[0065] An X-ray scanning device is used to scan an object or vehicle that does not contain any hazardous materials to generate an original X-ray image without hazardous materials. The pixel value of the X-ray image reflects the actual radiation flux received by the pixel during the scanning process, and its value range is an integer from 0 to 65535. For ease of calculation, the original X-ray image without hazardous materials is represented as a brightness matrix without hazardous materials, which is recorded as , whose size is [image height, image width, 1], where the last dimension represents a single-channel grayscale image. Each element of the non-hazardous material brightness matrix corresponds to a pixel in the image, and its value is proportional to the radiation flux at that point.
[0066] Step 400: Preprocess the brightness matrix of the non-hazardous objects to obtain a rough area matrix of the vehicle.
[0067] As an example, this step 400 may include the following sub-steps:
[0068] Step 410: Brightness matrix of non-hazardous items Perform Gaussian blur to obtain Gaussian blurred hazardous material brightness matrix .
[0069] For images with a height between 1000-2000 pixels and a width between 2000-3000 pixels, the convolution kernel size of the Gaussian blur is set to 255 and the standard deviation of the Gaussian blur is set to 127. In more general cases, the convolution kernel size and standard deviation should be set to relatively large values to ensure that the image generated in step 440 is A single solid area.
[0070] Step 420: Gaussian blur the brightness matrix of the non-hazardous items The values in are flattened to a one-dimensional brightness vector of the non-hazardous material .
[0071] Step 430: Use a one-dimensional Gaussian mixture clustering algorithm to cluster the one-dimensional non-hazardous brightness vector The values in are clustered into two one-dimensional Gaussian distributions. The one with the largest mean is the Gaussian blurred brightness matrix without hazardous materials. Background brightness distribution, get the background brightness distribution mean in the Gaussian blur non-hazardous material brightness matrix and background brightness distribution standard deviation .
[0072] Step 440: Gaussian blurring of the brightness matrix of the non-hazardous material The mean and standard deviation of the background brightness distribution, the brightness matrix of the non-hazardous objects for Gaussian blur Perform segmentation to obtain the pixel-level annotation matrix of the roughly fuzzy area where the vehicle is located, referred to as the roughly area matrix of the vehicle .
[0073] by The second brightness threshold is used for segmentation, and the Gaussian blur brightness matrix of the non-hazardous items is used Each pixel value is compared with the second brightness threshold. The pixel value less than the second brightness threshold is the vehicle area, which is recorded as 1; the pixel value greater than or equal to the second brightness threshold is the background area, which is recorded as 0, and the approximate area matrix of the vehicle is obtained. :
[0074] ;
[0075] The coefficient is set to 0.5. If the coefficient is set too large, the segmented area will not include the rearview mirror and other parts of the vehicle body. If the coefficient is set too small, the segmented area will include a large background area around the vehicle body.
[0076] Step 500: Generate a matrix for injecting hazardous materials without hazardous materials, rotate the matrix for the white background of hazardous materials and embed it into the matrix for injecting hazardous materials without hazardous materials, thereby generating a matrix for hazardous materials to be injected; generate a pixel-level segmentation matrix for hazardous materials, rotate the pixel-level segmentation matrix for hazardous materials and embed it into the pixel-level segmentation matrix for hazardous materials, thereby generating a matrix for the approximate area of the vehicle to be injected with hazardous materials; determine whether the pixel-level segmentation matrix for hazardous materials falls within the approximate area matrix of the vehicle; if injection is possible, inject the matrix for hazardous materials to be injected into the brightness matrix of the hazardous materials without hazardous materials;
[0077] After verifying the effectiveness of the injection area, the injection image and the dangerous goods target frame are generated, and repeated until the predetermined number is met to form the target detection model training data.
[0078] As an example, this step 500 may include the following sub-steps:
[0079] Step 510: Place the hazardous materials on a white background matrix and the hazardous materials pixel labeling matrix , and randomly zoom in or out.
[0080] Simulate the enlargement / reduction of the volume of dangerous goods: Generate random floating point numbers in the interval j As the enlargement / reduction ratio, where Indicates the maximum ratio of the volume of dangerous goods to be enlarged or reduced, which is 0.25; the white background matrix of dangerous goods and the hazardous materials pixel labeling matrix Zoom in / out to the original size j times, then adjust the Hazardous Materials White Background Matrix The brightness is used to simulate the change in X-ray absorption rate caused by the volume change of dangerous goods:
[0081] ;
[0082] Simulate the "larger near and smaller far" caused by the height change of dangerous goods: Generate random floating point numbers in the interval j As the enlargement / reduction ratio, where The maximum ratio of the change of dangerous goods from “larger near and smaller far” is 0.25; the white background matrix of dangerous goods is and the hazardous materials pixel labeling matrix Zoom in / out to the original size j Just double it.
[0083] Step 520: Generate a matrix for injecting hazardous materials without any injection, rotate the matrix for the hazardous materials with a white background and embed it into the matrix for injecting hazardous materials without any injection, and generate a matrix for hazardous materials to be injected.
[0084] Generate a matrix of HAZARDOUS and NON-HAZARDOUS brightness A matrix of the same size with no hazardous materials injected and all values are floating point 1 ; In the matrix without hazardous materials Randomly generate a center point coordinate within the width and height range , and then randomly generate an angle between 0°-360° a , the dangerous goods white background matrix Rotation angle a After embedding into the matrix without hazardous materials , get the matrix of hazardous materials to be injected , whose center point is .
[0085] Step 530: Generate a pixel-level segmentation matrix for dangerous goods and rotate the dangerous goods pixel labeling matrix by an angle a It is then embedded into the pixel-level segmentation matrix of the hazardous materials to generate the approximate area matrix of the vehicle to be injected with hazardous materials.
[0086] First generate a rough area matrix of the vehicle Pixel-level segmentation matrix of dangerous goods with the same size and integer values of 0 , and then label the dangerous goods pixel matrix Rotation anglea Then embed it into the pixel-level segmentation matrix of dangerous goods , generate the approximate area matrix of the vehicle to be injected with dangerous goods, so that the embedded dangerous goods segmentation center point is also .
[0087] Step 540: Determine the pixel-level segmentation matrix of dangerous goods Whether it falls within the vehicle's approximate area matrix Inside:
[0088] ;
[0089] In the above formula, Indicates the proportion of the pixel-level segmentation matrix of hazardous materials that falls within the approximate area matrix of the vehicle.
[0090] if R If the percentage is greater than 99%, the area is considered to be suitable for injection, otherwise step 510 is executed again until R More than 99%.
[0091] Step 550: Inject the matrix of hazardous materials to be injected into the brightness matrix of non-hazardous materials middle:
[0092]
[0093] in, is the brightness matrix of non-hazardous materials, with values ranging from 0 to 65535; Indicates the matrix of hazardous materials to be injected, with a floating point value of 0-1; The injection result is an integer between 0 and 65535.
[0094] Step 560: Pixel-level segmentation matrix of dangerous goods Determine the target detection frame of dangerous goods:
[0095] ;
[0096] ;
[0097] ;
[0098] ;
[0099] Obtained 、 、 、 They are the upper, lower, left and right boundaries of the dangerous goods target box respectively.
[0100] Step 570: Repeat the above steps until there is no dangerous goods brightness matrix Until the predetermined quantity of dangerous goods is contained.
[0101] For the “predetermined number”, the empirical value is that injecting 0-2 of each type of dangerous goods into each vehicle image is the best effect; and the target box boundary of each dangerous goods 、 、 、 As training data for the object detection model.
[0102] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A method for processing dangerous goods injection in vehicle X-ray images, characterized in that: The following steps are involved: Scan the vehicle containing the dangerous goods to generate an original X-ray image of the dangerous goods, crop the area containing only the dangerous goods from the original X-ray image of the dangerous goods to generate a dangerous goods sub-image, and represent the dangerous goods sub-image as a dangerous goods brightness matrix; Preprocessing the hazardous material brightness matrix to obtain a hazardous material white background matrix and a hazardous material pixel labeling matrix; wherein a first brightness threshold is preset based on the background brightness distribution mean and the background brightness distribution standard deviation; based on the first brightness threshold, each pixel in the hazardous material brightness matrix is compared with the first brightness threshold, and pixels with a brightness less than the first brightness threshold are in the hazardous material area and are marked as 1; pixels with a brightness greater than the first brightness threshold are in the background area and are marked as 0, thereby obtaining a hazardous material pixel labeling matrix; Scan the vehicle without any hazardous materials to generate an original X-ray image without any hazardous materials, and represent the original X-ray image without any hazardous materials as a brightness matrix without any hazardous materials; pre-process the brightness matrix without any hazardous materials to obtain an approximate area matrix of the vehicle; Randomly enlarge or reduce the dangerous goods white background matrix and the dangerous goods pixel labeling matrix; generate a non-dangerous goods injection matrix, rotate the dangerous goods white background matrix and embed it into the non-dangerous goods injection matrix to generate a matrix for injecting dangerous goods, which includes generating a non-dangerous goods injection matrix of the same size as the non-dangerous goods brightness matrix and with values of floating point 1; randomly generate a center point coordinate within the width and height range of the non-dangerous goods injection matrix , and then randomly generate an angle between 0°-360° a , rotate the dangerous goods white background matrix by a Then embed it into the matrix without hazardous materials injection to obtain the matrix of hazardous materials to be injected, the center point of which is ; Generate a pixel-level segmentation matrix of dangerous goods with the same size as the vehicle's approximate area matrix and all integer values are 0, and rotate the dangerous goods pixel labeling matrix by angle a Then embed it into the pixel-level segmentation matrix of dangerous goods to generate the approximate area matrix of the vehicle to be injected with dangerous goods, so that the embedded dangerous goods segmentation center point is also ; Determine whether the pixel-level segmentation matrix of dangerous goods falls within the approximate area matrix of the vehicle; if so, inject the matrix of dangerous goods to be injected into the brightness matrix of no dangerous goods.
2. The method for processing dangerous goods injection in vehicle X-ray images according to claim 1, characterized in that: Preprocessing the dangerous goods brightness matrix to obtain a dangerous goods white background matrix includes: Expand the hazmat brightness matrix into a one-dimensional hazmat brightness vector; Clustering the vectors in the one-dimensional dangerous goods brightness vector into multiple one-dimensional Gaussian distributions, wherein the distribution with the largest mean among the multiple one-dimensional Gaussian distributions is the distribution of background brightness, and obtaining the mean and standard deviation of the background brightness distribution; Perform a linear transformation on the pixel values in the dangerous goods brightness matrix to obtain a dangerous goods brightness matrix with values between 0 and 1. Set the pixels in the brightness matrix between 0 and 1 whose pixel values are greater than or equal to the mean of the background brightness distribution to 1, and set the rest to 0 to obtain a dangerous goods white background matrix.
3. The method for processing dangerous goods injection in vehicle X-ray images according to claim 2, characterized in that: The first brightness threshold is the mean of the background brightness distribution minus six times the standard deviation of the background brightness distribution.
4. The method for processing dangerous goods injection in vehicle X-ray images according to claim 1, characterized in that: Preprocess the brightness matrix of non-hazardous objects to obtain the approximate area matrix of the vehicle, including: Performing Gaussian blur on the non-hazardous material brightness matrix to obtain a Gaussian blurred non-hazardous material brightness matrix; expanding the pixel values in the Gaussian blurred non-hazardous material brightness matrix into a one-dimensional non-hazardous material brightness vector; A one-dimensional Gaussian mixture clustering algorithm is used to cluster the values in the one-dimensional non-hazardous material brightness vector into at least two one-dimensional Gaussian distributions. The one with the largest mean among the at least two Gaussian distributions is the background brightness distribution in the Gaussian blurred non-hazardous material brightness matrix. The mean and standard deviation of the background brightness distribution in the Gaussian blurred non-hazardous material brightness matrix are obtained. Based on the background brightness distribution mean and background brightness distribution standard deviation in the Gaussian blurred non-hazardous goods brightness matrix, the Gaussian blurred non-hazardous goods brightness matrix is segmented to obtain the approximate area matrix of the vehicle.
5. The method for processing dangerous goods injection in vehicle X-ray images according to claim 4, characterized in that: Based on the background brightness distribution mean and background brightness distribution standard deviation in the Gaussian blur non-hazardous material brightness matrix, the Gaussian blur non-hazardous material brightness matrix is segmented to obtain the approximate area matrix of the vehicle, including: Presetting a second brightness threshold based on the background brightness distribution mean and background brightness distribution standard deviation in the Gaussian blurred non-hazardous material brightness matrix; Compare each pixel of the Gaussian blurred non-hazardous material brightness matrix with the second brightness threshold. The pixels below the second brightness threshold are vehicle areas and are marked as 1; the pixels above the second brightness threshold are background areas and are marked as 0, thus obtaining the approximate area matrix of the vehicle.
6. The method for processing dangerous goods injection in vehicle X-ray images according to claim 5, characterized in that: The second brightness threshold is the mean of the background brightness distribution in the Gaussian blurred non-hazardous material brightness matrix minus 0.5 times the standard deviation of the background brightness distribution in the Gaussian blurred non-hazardous material brightness matrix.
Citation Information
Patent Citations
Security inspection image-based dangerous article image injection method
CN110210368A
Security check X-ray graph discrimination training data expansion method based on sketch style migration
CN115908986A