Security inspection image conversion method, system, device and storage medium
By calculating the RGB average value and pixel conversion of the standard parts, a color conversion model is constructed, which solves the image adaptation problem of different security machines, and realizes accurate image conversion and model adaptation, reducing the training data demand.
Patent Information
- Application Number
- CN202411152157.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-21
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-08-21
AI Technical Summary
Due to the difference in technical standards and different distortion correction strategies of X-ray images of different security machine manufacturers, the models trained by a single model of security machine cannot be effectively adapted to other models of security machine, and the training model requires a large amount of data to ensure the recognition effect.
By obtaining the X-ray image sets generated by different models of security check machines, calculate the RGB average value of the standard parts as the preset standard color value, perform image filtering and pixel conversion, and build a color conversion model to realize image conversion between different models of security check machines.
It reduces the need for training data, improves the accuracy of image conversion, enables the images of different models of security check machines to be converted to each other, and enhances the adaptability of the model.
Smart Images

Figure CN118660145B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field related to security inspection image conversion, and in particular to a security inspection image conversion method, system, device and storage medium. Background Art
[0002] At present, deep learning and target detection technologies are increasingly being used in the field of security inspection machine X-ray image detection. Training a model that can detect objects in security inspection machine X-ray images requires a large number of X-ray images to ensure good recognition results. However, due to the large number of security inspection machine manufacturers, the X-ray images produced by each manufacturer differ in color due to differences in technical standards, and the distortion correction strategies for X-ray images are also different. Therefore, the X-ray images generated by different manufacturers differ in color, and the model trained with images of a single model of security inspection machine cannot be well adapted to other models of security inspection machines. Summary of the invention
[0003] The present invention aims to at least solve the technical problems existing in the prior art. To this end, the present invention proposes a security inspection image conversion method, system, device and storage medium, which can reduce training data, realize mutual conversion of security inspection images of different models of security inspection machines, and improve the accuracy of image conversion.
[0004] A first aspect of the present invention provides a security inspection image conversion method, comprising the following steps:
[0005] Obtain a first X-ray image to be converted from the first security inspection machine, a first X-ray image set generated by the test piece passing through the first security inspection machine, a second X-ray image set generated by the test piece passing through the second security inspection machine, a third X-ray image set generated by the designated standard piece passing through the first security inspection machine, and a fourth X-ray image set generated by the designated standard piece passing through the second security inspection machine;
[0006] Calculate the RGB average value of each image corresponding to the designated standard part in the third X-ray image set, and use it as the first standard color value of the preset standard color of the first security inspection machine; calculate the RGB average value of each image corresponding to the designated standard part in the fourth X-ray image set, and use it as the second standard color value of the preset standard color of the second security inspection machine, wherein the RGB average value of each image corresponding to the designated standard part is the average value calculated by each channel of R, G, and B of each image corresponding to the designated standard part, and the types of the designated standard parts correspond to the types of the preset standard colors one by one;
[0007] The first X-ray image set is screened according to the first standard color value to obtain a fifth X-ray image set; the second X-ray image set is screened according to the second standard color value to obtain a sixth X-ray image set;
[0008] Calculating a pixel conversion size based on the third X-ray image set and the fourth X-ray image set;
[0009] Performing size conversion on the first X-ray image to be converted according to the pixel conversion size to obtain a second X-ray image to be converted; performing size conversion on the fifth X-ray image set according to the pixel conversion size to obtain a seventh X-ray image set; performing size conversion on the sixth X-ray image set according to the pixel conversion size to obtain an eighth X-ray image set;
[0010] constructing an initial color conversion model, inputting the seventh X-ray image set and the eighth X-ray image set into the initial color conversion model for training, and obtaining a trained color conversion model;
[0011] Inputting the second X-ray image to be converted into the trained color conversion model to obtain a converted X-ray image output by the color conversion model that simulates the image generated by the second security inspection machine;
[0012] The step of screening the first X-ray image set according to the first standard color value to obtain a fifth X-ray image set includes:
[0013] performing matrix normalization on the R value, the G value, and the B value of each image in the first X-ray image set to obtain a normalized two-dimensional matrix of each image in the first X-ray image set;
[0014] The Lab space color value of each image in the first X-ray image set is calculated according to the normalized two-dimensional matrix; wherein the Lab space color value of each image includes Channel value, Channel value and Channel value;
[0015] According to the Lab space color value of each image, calculate the color of the corresponding image in the first X-ray image set. The channel average value and the corresponding image in the first X-ray image set The channel average and the corresponding image in the first X-ray image set Channel average;
[0016] According to the Channel average and the Channel value calculation Channel difference; according to the Channel average and the Channel value calculation Channel difference; according to the Channel average and the Channel value calculation Channel difference;
[0017] According to the Channel difference, Channel difference and the The channel difference is calculated by the following formula to calculate the color difference between the preset standard color and the corresponding image in the first X-ray image set:
[0018] ;
[0019] in, is the color difference between the preset standard color and the corresponding image in the first X-ray image set, for Channel difference, for Channel difference, for Channel difference;
[0020] classifying corresponding images in the first X-ray image set according to the color difference to obtain a classification result for each image in the first X-ray image set;
[0021] Based on the classification result of each image in the first X-ray image set, the first X-ray image set is screened according to a preset image category ratio to obtain the fifth X-ray image set.
[0022] According to some embodiments of the present invention, obtaining a second X-ray image set generated by the test piece passing through a second security inspection machine includes:
[0023] Obtaining a passing angle of the test piece through the first security inspection machine;
[0024] Passing the test piece through the second security inspection machine at the passing angle to obtain an initial X-ray image set;
[0025] Based on the initial X-ray image set, deduplication is performed according to a preset similarity threshold to obtain a deduplicated X-ray image set;
[0026] The image-free area of the deduplicated X-ray image set is cropped to obtain the second X-ray image set.
[0027] According to some embodiments of the present invention, obtaining a fourth X-ray image set generated by the designated standard component through a second security inspection machine includes:
[0028] Obtaining a passing angle of the designated standard component through the first security inspection machine;
[0029] Divide the security inspection channel of the second security inspection machine into m intervals on a plane, where m is a preset positive integer value;
[0030] The designated standard part is sequentially placed in the middle of each section at the passing angle and passed through the second security inspection machine to obtain the fourth X-ray image set.
[0031] According to some embodiments of the present invention, the calculating the pixel conversion size according to the third X-ray image set and the fourth X-ray image set comprises:
[0032] Obtaining first position coordinates of each image in the third X-ray image set in the security inspection channel of the first security inspection machine; obtaining second position coordinates of each image in the fourth X-ray image set in the security inspection channel of the second security inspection machine;
[0033] Based on the first position coordinates, determine the image in the third X-ray image set corresponding to each of the intervals to obtain a first interval corresponding image set; and based on the second position coordinates, determine the image in the fourth X-ray image set corresponding to each of the intervals to obtain a second interval corresponding image set;
[0034] Based on the first interval corresponding image set and the second interval corresponding image set, the pixel conversion sizes corresponding to all the intervals of the first security inspection machine and the second security inspection machine are calculated.
[0035] According to some embodiments of the present invention, the step of converting the first X-ray image to be converted according to the pixel conversion size to obtain the second X-ray image to be converted includes:
[0036] Determining a corresponding interval of the first X-ray image to be converted in a security inspection channel of the first security inspection machine;
[0037] The first X-ray image to be converted is resized according to the corresponding interval and the pixel conversion size of the corresponding interval to obtain the second X-ray image to be converted.
[0038] According to some embodiments of the present invention, the designated standard parts include organic glass standard parts, aluminum plate standard parts and iron plate standard parts, the preset standard colors include orange, green and blue, the orange generally represents organic matter in the security inspection image, the green generally represents a mixture in the security inspection image, and the blue generally represents inorganic matter in the security inspection image, and the RGB average value of each image corresponding to the designated standard part in the third X-ray image set is calculated and used as the first standard color value of the preset standard color of the first security inspection machine, including:
[0039] Calculate the RGB average value of the image corresponding to the organic glass standard part in the third X-ray image set, and use it as the first standard color value of the orange color of the first security inspection machine;
[0040] Calculate the RGB average value of the image corresponding to the aluminum plate standard part in the third X-ray image set, and use it as the first standard color value of the green color of the first security inspection machine;
[0041] The RGB average value of the image corresponding to the iron plate standard part in the third X-ray image set is calculated and used as the first standard color value of the blue of the first security inspection machine.
[0042] A second aspect of the present invention provides a security inspection image conversion system, the security inspection image conversion system comprising:
[0043] A data acquisition module is used to acquire a first X-ray image to be converted by the first security inspection machine, a first X-ray image set generated by the test piece passing through the first security inspection machine, a second X-ray image set generated by the test piece passing through the second security inspection machine, a third X-ray image set generated by the designated standard piece passing through the first security inspection machine, and a fourth X-ray image set generated by the designated standard piece passing through the second security inspection machine;
[0044] an RGB average value calculation module, used to calculate the RGB average value of each image corresponding to the designated standard part in the third X-ray image set, and use it as the first standard color value of the preset standard color of the first security inspection machine; calculate the RGB average value of each image corresponding to the designated standard part in the fourth X-ray image set, and use it as the second standard color value of the preset standard color of the second security inspection machine, wherein the RGB average value of each image corresponding to the designated standard part is the average value calculated respectively by each channel of R, G, and B of each image corresponding to the designated standard part, and the types of the designated standard parts correspond to the types of the preset standard colors one by one;
[0045] a screening module, configured to screen the first X-ray image set according to the first standard color value to obtain a fifth X-ray image set; and screen the second X-ray image set according to the second standard color value to obtain a sixth X-ray image set;
[0046] The step of screening the first X-ray image set according to the first standard color value to obtain a fifth X-ray image set includes:
[0047] performing matrix normalization on the R value, the G value, and the B value of each image in the first X-ray image set to obtain a normalized two-dimensional matrix of each image in the first X-ray image set;
[0048] The Lab space color value of each image in the first X-ray image set is calculated according to the normalized two-dimensional matrix; wherein the Lab space color value of each image includes Channel value, Channel value and Channel value;
[0049] According to the Lab space color value of each image, calculate the color of the corresponding image in the first X-ray image set. The channel average value and the corresponding image in the first X-ray image set The channel average and the corresponding image in the first X-ray image set Channel average;
[0050] calculate The average value of the channel matrix is used as the corresponding image in the first X-ray image set. Channel average; calculation The average value of the channel matrix is used as the corresponding image in the first X-ray image set. Channel average; calculation The average value of the channel matrix is used as the corresponding image in the first X-ray image set. Channel average;
[0051] According to the Channel average and the Channel value calculation Channel difference; according to the Channel average and the Channel value calculation Channel difference; according to the Channel average and the Channel value calculation Channel difference;
[0052] According to the Channel difference, Channel difference and the The channel difference is calculated by the following formula to calculate the color difference between the preset standard color and the corresponding image in the first X-ray image set:
[0053] ;
[0054] in, is the color difference between the preset standard color and the corresponding image in the first X-ray image set, for Channel difference, for Channel difference, for Channel difference;
[0055] classifying corresponding images in the first X-ray image set according to the color difference to obtain a classification result for each image in the first X-ray image set;
[0056] Based on the classification result of each image in the first X-ray image set, the first X-ray image set is screened according to a preset image category ratio to obtain the fifth X-ray image set;
[0057] a pixel conversion size calculation module, used for calculating the pixel conversion size according to the third X-ray image set and the fourth X-ray image set;
[0058] a size conversion module, configured to perform size conversion on the first X-ray image to be converted according to the pixel conversion size to obtain a second X-ray image to be converted; perform size conversion on the fifth X-ray image set according to the pixel conversion size to obtain a seventh X-ray image set; and perform size conversion on the sixth X-ray image set according to the pixel conversion size to obtain an eighth X-ray image set;
[0059] A model training module, used for constructing an initial color conversion model, inputting the seventh X-ray image set and the eighth X-ray image set into the initial color conversion model for training, and obtaining a trained color conversion model;
[0060] The image conversion module is used to input the second X-ray image to be converted into the trained color conversion model to obtain the converted X-ray image output by the color conversion model that simulates the second security inspection machine.
[0061] The system obtains the first X-ray image to be converted from the first security inspection machine, the first X-ray image set generated by the test piece passing through the first security inspection machine, the second X-ray image set generated by the test piece passing through the second security inspection machine, the third X-ray image set generated by the designated standard piece passing through the first security inspection machine, and the fourth X-ray image set generated by the designated standard piece passing through the second security inspection machine; calculates the RGB average value of the image corresponding to each designated standard piece in the third X-ray image set, and uses it as the first standard color value of the preset standard color of the first security inspection machine; calculates the RGB average value of the image corresponding to each designated standard piece in the fourth X-ray image set, and uses it as the second standard color value of the preset standard color of the second security inspection machine, wherein the types of designated standard pieces correspond to the types of preset standard colors one by one; filters the first X-ray image set according to the first standard color value to obtain the fifth X-ray image set; filters the second X-ray image set according to the second standard color value to obtain the sixth X-ray image set; calculates the image according to the third X-ray image set and the fourth X-ray image set. pixel conversion size; size conversion of the first X-ray image to be converted according to the pixel conversion size to obtain a second X-ray image to be converted; size conversion of the fifth X-ray image set according to the pixel conversion size to obtain a seventh X-ray image set; size conversion of the sixth X-ray image set according to the pixel conversion size to obtain an eighth X-ray image set; constructing an initial color conversion model, inputting the seventh X-ray image set and the eighth X-ray image set into the initial color conversion model for training, and obtaining a trained color conversion model; inputting the second X-ray image to be converted into the trained color conversion model, and obtaining a converted X-ray image generated by a simulated second security inspection machine output by the color conversion model. The present application performs size conversion of X-ray images between different security inspection machines through the pixel sizes of different models of security inspection machines through standard parts, and then filters the training data set through color difference, and trains the model through the filtered images, thereby reducing the training data, realizing the mutual conversion of security inspection images of different models of security inspection machines, and improving the accuracy of image conversion.
[0062] According to a third aspect of the present invention, there is provided a security inspection image conversion electronic device, comprising at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the above-mentioned security inspection image conversion method.
[0063] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above-mentioned security inspection image conversion method.
[0064] It should be noted that the beneficial effects between the second to fourth aspects of the present invention and the prior art are the same as the beneficial effects between the above-mentioned security inspection image conversion system and the prior art, and will not be described in detail here.
[0065] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0067] Figure 1 is a flow chart of a security inspection image conversion method according to an embodiment of the present application;
[0068] Figure 2 It is a structural schematic diagram of an embodiment of the security inspection image conversion system provided by the present application;
[0069] Figure 3 It is a schematic structural diagram of an embodiment of an electronic device provided by the present application. DETAILED DESCRIPTION
[0070] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0071] In the description of the present invention, if there is a description of first, second, etc., it is only for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0072] In the description of the present invention, it should be understood that descriptions involving orientation, such as orientation or positional relationship indicated as up, down, etc., are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0073] In the description of the present invention, it should be noted that, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention in combination with the specific content of the technical solution.
[0074] At present, deep learning and target detection technologies are increasingly being used in the field of security inspection machine X-ray image detection. Training a model that can detect objects in security inspection machine X-ray images requires a large number of X-ray images to ensure good recognition results. However, due to the large number of security inspection machine manufacturers, the X-ray images produced by each manufacturer differ in color due to differences in technical standards, and the distortion correction strategies for X-ray images are also different. Therefore, the X-ray images generated by different manufacturers differ in color, and the model trained with images of a single model of security inspection machine cannot be well adapted to other models of security inspection machines.
[0075] In order to solve the above technical defects, the embodiments of the present application provide a security inspection image conversion method, system, device and storage medium.
[0076] See also Figure 1 , is a flow chart of a security inspection image conversion method provided by an embodiment of the present application, the method is applied to an electronic device, and the electronic device may be a server, etc. Figure 1 As shown, the security inspection image conversion method includes:
[0077] Step S101, obtaining a first X-ray image to be converted from a first security inspection machine, a first X-ray image set generated by a test piece passing through the first security inspection machine, a second X-ray image set generated by a test piece passing through a second security inspection machine, a third X-ray image set generated by a designated standard piece passing through the first security inspection machine, and a fourth X-ray image set generated by a designated standard piece passing through the second security inspection machine;
[0078] Step S102: Calculate the RGB average value of the image corresponding to each designated standard part in the third X-ray image set, and use it as the first standard color value of the preset standard color of the first security inspection machine; calculate the RGB average value of the image corresponding to each designated standard part in the fourth X-ray image set, and use it as the second standard color value of the preset standard color of the second security inspection machine, wherein the RGB average value of the image corresponding to each designated standard part is the average value calculated by each channel of R, G, and B of the image corresponding to each designated standard part, and the types of designated standard parts correspond to the types of preset standard colors one by one;
[0079] Step S103, screening the first X-ray image set according to the first standard color value to obtain a fifth X-ray image set; screening the second X-ray image set according to the second standard color value to obtain a sixth X-ray image set;
[0080] Step S104, calculating a pixel conversion size according to the third X-ray image set and the fourth X-ray image set;
[0081] Step S105, performing size conversion on the first X-ray image to be converted according to the pixel conversion size to obtain a second X-ray image to be converted; performing size conversion on the fifth X-ray image set according to the pixel conversion size to obtain a seventh X-ray image set; performing size conversion on the sixth X-ray image set according to the pixel conversion size to obtain an eighth X-ray image set;
[0082] Step S106, constructing an initial color conversion model, inputting the seventh X-ray image set and the eighth X-ray image set into the initial color conversion model for training, and obtaining a trained color conversion model;
[0083] Step S107: input the second X-ray image to be converted into the trained color conversion model to obtain the converted X-ray image output by the color conversion model that simulates the image generated by the second security inspection machine.
[0084] The method comprises the following steps: obtaining a first X-ray image to be converted from a first security inspection machine, a first X-ray image set generated by a test piece passing through the first security inspection machine, a second X-ray image set generated by a test piece passing through a second security inspection machine, a third X-ray image set generated by a designated standard piece passing through the first security inspection machine, and a fourth X-ray image set generated by a designated standard piece passing through the second security inspection machine; calculating an RGB average value of an image corresponding to each designated standard piece in the third X-ray image set, and using the average value as a first standard color value of a preset standard color of the first security inspection machine; calculating an RGB average value of an image corresponding to each designated standard piece in the fourth X-ray image set, and using the average value as a second standard color value of a preset standard color of the second security inspection machine, wherein the types of designated standard pieces correspond to the types of preset standard colors in a one-to-one manner; screening the first X-ray image set according to the first standard color value to obtain a fifth X-ray image set; screening the second X-ray image set according to the second standard color value to obtain a sixth X-ray image set; and calculating the image according to the third X-ray image set and the fourth X-ray image set. pixel conversion size; size conversion of the first X-ray image to be converted according to the pixel conversion size to obtain a second X-ray image to be converted; size conversion of the fifth X-ray image set according to the pixel conversion size to obtain a seventh X-ray image set; size conversion of the sixth X-ray image set according to the pixel conversion size to obtain an eighth X-ray image set; constructing an initial color conversion model, inputting the seventh X-ray image set and the eighth X-ray image set into the initial color conversion model for training, and obtaining a trained color conversion model; inputting the second X-ray image to be converted into the trained color conversion model, and obtaining a converted X-ray image generated by a simulated second security inspection machine output by the color conversion model. The present application performs size conversion of X-ray images between different security inspection machines through the pixel sizes of different models of security inspection machines through standard parts, and then filters the training data set through color difference, and trains the model through the filtered images, thereby reducing the training data, realizing the mutual conversion of security inspection images of different models of security inspection machines, and improving the accuracy of image conversion.
[0085] In some embodiments, in step S103, the first X-ray image set is screened according to the first standard color value to obtain a fifth X-ray image set, including:
[0086] Step S201, performing matrix normalization on the R value, G value and B value of each image in the first X-ray image set to obtain a normalized two-dimensional matrix of each image in the first X-ray image set;
[0087] Step S202: Calculate the first value, the second value and the third value according to the normalized two-dimensional matrix using the following formula:
[0088] ;
[0089] ;
[0090] ;
[0091] in, is the two-dimensional value after the R channel element value is normalized in the RGB color space, In RGB color space The two-dimensional value after the channel element value is normalized. In RGB color space The two-dimensional value after the channel element value is normalized. is the first value, is the second value, is the third value;
[0092] Step S203, calculating the Lab space color value of each image in the first X-ray image set according to the first value, the second value and the third value by the following formula:
[0093]
[0094]
[0095]
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102] in, is the first intermediate value, is the second intermediate value, is the third intermediate value, is the fourth intermediate value, is the fifth intermediate value, is the sixth intermediate value, is the color value of Lab space Channel value, is the color value of Lab space Channel value, is the color value of Lab space Channel value;
[0103] Step S204: Obtain the preset standard color Channel value, Channel value and Channel value;
[0104] Step S205: Calculate The average value of the channel matrix is used as the corresponding image in the first X-ray image set Channel average; calculation The average value of the channel matrix is used as the corresponding image in the first X-ray image set Channel average; calculation The average value of the channel matrix is used as the corresponding image in the first X-ray image set Channel average;
[0105] Step S206: Channel average and Channel value calculation Channel difference; according to Channel average and Channel value calculation Channel difference; according to Channel average and Channel value calculation Channel difference;
[0106] Step S207: Channel difference, Channel Difference and The channel difference is calculated by the following formula to calculate the color difference between the preset standard color and the corresponding image in the first X-ray image set:
[0107]
[0108] in, is the color difference between the preset standard color and the corresponding image in the first X-ray image set, for Channel difference, for Channel difference, for Channel difference;
[0109] Step S208, classifying the corresponding images in the first X-ray image set according to the color difference to obtain a classification result of each image in the first X-ray image set;
[0110] Step S209: Based on the classification result of each image in the first X-ray image set, the first X-ray image set is screened according to a preset image category ratio to obtain a fifth X-ray image set.
[0111] Specifically, this embodiment can screen the first X-ray image set, divide the images therein into orange, green and blue according to standard color values, and ensure that the number of images in the three colors is consistent. Orange generally represents organic matter in security inspection images, green generally represents mixtures in security inspection images, and blue generally represents inorganic matter in security inspection images.
[0112] Specifically, in this embodiment, the color difference may be orange color difference, green color difference and blue color difference, and the classification results may be orange, green and blue.
[0113] In this embodiment, the colors of the images are classified by calculating the color difference between each image in the first X-ray image set and the preset standard color, and the fifth X-ray image set is obtained by screening the classification results, providing more accurate data for subsequent model training, thereby improving the accuracy and efficiency of the model.
[0114] In some embodiments, obtaining a second X-ray image set generated by the test piece passing through a second security inspection machine in step S101 includes:
[0115] Step S301, obtaining the passing angle of the test piece through the first security inspection machine;
[0116] Step S302, passing the test piece through a second security inspection machine at a passing angle to obtain an initial X-ray image set;
[0117] Step S303, based on the initial X-ray image set, deduplication is performed according to a preset similarity threshold to obtain a deduplicated X-ray image set;
[0118] Step S304: cropping the image-free area of the deduplicated X-ray image set to obtain a second X-ray image set.
[0119] Specifically, all images in the initial X-ray image set are deduplicated, and the similarity between images is calculated. For a group of images with a similarity higher than 50%, the color richness of the image is calculated using the following formula, and the image with higher color richness is retained:
[0120]
[0121]
[0122]
[0123] in, Calculate the standard deviation. is the average value calculation, is the calculated color richness.
[0124] For the images in the X-ray image set after deduplication, crop the image-free area. The steps are as follows:
[0125] Convert to grayscale;
[0126] Image binarization processing;
[0127] Erosion operation to remove outliers in the image-free area;
[0128] Perform image edge detection;
[0129] The maximum circumscribed rectangle is calculated according to the edge contour of the image, and the image-free area on the image is removed according to the coordinates of the rectangle to obtain a second X-ray image set.
[0130] Specifically, in this embodiment, by processing the initial X-ray image set, the accuracy and richness of the original input data are improved, providing more accurate data for subsequent model training, thereby improving the accuracy and efficiency of the model.
[0131] In some embodiments, obtaining a fourth X-ray image set generated by a designated standard component through a second security inspection machine in step S101 includes:
[0132] Step S401, obtaining the passing angle of the designated standard component passing through the first security inspection machine;
[0133] Step S402: Divide the security inspection channel of the second security inspection machine into m intervals on the plane, where m is a preset positive integer value;
[0134] Step S403: Place the designated standard component in the middle of each section at a passing angle and pass it through the second security inspection machine to obtain a fourth X-ray image set.
[0135] Specifically, this embodiment obtains images of the designated standard parts passing through each section of the second security inspection machine to provide data basis for subsequent size calculation, thereby improving the accuracy of size conversion.
[0136] In some embodiments, calculating the pixel conversion size according to the third X-ray image set and the fourth X-ray image set in step S104 includes:
[0137] Step S501, obtaining the first position coordinates of each image of the third X-ray image set in the security inspection channel of the first security inspection machine; obtaining the second position coordinates of each image of the fourth X-ray image set in the security inspection channel of the second security inspection machine;
[0138] Step S502: Based on the first position coordinates, determine the image in the third X-ray image set corresponding to each interval to obtain the image set corresponding to the first interval; and based on the second position coordinates, determine the image in the fourth X-ray image set corresponding to each interval to obtain the image set corresponding to the second interval;
[0139] Step S503: Calculate the pixel conversion sizes corresponding to all the intervals of the first security inspection machine and the second security inspection machine based on the first interval corresponding image set and the second interval corresponding image set.
[0140] Specifically, in some embodiments, the security inspection channel of the second security inspection machine is equally divided into 10 sections on a plane, and the size standard parts (such as iron rulers) are placed in the middle of the 10 sections in sequence to collect the standard parts data;
[0141] The security inspection channel of the first security inspection machine is also equally divided into 10 parts on the plane, and the size standard parts (such as iron rulers) are placed in the middle of the 10 intervals in turn to collect the standard parts data.
[0142] Based on the pixel size of the standard parts imaging in the corresponding intervals of the two brands of security inspection machines, a mapping relationship is established (here the proportional relationship is directly obtained by comparing the two values), and the size correspondence between the 10 intervals of the two brands of security inspection machines is established in sections in turn;
[0143] The image of the first security inspection machine is converted into the imaging size of the second security inspection machine through geometric transformation according to the segmented size correspondence.
[0144] Specifically, this embodiment performs size conversion by obtaining and calculating the size correspondence between different intervals, thereby improving the accuracy of size conversion.
[0145] In some embodiments, in step S105, the size of the first X-ray image to be converted is converted according to the pixel conversion size to obtain the second X-ray image to be converted, including:
[0146] Step S601, determining a corresponding section of a first X-ray image to be converted in a security inspection channel of a first security inspection machine;
[0147] Step S602: Perform size conversion on the first X-ray image to be converted according to the corresponding interval and the pixel conversion size of the corresponding interval to obtain a second X-ray image to be converted.
[0148] In some embodiments, the designated standard parts include organic glass standard parts, aluminum plate standard parts and iron plate standard parts, and the preset standard colors include orange, green and blue. In step S102, the RGB average value of the image corresponding to each designated standard part in the third X-ray image set is calculated and used as the first standard color value of the preset standard color of the first security inspection machine, including:
[0149] Step S701, calculating the RGB average value of the image corresponding to the organic glass standard part in the third X-ray image set, and using it as the first standard color value of orange of the first security inspection machine;
[0150] Step S702, calculating the RGB average value of the image corresponding to the aluminum plate standard part in the third X-ray image set, and using it as the first standard color value of green for the first security inspection machine;
[0151] Step S703: Calculate the RGB average value of the image corresponding to the iron plate standard part in the third X-ray image set, and use it as the first standard color value of blue for the first security inspection machine.
[0152] This application only needs a small amount of data from the target brand security inspection machine to convert the existing labeled training data to the imaging rules of the target brand security inspection machine. Using the converted data to train the model can solve the problem of poor model generalization ability in the absence of target brand security inspection machine data. Experiments have shown that this application can improve the f1-score value of the detection model in this case by more than 20 points.
[0153] Specifically, in order to facilitate understanding by those skilled in the art, a set of optimal embodiments is provided below:
[0154] 1. Data acquisition:
[0155] Obtain the first X-ray image to be converted from the first security inspection machine, the first X-ray image set generated by the test piece passing through the first security inspection machine, the second X-ray image set generated by the test piece passing through the second security inspection machine, the third X-ray image set generated by the designated standard piece passing through the first security inspection machine, and the fourth X-ray image set generated by the designated standard piece passing through the second security inspection machine, specifically:
[0156] Obtain the passing angle of the test piece through the first security inspection machine;
[0157] Pass the test piece through the second security inspection machine at a passing angle to obtain an initial X-ray image set;
[0158] Based on the initial X-ray image set, deduplication is performed according to a preset similarity threshold to obtain a deduplicated X-ray image set;
[0159] The image-free region of the deduplicated X-ray image set is cropped to obtain a second X-ray image set.
[0160] Obtain the passing angle of the specified standard part through the first security inspection machine;
[0161] Divide the security inspection channel of the second security inspection machine into m intervals on the plane, where m is a preset positive integer value;
[0162] The designated standard parts are placed in the middle of each section at a passing angle and passed through the second security inspection machine to obtain a fourth X-ray image set.
[0163] 2. Calculation of standard color value:
[0164] Calculate the RGB average value of the image corresponding to each designated standard part in the third X-ray image set, and use it as the first standard color value of the preset standard color of the first security inspection machine; calculate the RGB average value of the image corresponding to each designated standard part in the fourth X-ray image set, and use it as the second standard color value of the preset standard color of the second security inspection machine, wherein the RGB average value of the image corresponding to each designated standard part is the average value calculated by each channel of R, G, and B of the image corresponding to each designated standard part, the types of designated standard parts correspond to the types of preset standard colors one by one, the designated standard parts include organic glass standard parts, aluminum plate standard parts, and iron plate standard parts, and the preset standard colors include orange, green, and blue, specifically:
[0165] Calculate the RGB average value of the image corresponding to the organic glass standard part in the third X-ray image set, and use it as the first standard color value of orange for the first security inspection machine;
[0166] Calculate the RGB average value of the image corresponding to the aluminum plate standard part in the third X-ray image set, and use it as the first standard color value of green for the first security inspection machine;
[0167] Calculate the RGB average value of the image corresponding to the iron plate standard part in the third X-ray image set, and use it as the first standard color value of blue for the first security inspection machine.
[0168] 3. Data screening:
[0169] The first X-ray image set is screened according to the first standard color value to obtain the fifth X-ray image set; the second X-ray image set is screened according to the second standard color value to obtain the sixth X-ray image set, specifically:
[0170] Performing matrix normalization on the R value, the G value, and the B value of each image in the first X-ray image set to obtain a normalized two-dimensional matrix of each image in the first X-ray image set;
[0171] Calculate the Lab space color value of each image in the first X-ray image set based on the normalized two-dimensional matrix
[0172] According to the Lab space color value of each image, calculate the corresponding image in the first X-ray image set. Channel averages, and corresponding images in the first X-ray image set Channel averages and corresponding images in the first X-ray image set Channel average;
[0173] according to Channel average and Channel value calculation Channel difference; according to Channel average and Channel value calculation Channel difference; according to Channel average and Channel value calculation Channel difference;
[0174] according to Channel difference, Channel Difference and The channel difference is calculated by the following formula to calculate the color difference between the preset standard color and the corresponding image in the first X-ray image set:
[0175]
[0176] in, is the color difference between the preset standard color and the corresponding image in the first X-ray image set, for Channel difference, for Channel difference, for Channel difference;
[0177] classifying corresponding images in the first X-ray image set according to color difference to obtain a classification result for each image in the first X-ray image set;
[0178] Based on the classification result of each image in the first X-ray image set, the first X-ray image set is screened according to a preset image category ratio to obtain a fifth X-ray image set.
[0179] 4. Pixel conversion size conversion:
[0180] The pixel conversion size is calculated according to the third X-ray image set and the fourth X-ray image set, specifically:
[0181] Obtaining the first position coordinates of each image of the third X-ray image set in the security inspection channel of the first security inspection machine; obtaining the second position coordinates of each image of the fourth X-ray image set in the security inspection channel of the second security inspection machine;
[0182] Based on the first position coordinates, determine the image in the third X-ray image set corresponding to each interval to obtain the image set corresponding to the first interval; and based on the second position coordinates, determine the image in the fourth X-ray image set corresponding to each interval to obtain the image set corresponding to the second interval;
[0183] Based on the first interval corresponding image set and the second interval corresponding image set, the pixel conversion sizes corresponding to all intervals of the first security inspection machine and the second security inspection machine are calculated.
[0184] The first X-ray image to be converted is converted according to the pixel conversion size to obtain a second X-ray image to be converted; the fifth X-ray image set is converted according to the pixel conversion size to obtain a seventh X-ray image set; the sixth X-ray image set is converted according to the pixel conversion size to obtain an eighth X-ray image set, specifically:
[0185] Determine a corresponding interval of the first X-ray image to be converted in the security inspection channel of the first security inspection machine;
[0186] The first X-ray image to be converted is resized according to the corresponding interval and the pixel conversion size of the corresponding interval to obtain a second X-ray image to be converted.
[0187] 5. Image conversion:
[0188] constructing an initial color conversion model, inputting the seventh X-ray image set and the eighth X-ray image set into the initial color conversion model for training, and obtaining a trained color conversion model;
[0189] The second X-ray image to be converted is input into the trained color conversion model to obtain a converted X-ray image generated by the second security inspection machine, which is output by the color conversion model.
[0190] In addition, refer to Figure 2 One embodiment of the present invention provides a security inspection image conversion system, including a data acquisition module 1100, an RGB average value calculation module 1200, a screening module 1300, a pixel conversion size calculation module 1400, a size conversion module 1500, a model training module 1600 and an image conversion module 1700, wherein:
[0191] The data acquisition module 1100 is used to acquire a first X-ray image to be converted from the first security inspection machine, a first X-ray image set generated by the test piece passing through the first security inspection machine, a second X-ray image set generated by the test piece passing through the second security inspection machine, a third X-ray image set generated by the designated standard piece passing through the first security inspection machine, and a fourth X-ray image set generated by the designated standard piece passing through the second security inspection machine;
[0192] The RGB average value calculation module 1200 is used to calculate the RGB average value of the image corresponding to each designated standard part in the third X-ray image set, and use it as the first standard color value of the preset standard color of the first security inspection machine; calculate the RGB average value of the image corresponding to each designated standard part in the fourth X-ray image set, and use it as the second standard color value of the preset standard color of the second security inspection machine, wherein the RGB average value of the image corresponding to each designated standard part is the average value calculated by each channel of R, G, and B of the image corresponding to each designated standard part, and the types of designated standard parts correspond to the types of preset standard colors one by one;
[0193] The screening module 1300 is used to screen the first X-ray image set according to the first standard color value to obtain a fifth X-ray image set; and screen the second X-ray image set according to the second standard color value to obtain a sixth X-ray image set;
[0194] The step of screening the first X-ray image set according to the first standard color value to obtain a fifth X-ray image set includes:
[0195] performing matrix normalization on the R value, the G value, and the B value of each image in the first X-ray image set to obtain a normalized two-dimensional matrix of each image in the first X-ray image set;
[0196] Calculating the Lab space color value of each image in the first X-ray image set according to the normalized two-dimensional matrix;
[0197] According to the Lab space color value of each image, the corresponding image in the first X-ray image set is calculated. Channel averages, and corresponding images in the first X-ray image set The channel average and the corresponding image in the first X-ray image set Channel average;
[0198] According to the Channel average and the Channel value calculation Channel difference; according to the Channel average and the Channel value calculation Channel difference; according to the Channel average and the Channel value calculation Channel difference;
[0199] According to the Channel difference, Channel difference and the The channel difference is calculated by the following formula to calculate the color difference between the preset standard color and the corresponding image in the first X-ray image set:
[0200] ;
[0201] in, is the color difference between the preset standard color and the corresponding image in the first X-ray image set, for Channel difference, for Channel difference, for Channel difference;
[0202] classifying corresponding images in the first X-ray image set according to the color difference to obtain a classification result for each image in the first X-ray image set;
[0203] Based on the classification result of each image in the first X-ray image set, the first X-ray image set is screened according to a preset image category ratio to obtain the fifth X-ray image set;
[0204] The pixel conversion size calculation module 1400 is used to calculate the pixel conversion size according to the third X-ray image set and the fourth X-ray image set;
[0205] The size conversion module 1500 is used to perform size conversion on the first X-ray image to be converted according to the pixel conversion size to obtain the second X-ray image to be converted; perform size conversion on the fifth X-ray image set according to the pixel conversion size to obtain the seventh X-ray image set; perform size conversion on the sixth X-ray image set according to the pixel conversion size to obtain the eighth X-ray image set;
[0206] The model training module 1600 is used to construct an initial color conversion model, input the seventh X-ray image set and the eighth X-ray image set into the initial color conversion model for training, and obtain a trained color conversion model;
[0207] The image conversion module 1700 is used to input the second X-ray image to be converted into a trained color conversion model to obtain a converted X-ray image output by the color conversion model that simulates the second security inspection machine.
[0208] The system obtains the first X-ray image to be converted from the first security inspection machine, the first X-ray image set generated by the test piece passing through the first security inspection machine, the second X-ray image set generated by the test piece passing through the second security inspection machine, the third X-ray image set generated by the designated standard piece passing through the first security inspection machine, and the fourth X-ray image set generated by the designated standard piece passing through the second security inspection machine; calculates the RGB average value of the image corresponding to each designated standard piece in the third X-ray image set, and uses it as the first standard color value of the preset standard color of the first security inspection machine; calculates the RGB average value of the image corresponding to each designated standard piece in the fourth X-ray image set, and uses it as the second standard color value of the preset standard color of the second security inspection machine, wherein the types of designated standard pieces correspond to the types of preset standard colors one by one; filters the first X-ray image set according to the first standard color value to obtain the fifth X-ray image set; filters the second X-ray image set according to the second standard color value to obtain the sixth X-ray image set; calculates the image according to the third X-ray image set and the fourth X-ray image set. pixel conversion size; size conversion of the first X-ray image to be converted according to the pixel conversion size to obtain a second X-ray image to be converted; size conversion of the fifth X-ray image set according to the pixel conversion size to obtain a seventh X-ray image set; size conversion of the sixth X-ray image set according to the pixel conversion size to obtain an eighth X-ray image set; constructing an initial color conversion model, inputting the seventh X-ray image set and the eighth X-ray image set into the initial color conversion model for training, and obtaining a trained color conversion model; inputting the second X-ray image to be converted into the trained color conversion model, and obtaining a converted X-ray image generated by a simulated second security inspection machine output by the color conversion model. The present application performs size conversion of X-ray images between different security inspection machines through the pixel sizes of different models of security inspection machines through standard parts, and then filters the training data set through color difference, and trains the model through the filtered images, thereby reducing the training data, realizing the mutual conversion of security inspection images of different models of security inspection machines, and improving the accuracy of image conversion.
[0209] It should be noted that the present system embodiment and the above-mentioned method embodiment are based on the same inventive concept, so the relevant contents of the above-mentioned method embodiment are also applicable to the present system embodiment and will not be repeated here.
[0210] Figure 3 A schematic diagram of the hardware structure of security inspection image conversion provided in an embodiment of the present application is shown.
[0211] The security inspection image conversion device may include a processor 301 and a memory 302 storing computer program instructions.
[0212] Specifically, the processor 301 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0213] The memory 302 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 302 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, the memory 302 may include a removable or non-removable (or fixed) medium. In appropriate cases, the memory 302 may be inside or outside the integrated gateway disaster recovery device. In a specific embodiment, the memory 302 is a non-volatile solid-state memory.
[0214] In some embodiments, the memory 302 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage media device, an optical storage media device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present disclosure.
[0215] The processor 301 implements any one of the security inspection image conversion methods in the above embodiments by reading and executing computer program instructions stored in the memory 302 .
[0216] In one example, the security inspection image conversion device may further include a communication interface 303 and a bus 310. Figure 3 As shown, the processor 301, the memory 302, and the communication interface 303 are connected via a bus 310 and communicate with each other.
[0217] The communication interface 303 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0218] The bus 310 includes hardware, software or both, coupling the components of the security image conversion device to each other. For example, but not limitation, the bus may include an accelerated graphics port (AGP) or other graphics bus, an enhanced industrial standard architecture (EISA) bus, a front-side bus (FSB), a hypertransport (HT) interconnect, an industrial standard architecture (ISA) bus, an infinite bandwidth interconnect, a low pin count (LPC) bus, a memory bus, a microchannel architecture (MCA) bus, a peripheral component interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a serial advanced technology attachment (SATA) bus, a video electronics standard association local (VLB) bus or other suitable bus or a combination of two or more of these. Where appropriate, the bus 310 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the present application considers any suitable bus or interconnect.
[0219] The security inspection image conversion device can execute the security inspection image conversion method in the embodiment of the present application based on the three-dimensional design model, thereby realizing the combination of Figure 1 and Figure 2 The security inspection image conversion method and system are described.
[0220] In addition, in combination with the security inspection image conversion method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any of the security inspection image conversion methods in the above embodiment is implemented.
[0221] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0222] The functional blocks shown in the structural block diagram described above can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier. "Machine-readable medium" may include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROMs, flash memories, erasable ROMs (EROMs), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0223] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0224] Aspects of the present disclosure are described above with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the functions / actions specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs the specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0225] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A security inspection image conversion method, characterized in that: The security inspection image conversion method comprises: Obtain a first X-ray image to be converted from the first security inspection machine, a first X-ray image set generated by the test piece passing through the first security inspection machine, a second X-ray image set generated by the test piece passing through the second security inspection machine, a third X-ray image set generated by the designated standard piece passing through the first security inspection machine, and a fourth X-ray image set generated by the designated standard piece passing through the second security inspection machine; Calculate the RGB average value of each image corresponding to the designated standard part in the third X-ray image set, and use it as the first standard color value of the preset standard color of the first security inspection machine; calculate the RGB average value of each image corresponding to the designated standard part in the fourth X-ray image set, and use it as the second standard color value of the preset standard color of the second security inspection machine, wherein the RGB average value of each image corresponding to the designated standard part is the average value calculated by each channel of R, G, and B of each image corresponding to the designated standard part, and the types of the designated standard parts correspond to the types of the preset standard colors one by one; The first X-ray image set is screened according to the first standard color value to obtain a fifth X-ray image set; the second X-ray image set is screened according to the second standard color value to obtain a sixth X-ray image set; Calculating a pixel conversion size based on the third X-ray image set and the fourth X-ray image set; Performing size conversion on the first X-ray image to be converted according to the pixel conversion size to obtain a second X-ray image to be converted; performing size conversion on the fifth X-ray image set according to the pixel conversion size to obtain a seventh X-ray image set; performing size conversion on the sixth X-ray image set according to the pixel conversion size to obtain an eighth X-ray image set; constructing an initial color conversion model, inputting the seventh X-ray image set and the eighth X-ray image set into the initial color conversion model for training, and obtaining a trained color conversion model; Inputting the second X-ray image to be converted into the trained color conversion model to obtain a converted X-ray image output by the color conversion model that simulates the image generated by the second security inspection machine; The step of screening the first X-ray image set according to the first standard color value to obtain a fifth X-ray image set includes: performing matrix normalization on the R value, the G value, and the B value of each image in the first X-ray image set to obtain a normalized two-dimensional matrix of each image in the first X-ray image set; The Lab space color value of each image in the first X-ray image set is calculated according to the normalized two-dimensional matrix; wherein the Lab space color value of each image includes Channel value, Channel value and Channel value; According to the Lab space color value of each image, calculate the color of the corresponding image in the first X-ray image set. The channel average value and the corresponding image in the first X-ray image set The channel average and the corresponding image in the first X-ray image set Channel average; According to the Channel average and the Channel value calculation Channel difference; according to the Channel average and the Channel value calculation Channel difference; according to the Channel average and the Channel value calculation Channel difference; According to the Channel difference, Channel difference and the The channel difference is calculated by the following formula to calculate the color difference between the preset standard color and the corresponding image in the first X-ray image set: ; in, is the color difference between the preset standard color and the corresponding image in the first X-ray image set, for Channel difference, for Channel difference, for Channel difference; classifying corresponding images in the first X-ray image set according to the color difference to obtain a classification result for each image in the first X-ray image set; Based on the classification result of each image in the first X-ray image set, the first X-ray image set is screened according to a preset image category ratio to obtain the fifth X-ray image set.
2. A security inspection image conversion method according to claim 1, characterized in that: Acquiring a second X-ray image set generated by the test piece passing through a second security inspection machine, comprising: Obtaining a passing angle of the test piece through the first security inspection machine; Passing the test piece through the second security inspection machine at the passing angle to obtain an initial X-ray image set; Based on the initial X-ray image set, deduplication is performed according to a preset similarity threshold to obtain a deduplicated X-ray image set; The image-free area of the deduplicated X-ray image set is cropped to obtain the second X-ray image set.
3. A security inspection image conversion method according to claim 1, characterized in that: Acquiring a fourth X-ray image set generated by the designated standard component through the second security inspection machine, comprising: Obtaining a passing angle of the designated standard component through the first security inspection machine; Divide the security inspection channel of the second security inspection machine into m intervals on a plane, where m is a preset positive integer value; The designated standard part is sequentially placed in the middle of each section at the passing angle and passed through the second security inspection machine to obtain the fourth X-ray image set.
4. A security inspection image conversion method according to claim 3, characterized in that: The calculating the pixel conversion size according to the third X-ray image set and the fourth X-ray image set comprises: Obtaining first position coordinates of each image in the third X-ray image set in the security inspection channel of the first security inspection machine; obtaining second position coordinates of each image in the fourth X-ray image set in the security inspection channel of the second security inspection machine; Based on the first position coordinates, determine the image in the third X-ray image set corresponding to each of the intervals to obtain a first interval corresponding image set; and based on the second position coordinates, determine the image in the fourth X-ray image set corresponding to each of the intervals to obtain a second interval corresponding image set; Based on the first interval corresponding image set and the second interval corresponding image set, the pixel conversion sizes corresponding to all the intervals of the first security inspection machine and the second security inspection machine are calculated.
5. A security inspection image conversion method according to claim 4, characterized in that: The step of converting the size of the first X-ray image to be converted according to the pixel conversion size to obtain a second X-ray image to be converted includes: Determining a corresponding interval of the first X-ray image to be converted in a security inspection channel of the first security inspection machine; The first X-ray image to be converted is resized according to the corresponding interval and the pixel conversion size of the corresponding interval to obtain the second X-ray image to be converted.
6. A security inspection image conversion method according to claim 1, characterized in that: The designated standard parts include organic glass standard parts, aluminum plate standard parts and iron plate standard parts, and the preset standard colors include orange, green and blue, which are used as the first standard color value of the preset standard color of the first security inspection machine, including: Calculate the RGB average value of the image corresponding to the organic glass standard part in the third X-ray image set, and use it as the first standard color value of the orange color of the first security inspection machine; Calculate the RGB average value of the image corresponding to the aluminum plate standard part in the third X-ray image set, and use it as the first standard color value of the green color of the first security inspection machine; The RGB average value of the image corresponding to the iron plate standard part in the third X-ray image set is calculated and used as the first standard color value of the blue of the first security inspection machine.
7. A security inspection image conversion system, characterized in that: The security inspection image conversion system comprises: A data acquisition module is used to acquire a first X-ray image to be converted by the first security inspection machine, a first X-ray image set generated by the test piece passing through the first security inspection machine, a second X-ray image set generated by the test piece passing through the second security inspection machine, a third X-ray image set generated by the designated standard piece passing through the first security inspection machine, and a fourth X-ray image set generated by the designated standard piece passing through the second security inspection machine; an RGB average value calculation module, used to calculate the RGB average value of each image corresponding to the designated standard part in the third X-ray image set, and use it as the first standard color value of the preset standard color of the first security inspection machine; calculate the RGB average value of each image corresponding to the designated standard part in the fourth X-ray image set, and use it as the second standard color value of the preset standard color of the second security inspection machine, wherein the RGB average value of each image corresponding to the designated standard part is the average value calculated respectively by each channel of R, G, and B of each image corresponding to the designated standard part, and the types of the designated standard parts correspond to the types of the preset standard colors one by one; a screening module, configured to screen the first X-ray image set according to the first standard color value to obtain a fifth X-ray image set; and screen the second X-ray image set according to the second standard color value to obtain a sixth X-ray image set; wherein the screening of the first X-ray image set according to the first standard color value to obtain the fifth X-ray image set comprises: performing matrix normalization on the R value, the G value, and the B value of each image in the first X-ray image set to obtain a normalized two-dimensional matrix of each image in the first X-ray image set; The Lab space color value of each image in the first X-ray image set is calculated according to the normalized two-dimensional matrix; wherein the Lab space color value of each image includes Channel value, Channel value and Channel value; According to the Lab space color value of each image, calculate the color of the corresponding image in the first X-ray image set. The channel average value and the corresponding image in the first X-ray image set The channel average and the corresponding image in the first X-ray image set Channel average; calculate The average value of the channel matrix is used as the corresponding image in the first X-ray image set. Channel average; calculation The average value of the channel matrix is used as the corresponding image in the first X-ray image set. Channel average; calculation The average value of the channel matrix is used as the corresponding image in the first X-ray image set. Channel average; According to the Channel average and the Channel value calculation Channel difference; according to the Channel average and the Channel value calculation Channel difference; according to the Channel average and the Channel value calculation Channel difference; According to the Channel difference, Channel difference and the The channel difference is calculated by the following formula to calculate the color difference between the preset standard color and the corresponding image in the first X-ray image set: ; in, is the color difference between the preset standard color and the corresponding image in the first X-ray image set, for Channel difference, for Channel difference, for Channel difference; classifying corresponding images in the first X-ray image set according to the color difference to obtain a classification result for each image in the first X-ray image set; Based on the classification result of each image in the first X-ray image set, the first X-ray image set is screened according to a preset image category ratio to obtain the fifth X-ray image set; a pixel conversion size calculation module, used for calculating the pixel conversion size according to the third X-ray image set and the fourth X-ray image set; a size conversion module, configured to perform size conversion on the first X-ray image to be converted according to the pixel conversion size to obtain a second X-ray image to be converted; perform size conversion on the fifth X-ray image set according to the pixel conversion size to obtain a seventh X-ray image set; and perform size conversion on the sixth X-ray image set according to the pixel conversion size to obtain an eighth X-ray image set; A model training module, used for constructing an initial color conversion model, inputting the seventh X-ray image set and the eighth X-ray image set into the initial color conversion model for training, and obtaining a trained color conversion model; The image conversion module is used to input the second X-ray image to be converted into the trained color conversion model to obtain the converted X-ray image output by the color conversion model that simulates the second security inspection machine.
8. A security inspection image conversion device, characterized in that: It includes at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute a security inspection image conversion method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute a security inspection image conversion method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
X-ray security check system and method based on convolutional neural network
CN111126238A
X-ray image-based prohibited article detection and identification method, system and equipment
CN112884085A
Dyeing normalization system and method based on LAB color space matching
CN117058014A
Image processing method, and training method and device of image processing model
CN117218213A
Security check image conversion method, system and device and storage medium
CN117336453A
