X-ray machine liquid identification method and system based on double sources and double visual angles and medium

Through the dual-source and dual-view X-ray machine liquid identification method, the energy spectrum grayscale image and gradient boosting decision tree model are used to solve the problem of liquid containers being easily blocked, achieve accurate identification of liquid types, and improve the accuracy of security inspections. sex.

CN118587434AActive Publication Date: 2024-09-03CHENGDU ZHIYUANHUI CULTURE & MEDIA CO LTD

Patent Information

Application Number
CN202410623864.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-20
Publication Date
2024-09-03
Estimated Expiration
2044-05-20

AI Technical Summary

Technical Problem

Existing liquid item security inspection technology is difficult to accurately identify liquid components, especially because liquid containers are easily blocked, making it difficult for X-ray machines to accurately identify the type of liquid in the package.

Method used

The X-ray machine liquid identification method with dual sources and dual viewing angles is used to obtain the energy spectrum grayscale image of the dual viewing angles to find the minimum intersection part of the container in the package that is not blocked, and use the gradient boosting decision tree model to predict the liquid type. Reduce the impact of obstructions on recognition results.

Benefits of technology

It effectively avoids the impact of obstructions on liquid type identification, improves the accurate identification rate of liquid containers and liquid types, and ensures the accuracy of liquid identification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587434A
    Figure CN118587434A
Patent Text Reader

Abstract

The invention discloses an X-ray machine liquid identification method and system based on double sources and double visual angles and a medium, the double visual angles comprise a horizontal visual angle and a vertical visual angle which are perpendicular to each other, and an energy spectrum grey-scale map of the horizontal visual angle and an energy spectrum grey-scale map of the vertical visual angle generated by a double-source double-visual-angle X-ray irradiation package are obtained; target detection and segmentation are carried out on the energy spectrum grey-scale maps under the two visual angles respectively, and a horizontal visual angle wrapping area and a vertical visual angle wrapping area are obtained; respectively selecting unshielded container parts in the horizontal view angle wrapping area and the vertical view angle wrapping area, and solving an intersection of the container parts under the two view angles of water to obtain an unshielded minimum intersection part of the container under the two view angles; and obtaining an energy spectrum gray value corresponding to the minimum intersection part, and inputting the energy spectrum gray value into a pre-trained liquid identification model to obtain a predicted liquid type. And finding out the unshielded minimum intersection part of the container in the parcel, so that the influence of a shielding object on identification can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of liquid security inspection, and in particular to a liquid identification method, system and medium of an X-ray machine based on dual-source and dual-viewing angles. Background Art

[0002] Among the existing liquid article security inspection technologies, the non-destructive testing method based on X-ray transmission imaging technology has been highly valued for its high accuracy of inspection results and low sensitivity to container materials.

[0003] Existing security inspection image recognition technology collects the shape and color information of objects in X-ray images for identification. It can only identify solid objects such as knives and guns, but cannot identify liquid components. Since the atomic numbers of different liquids are similar, the color difference between X-ray images of the same liquid is small, such as paint and glue are all green, and water, alcohol, gasoline are all yellow. It is impossible to distinguish different liquids based on color information. In addition, liquids are generally lighter in color, so the liquid container is usually identified first. After the liquid container is found, the type of liquid is identified. However, the liquid container usually enters the X-ray machine with the package, and the liquid container is placed in the package. The objects placed in the package can easily block the liquid container. It is difficult for the X-ray machine to accurately identify the liquid container in the package, resulting in inaccurate identification of the final liquid type. Summary of the invention

[0004] The purpose of the present invention is to provide a dual-source dual-view X-ray machine liquid identification method, system and medium, which utilizes the dual-source dual-view energy spectrum grayscale image to find the minimum unobstructed intersection part of the container in the package, that is, the unobstructed part that can be seen from two viewing angles, thereby avoiding the influence of other obstructions on the identification of liquid types.

[0005] In order to achieve the above objectives, this application proposes the following solutions:

[0006] On the one hand, the present application provides an X-ray machine liquid identification method based on dual-source dual-viewing angles, wherein the dual-viewing angles include a horizontal viewing angle and a vertical viewing angle that are perpendicular to each other, and specifically includes the following steps:

[0007] S1. Acquire a grayscale energy spectrum image of a horizontal viewing angle and a grayscale energy spectrum image of a vertical viewing angle generated by irradiating a package with dual-source and dual-viewing angle X-rays, wherein the grayscale energy spectrum image includes a high-energy grayscale energy spectrum image and a low-energy grayscale energy spectrum image;

[0008] S2, performing target detection and segmentation on the energy spectrum grayscale images under two viewing angles respectively, and obtaining a horizontal viewing angle wrapped area and a vertical viewing angle wrapped area;

[0009] S3, selecting an unobstructed horizontal container portion in the horizontal perspective wrapping area, and selecting an unobstructed vertical container portion in the vertical perspective wrapping area, and solving the intersection of the horizontal container portion and the vertical container portion to obtain the minimum intersection portion where the containers are not obstructed under the two perspectives;

[0010] S4. Obtain the energy spectrum grayscale value corresponding to the minimum intersection part and input it into a pre-trained liquid recognition model to obtain the predicted liquid type. The liquid recognition model uses a gradient boosting decision tree to predict the liquid type.

[0011] In the prior art, the liquid container is placed in a package, and the objects placed in the package easily block the liquid container, making it difficult for an X-ray machine to accurately identify the liquid container in the package, resulting in inaccurate identification of the final liquid type.

[0012] Therefore, the idea of ​​the present application to solve the above problem is: through the grayscale images of the energy spectrum under two viewing angles, first find the minimum intersection part of the container that is not blocked under the two viewing angles; in this way, the part containing only the container can be obtained, and the liquid type can be identified based on this part, which can reduce the impact of the obstruction on the identification result. In addition, the present application uses the gradient boosting decision tree method to fit the correspondence between the characteristics of the liquid container filled with liquid and the atomic number of the liquid, and the corresponding liquid type can be obtained. Since the liquid is generally placed in a container and then identified, only by correctly identifying the container can the type of liquid in the container be further identified.

[0013] In some specific implementations, in the energy spectrum grayscale image, a coordinate system is established with the upper left corner of the energy spectrum grayscale image as the coordinate origin, and the conveying direction along the conveyor belt is the X-axis. The specific process of step S3 is:

[0014] S31, obtaining all pixel coordinate values ​​of the horizontal container part, and filtering out a horizontal minimum range set of X coordinates in the horizontal direction from all pixel coordinate values;

[0015] S32, obtaining all pixel coordinate values ​​of the vertical container part, and filtering out a vertical minimum range set of X coordinates in the vertical direction from all pixel coordinate values;

[0016] S33. Solve the intersection of the horizontal minimum range set and the vertical minimum range set to obtain the minimum intersection part that can see the container without being blocked in the horizontal and vertical directions, and store the energy spectrum grayscale value in the horizontal direction corresponding to the minimum intersection part in the horizontal energy spectrum grayscale set, and store the energy spectrum grayscale value in the vertical direction corresponding to the minimum intersection part in the vertical energy spectrum grayscale set.

[0017] In some specific implementations, the method for screening the minimum range set is:

[0018] All pixel coordinate values ​​are screened and classified, and pixel coordinate values ​​with the same Y-axis coordinate are stored in a pixel set to obtain several pixel sets;

[0019] Solve the X coordinate value range of each pixel set to obtain several X coordinate value ranges;

[0020] Solve the intersection of several X coordinate value ranges to obtain the minimum range set.

[0021] In some specific implementations, the energy spectrum grayscale value includes a high energy grayscale value and a low energy grayscale value, the horizontal energy spectrum grayscale set includes a horizontal high energy grayscale value set and a horizontal low energy grayscale value set, and the vertical energy spectrum grayscale set includes a vertical high energy grayscale value set and a vertical low energy grayscale value set. The process of obtaining the predicted liquid type is:

[0022] Performing feature analysis on a horizontal high-energy grayscale value set and a horizontal low-energy grayscale value set, a vertical high-energy grayscale value set and a vertical low-energy grayscale value set to obtain a number of feature values;

[0023] Several eigenvalues ​​are input into the iterative prediction model and fitted using a gradient boosting decision tree to obtain the predicted atomic number;

[0024] According to the correspondence between atomic number and liquid type, find the liquid type corresponding to the predicted atomic number.

[0025] In some specific implementations, N values ​​are selected from the horizontal high energy gray value set, the horizontal low energy gray value set, the vertical high energy gray value set, and the vertical low energy gray value set, respectively, and the characteristic values ​​include:

[0026] 1) Calculate the grayscale value difference T1 in the horizontal and vertical directions; I v represents the value selected from the horizontal high-energy grayscale value set, I h represents a value selected from a set of vertical high-energy grayscale values ​​in the vertical direction;

[0027] 2) Calculate the difference between the high energy spectrum grayscale image and the low energy spectrum grayscale image in the vertical direction I 垂直高 (i) represents the value selected from the vertical high-energy grayscale value set, I 垂直低 (i) represents a value selected from a set of vertical low-energy grayscale values;

[0028] 3) Calculate the difference between the high energy spectrum grayscale image and the low energy spectrum grayscale image in the horizontal direction I 水平高 (i) represents the value selected from the horizontal high-energy grayscale value set, I 水平低 (i) represents a value selected from a set of horizontal low-energy grayscale values;

[0029] 4) comparing the maximum grayscale value and the minimum grayscale value in the horizontal direction and the maximum grayscale value and the minimum grayscale value in the vertical direction among the values ​​selected from the horizontal high-energy grayscale value set, the horizontal low-energy grayscale value set, the vertical high-energy grayscale value set, and the vertical low-energy grayscale value set;

[0030] In some specific implementations, the feature value also includes using the edge feature detection algorithm Canny to detect the average value of the edge grayscale value of the vertical container part in the vertical direction and the average value of the edge grayscale value of the horizontal container part in the horizontal direction.

[0031] In some specific implementations, the training process is:

[0032] Collecting liquid containers filled with different types of liquids as training samples, preprocessing the training samples, and obtaining the characteristic value and liquid type of each sample;

[0033] The training samples are iteratively trained by using a gradient boosting decision tree, and the characteristic values ​​are fitted to obtain the atomic number of each sample, thereby constructing an iterative prediction model, and a corresponding relationship table between the atomic number of each sample and the type of liquid to which the sample belongs can be obtained.

[0034] In some specific implementations, the iterative training method is:

[0035] S01, initializing the decision tree, taking all the eigenvalues ​​as nodes of the decision tree as the initial model to fit the training sample data, obtaining the fitted atomic number, and calculating the residual between the fitted atomic number and the true value;

[0036] S02, taking the residual as the new target value, reconstructing a new decision tree, and fitting the residual using the new decision tree to obtain this decision tree model;

[0037] S03, adding the current decision tree model to the previous iterative decision tree model to obtain the current iterative decision tree model;

[0038] S04, repeating the above steps S02-S03 until a preset number of iterations is reached, and obtaining an iterative prediction model;

[0039] S05, inputting the characteristic value of each sample into the iterative prediction model to obtain the predicted atomic number;

[0040] S06. Obtain a corresponding relationship table between the atomic number of each liquid and the liquid type according to the predicted atomic number and the liquid type corresponding to the sample.

[0041] In a second aspect, the present application provides an X-ray machine liquid identification system based on dual sources and dual viewing angles, applying an X-ray machine liquid identification method based on dual sources and dual viewing angles according to the first aspect, comprising:

[0042] An acquisition module, used to acquire a grayscale energy spectrum image of a horizontal viewing angle and a grayscale energy spectrum image of a vertical viewing angle generated by a dual-source dual-viewing angle X-ray irradiation package, wherein the grayscale energy spectrum image includes a high-energy grayscale energy spectrum image and a low-energy grayscale energy spectrum image;

[0043] The target detection module is used to perform target detection and segmentation on the energy spectrum grayscale images under two viewing angles to obtain the horizontal viewing angle wrapped area and the vertical viewing angle wrapped area;

[0044] The container recognition module is used to select the unobstructed horizontal container part in the horizontal perspective wrapping area, select the unobstructed vertical container part in the vertical perspective wrapping area, and solve the intersection of the horizontal container part and the vertical container part to obtain the minimum unobstructed intersection part of the container under the two perspectives;

[0045] The liquid recognition module is used to obtain the energy spectrum grayscale value corresponding to the minimum intersection part and input it into the pre-trained liquid recognition model to obtain the predicted liquid type. The liquid recognition model uses a gradient boosting decision tree to predict the liquid type.

[0046] In a third aspect, the present application provides a computer-readable storage medium, comprising:

[0047] one or more processors;

[0048] A storage unit is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors can implement a dual-source and dual-viewing X-ray machine liquid identification and verification method according to the first aspect.

[0049] The present invention has the beneficial effects:

[0050] The present application utilizes a dual-source dual-view energy spectrum grayscale image. Since the liquid needs to be placed in a liquid container, the identification of the location of the liquid can be converted into the identification of the liquid container, and the minimum unobstructed intersection part of the container in the package is found, that is, the unobstructed part that can be seen from two perspectives, and the unobstructed liquid container part, that is, the liquid part, is obtained, thereby avoiding the influence of other obstructions on the identification of the liquid type. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] Figure 1 A flow chart of a liquid identification method based on a dual-source dual-viewing angle X-ray machine provided in an embodiment of the present invention;

[0052] Figure 2A schematic diagram of a security inspection scenario based on a dual-source dual-viewing angle X-ray machine provided in an embodiment of the present invention;

[0053] Figure 3 A schematic diagram of searching for the minimum intersection part in an energy spectrum diagram under dual viewing angles provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present invention and its application or use. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0055] The relative arrangement of components and steps, the numerical expressions and numerical values ​​set forth in these embodiments do not limit the scope of the present invention unless specifically stated otherwise.

[0056] At the same time, it should be understood that for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship.

[0057] Additionally, descriptions of well-known structures, functions, and configurations may be omitted for clarity and conciseness.One of ordinary skill in the art will recognize that various changes and modifications may be made to the examples described herein without departing from the spirit and scope of the present disclosure.

[0058] Technologies, methods, and apparatus known to ordinary technicians in the relevant field may not be discussed in detail, but where appropriate, such technologies, methods, and apparatus should be considered part of the authorization specification.

[0059] In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0060] Example

[0061] like Figure 1 As shown, this embodiment provides an X-ray machine liquid identification method based on dual-source dual-viewing angles, the dual-viewing angles include a horizontal viewing angle and a vertical viewing angle that are perpendicular to each other, and specifically includes the following steps:

[0062] S1. Acquire a grayscale energy spectrum image of a horizontal viewing angle and a grayscale energy spectrum image of a vertical viewing angle generated by irradiating a package with dual-source and dual-viewing angle X-rays, wherein the grayscale energy spectrum image includes a high-energy grayscale energy spectrum image and a low-energy grayscale energy spectrum image;

[0063] S2. Target detection and segmentation are performed on the energy spectrum grayscale images under the two viewing angles to obtain the horizontal viewing angle package area and the vertical viewing angle package area. The target detection uses the YOLO target detection algorithm to find the area where the liquid container is located in the package. Since the area where the liquid container is located is likely to be blocked by other objects, such as Figure 2 As shown, since liquid generally needs to be carried by a liquid container, if the liquid container is full of liquid, the identification of the liquid can be converted into the identification of the liquid container. Specifically, it is necessary to find the unobstructed part of the container;

[0064] S3, selecting an unobstructed horizontal container portion in the horizontal perspective wrapping area, and selecting an unobstructed vertical container portion in the vertical perspective wrapping area, and solving the intersection of the horizontal container portion and the vertical container portion to obtain the minimum unobstructed intersection portion of the container under the two perspectives;

[0065] In the energy spectrum grayscale image, a coordinate system is established with the upper left corner of the energy spectrum grayscale image as the coordinate origin, and the conveying direction along the conveyor belt is the X-axis. The specific process of step S3 is:

[0066] S31, obtaining all pixel coordinate values ​​of the horizontal container part, and filtering out a horizontal minimum range set of X coordinates in the horizontal direction from all pixel coordinate values;

[0067] The screening process is as follows: all pixel coordinate values ​​are screened and classified, pixel coordinate values ​​with the same Y-axis coordinate are stored in a pixel set, the pixel set is recorded as Xn, and several pixel sets X1, X2...Xn are obtained; the X-coordinate value range of each pixel set is solved to obtain several X-coordinate value ranges; the intersection of several X-coordinate value ranges is solved to obtain the minimum range set.

[0068] For example, if the pixel set X1 ((2,3), (3,3), ..., (x1,3)), the pixel set X2 ((5,4), (6,4), ..., (x2,4)), the pixel set Xn ((1,6), (2,6), ..., (xn,6)), and x1 < x2 ... < xn; then the X coordinate range is 2 ~ x1, 5 ~ x2, 1 ~ xn; then the minimum range set is 5 ~ x1;

[0069] S32, obtaining all pixel coordinate values ​​of the vertical container part, and filtering out a vertical minimum range set of X coordinates in the vertical direction from all pixel coordinate values;

[0070] Similarly, if the pixel set in the vertical direction is Yn, if the pixel set is Y1((4,3), (5,3), …, (y1,3)), the pixel set is Y2((6,4), (7,4), …, (y2,4)), the pixel set is Yn((3,6), (4,6), …, (yn,6)), and y2<y1…<yn; then the vertical X-coordinate range is 4~y1, 6~y2, 3~yn; then the minimum range set is 6~y2;

[0071] If x1<y2, the intersection of the X axis is 6~x1; and the horizontal coordinate of the minimum intersection of the horizontal and vertical directions is the X axis coordinate value of 6~x1. Therefore, for the viewing angles in two directions, among all the pixel coordinate values ​​of each energy spectrum, only the corresponding pixel points whose X coordinate values ​​contain the part of 6~x1 are left. The energy spectrum grayscale values ​​corresponding to these pixel points are stored in the horizontal energy spectrum grayscale set and the vertical energy spectrum grayscale set respectively.

[0072] S33. Solve the intersection of the horizontal minimum range set and the vertical minimum range set to obtain the minimum intersection part that can see the container without being blocked in the horizontal and vertical directions, and store the energy spectrum grayscale value in the horizontal direction corresponding to the minimum intersection part in the horizontal energy spectrum grayscale set, and store the energy spectrum grayscale value in the vertical direction corresponding to the minimum intersection part in the vertical energy spectrum grayscale set.

[0073] If there is more liquid in the liquid container, it can be understood that the liquid container to be identified is relatively large, then the color of the energy spectrum grayscale image will be darker, if there is only a little liquid, then the corresponding liquid container is relatively small, and the color of the energy spectrum grayscale image will be lighter. The color of the energy spectrum grayscale image is represented by the energy spectrum grayscale value, which includes high-energy grayscale values ​​and low-energy grayscale values. The horizontal energy spectrum grayscale set includes the horizontal high-energy grayscale value set and the horizontal low-energy grayscale value set, and the vertical energy spectrum grayscale set includes the vertical high-energy grayscale value set and the vertical low-energy grayscale value set. The process of obtaining the predicted liquid type is:

[0074] S311, performing feature analysis on a horizontal high-energy grayscale value set and a horizontal low-energy grayscale value set, a vertical high-energy grayscale value set and a vertical low-energy grayscale value set to obtain a plurality of feature values;

[0075] Specifically, multiple points can be selected from the minimum intersection parts corresponding to the horizontal and vertical directions. For each point, there is a horizontal high-energy grayscale value, a horizontal low-energy grayscale value, a vertical high-energy grayscale value, and a vertical low-energy grayscale value. Therefore, N values ​​are selected from the horizontal high-energy grayscale value set, the horizontal low-energy grayscale value set, the vertical high-energy grayscale value set, and the vertical low-energy grayscale value set, respectively. The characteristic values ​​include the following 9 T1~T9:

[0076] 1) Calculate the grayscale value difference T1 in the horizontal and vertical directions; Iv represents the value selected from the horizontal high-energy grayscale value set, I h represents a value selected from a set of vertical high-energy grayscale values ​​in the vertical direction;

[0077] 2) Calculate the difference between the high energy spectrum grayscale image and the low energy spectrum grayscale image in the vertical direction I 垂直高 (i) represents the value selected from the vertical high-energy grayscale value set, I 垂直低 (i) represents a value selected from a set of vertical low-energy grayscale values;

[0078] 3) Calculate the difference between the high energy spectrum grayscale image and the low energy spectrum grayscale image in the horizontal direction I 水平高 (i) represents the value selected from the horizontal high-energy grayscale value set, I 水平低 (i) represents a value selected from a set of horizontal low-energy grayscale values;

[0079] 4) Select the maximum grayscale value in the horizontal direction from the N*2 values ​​selected from the horizontal high-energy grayscale value set and the horizontal low-energy grayscale value set:

[0080] T4=max(I 水平高 (1), I 水平低 (1),…,I 水平高 (N), I 水平低 (N));

[0081] 5) Select the minimum grayscale value in the horizontal direction from the N*2 values ​​selected from the horizontal high-energy grayscale value set and the horizontal low-energy grayscale value set:

[0082] T5=min(I 水平高 (1), I 水平低 (1),…,I 水平高 (N), I 水平低 (N));

[0083] 6) Select the maximum grayscale value in the vertical direction from the N*2 values ​​selected from the vertical high-energy grayscale value set and the vertical low-energy grayscale value set:

[0084] T6=max(I 垂直高 (1), I 垂直低 (1),…,I 垂直高 (N), I 垂直低 (N));

[0085] 7) Select the minimum grayscale value in the vertical direction from the N*2 values ​​selected from the vertical high-energy grayscale value set and the vertical low-energy grayscale value set:

[0086] T7=min(I 垂直高(1), I 垂直低 (1),…,I 垂直高 (N), I 垂直低 (N));

[0087] 8) Using the edge feature detection algorithm Canny, the average value T8 of the edge grayscale value of the vertical container part in the vertical direction and the average value T9 of the edge grayscale value of the horizontal container part in the horizontal direction are detected respectively.

[0088] The above-mentioned characteristic values ​​are selected as the characteristic variables of the decision tree because, for a liquid container filled with liquid, the liquid container part can be considered to be the liquid part. In the obtained energy spectrum diagram, the highest and lowest values ​​of the energy spectrum grayscale values ​​of each different type of liquid are different, and the difference between the high-energy energy spectrum value and the low-energy energy spectrum value of each liquid is also different, which can be used as distinguishing features. In addition, since the refractive index of X-rays for different types of liquids around the container filled with liquid is different, it can also be used as a feature.

[0089] S312, inputting a number of characteristic values ​​into an iterative prediction model and fitting them using a gradient boosting decision tree to obtain a predicted atomic number;

[0090] S313. According to the correspondence between the atomic number and the liquid type, the liquid type corresponding to the predicted atomic number is searched.

[0091] S4. Obtain the energy spectrum grayscale value corresponding to the minimum intersection part and input it into a pre-trained liquid recognition model to obtain the predicted liquid type. The liquid recognition model uses a gradient boosting decision tree to predict the liquid type.

[0092] The pre-trained liquid recognition model is fitted using a gradient boosting decision tree. The training process is as follows:

[0093] S41, collecting liquid containers filled with different types of liquids as training samples, and preprocessing the training samples. The preprocessing process is the process of steps S1-S3, so that 9 feature values ​​and their corresponding liquid types can be obtained for each training sample data;

[0094] S42. Iteratively train the training samples by using a gradient boosting decision tree, fit the characteristic values, and obtain the atomic number of each sample, thereby constructing an iterative prediction model, and obtaining a corresponding relationship table between the atomic number of each sample and the type of liquid to which the sample belongs.

[0095] Specifically, the iterative training method is:

[0096] S01, initializing the decision tree, taking all the eigenvalues ​​as nodes of the decision tree as the initial model to fit the training sample data, obtaining the fitted atomic number, and calculating the residual between the fitted atomic number and the true value;

[0097] S02, taking the residual as the new target value, reconstructing a new decision tree, and fitting the residual using the new decision tree to obtain this decision tree model;

[0098] S03, adding the current decision tree model to the previous iterative decision tree model to obtain the current iterative decision tree model;

[0099] S04, repeating the above steps S02-S03 until a preset number of iterations is reached, and obtaining an iterative prediction model;

[0100] S05, inputting the characteristic value of each sample into the iterative prediction model to obtain the predicted atomic number;

[0101] S06. Obtain a corresponding relationship table between the atomic number of each liquid and the liquid type according to the predicted atomic number and the liquid type corresponding to the sample.

[0102] In the gradient boosting decision tree method of this application, the above 9 eigenvalues ​​are used as feature variables, and the target variable obtained is the atomic number. The model trained in this way can predict the type of liquid, and the prediction process is as follows:

[0103] 1. Initialize the model: classify the atomic numbers of all liquid types that need to be classified, and collect the above 9 eigenvalues ​​of all liquid types. 100 samples can be prepared for each eigenvalue. Use a simple model (such as a tree with only one leaf node) as the initial model to fit the data.

[0104] 2. Iterative training: For each round of iteration, a new decision tree is trained. The decision tree contains 9 features and the model is used to fit the residual.

[0105] 3. Calculate residuals: Use the current model to predict the training data and calculate the residuals between the predicted values ​​and the true values. The residuals represent the errors in the model predictions.

[0106] 4. Train a new model: Use the residual as the new target value and train a new decision tree model with 9 features to reduce the residual. This new model is only fit to a small part of the residual, not the entire training data.

[0107] 5. Update model: Add the newly trained model to the previous model to form a more powerful ensemble model.

[0108] 6. Repeat iteration: Repeat the above steps until the pre-set number of iterations is reached or a certain stopping criterion is met.

[0109] 7. Ensemble model: The final model is the cumulative sum of all iteratively generated models, and the weight of each model is determined by its performance on the training data (usually the size of the residual).

[0110] 8. Prediction: Use the final integrated model and the 9 detected liquid features as parameters to make predictions and obtain the predicted atomic number.

[0111] 9. According to the relationship table of liquid types corresponding to atomic numbers, the liquid type is obtained.

[0112] Example 2

[0113] This embodiment provides an X-ray machine liquid identification system based on dual sources and dual viewing angles, and an X-ray machine liquid identification method based on dual sources and dual viewing angles according to application embodiment 1 includes:

[0114] An acquisition module, used to acquire a grayscale energy spectrum image of a horizontal viewing angle and a grayscale energy spectrum image of a vertical viewing angle generated by a dual-source dual-viewing angle X-ray irradiation package, wherein the grayscale energy spectrum image includes a high-energy grayscale energy spectrum image and a low-energy grayscale energy spectrum image;

[0115] The target detection module is used to perform target detection and segmentation on the energy spectrum grayscale images under two viewing angles to obtain the horizontal viewing angle wrapped area and the vertical viewing angle wrapped area;

[0116] The container recognition module is used to select the unobstructed horizontal container part in the horizontal perspective wrapping area, select the unobstructed vertical container part in the vertical perspective wrapping area, and solve the intersection of the horizontal container part and the vertical container part to obtain the minimum unobstructed intersection part of the container under the two perspectives;

[0117] The liquid recognition module is used to obtain the energy spectrum grayscale value corresponding to the minimum intersection part and input it into the pre-trained liquid recognition model to obtain the predicted liquid type. The liquid recognition model uses a gradient boosting decision tree to predict the liquid type.

[0118] Example 3

[0119] This embodiment provides a computer-readable storage medium, including:

[0120] one or more processors;

[0121] A storage unit is used to store one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors can implement Example 1, an X-ray machine liquid identification and verification method based on dual sources and dual viewing angles.

[0122] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. According to the technical essence of the present invention, within the spirit and principles of the present invention, any simple modification, equivalent replacement and improvement made to the above embodiment still falls within the protection scope of the technical solution of the present invention.

Claims

1. A liquid identification method based on dual-source dual-viewing angle X-ray machine, characterized in that: The dual viewing angles include a horizontal viewing angle and a vertical viewing angle that are perpendicular to each other, and specifically include the following steps: S1, obtaining a grayscale image of the energy spectrum at a horizontal viewing angle and a grayscale image of the energy spectrum at a vertical viewing angle generated by irradiating a package with dual-source and dual-viewing angle X-rays; S2, performing target detection and segmentation on the energy spectrum grayscale images under two viewing angles respectively, and obtaining a horizontal viewing angle wrapped area and a vertical viewing angle wrapped area; S3, selecting an unobstructed horizontal container portion in the horizontal perspective wrapping area, and selecting an unobstructed vertical container portion in the vertical perspective wrapping area, and solving the intersection of the horizontal container portion and the vertical container portion to obtain the minimum unobstructed intersection portion of the container under the two perspectives; S4. Obtain the energy spectrum grayscale value corresponding to the minimum intersection part and input it into a pre-trained liquid recognition model to obtain the predicted liquid type. The liquid recognition model uses a gradient boosting decision tree to predict the liquid type.

2. The X-ray machine liquid identification method based on dual-source and dual-viewing angles according to claim 1, characterized in that: In the energy spectrum grayscale image, a coordinate system is established with the upper left corner of the energy spectrum grayscale image as the coordinate origin, and the conveying direction along the conveyor belt is the X-axis. The specific process of step S3 is: S31, obtaining all pixel coordinate values ​​of the horizontal container part, and filtering out a horizontal minimum range set of X coordinates in the horizontal direction from all pixel coordinate values; S32, obtaining all pixel coordinate values ​​of the vertical container part, and filtering out a vertical minimum range set of X coordinates in the vertical direction from all pixel coordinate values; S33. Solve the intersection of the horizontal minimum range set and the vertical minimum range set to obtain the minimum intersection part that can see the container without being blocked in the horizontal and vertical directions, and store the energy spectrum grayscale value in the horizontal direction corresponding to the minimum intersection part in the horizontal energy spectrum grayscale set, and store the energy spectrum grayscale value in the vertical direction corresponding to the minimum intersection part in the vertical energy spectrum grayscale set.

3. The method for liquid identification based on dual-source and dual-viewing angle X-ray machine according to claim 2, characterized in that: The method to filter the minimum range set is: All pixel coordinate values ​​are screened and classified, and pixel coordinate values ​​with the same Y-axis coordinate are stored in a pixel set to obtain several pixel sets; Solve the X coordinate value range of each pixel set to obtain several X coordinate value ranges; Solve the intersection of several X coordinate value ranges to obtain the minimum range set.

4. The method for liquid identification based on dual-source and dual-viewing angle X-ray machine according to claim 2, characterized in that: The energy spectrum grayscale value includes high energy grayscale value and low energy grayscale value, the horizontal energy spectrum grayscale set includes horizontal high energy grayscale value set and horizontal low energy grayscale value set, the vertical energy spectrum grayscale set includes vertical high energy grayscale value set and vertical low energy grayscale value set, and the process of obtaining the predicted liquid type is: Performing feature analysis on a horizontal high-energy grayscale value set and a horizontal low-energy grayscale value set, a vertical high-energy grayscale value set and a vertical low-energy grayscale value set to obtain a number of feature values; Several eigenvalues ​​are input into the iterative prediction model and fitted using a gradient boosting decision tree to obtain the predicted atomic number; According to the correspondence between atomic number and liquid type, find the liquid type corresponding to the predicted atomic number.

5. The X-ray machine liquid identification method based on dual-source and dual-viewing angles according to claim 4, characterized in that: N values ​​are selected from the horizontal high-energy grayscale value set, the horizontal low-energy grayscale value set, the vertical high-energy grayscale value set, and the vertical low-energy grayscale value set, respectively. The characteristic values ​​include: 1) Calculate the grayscale value difference T1 in the horizontal and vertical directions; I v represents the value selected from the set of horizontal high-energy grayscale values, I h represents a value selected from a set of vertical high-energy grayscale values ​​in the vertical direction; 2) Calculate the difference between the high energy spectrum grayscale image and the low energy spectrum grayscale image in the vertical direction I 垂直高 (i) represents the value selected from the vertical high-energy grayscale value set, I 垂直低 (i) represents a value selected from a set of vertical low-energy grayscale values; 3) Calculate the difference between the high energy spectrum grayscale image and the low energy spectrum grayscale image in the horizontal direction I 水平高 (i) represents the value selected from the horizontal high-energy grayscale value set, I 水平低 (i) represents a value selected from a set of horizontal low-energy grayscale values; 4) Compare the maximum grayscale value and the minimum grayscale value in the horizontal direction and the maximum grayscale value and the minimum grayscale value in the vertical direction among the values ​​selected from the horizontal high-energy grayscale value set, the horizontal low-energy grayscale value set, the vertical high-energy grayscale value set and the vertical low-energy grayscale value set respectively.

6. The method for liquid identification and verification based on dual-source and dual-viewing angle X-ray machine according to claim 5, characterized in that: The feature value also includes using the edge feature detection algorithm Canny to detect the average value of the edge grayscale value of the vertical container part in the vertical direction and the average value of the edge grayscale value of the horizontal container part in the horizontal direction.

7. The X-ray machine liquid identification and verification method based on dual-source and dual-viewing angles according to claim 5, characterized in that: The training process is: Collecting liquid containers filled with different types of liquids as training samples, preprocessing the training samples, and obtaining the characteristic value and liquid type of each sample; The training samples are iteratively trained by using a gradient boosting decision tree, and the characteristic values ​​are fitted to obtain the atomic number of each sample, thereby constructing an iterative prediction model, and a corresponding relationship table between the atomic number of each sample and the type of liquid to which the sample belongs can be obtained.

8. The method for liquid identification and verification based on dual-source and dual-viewing angle X-ray machine according to claim 7, characterized in that: The iterative training method is: S01, initializing the decision tree, taking all the eigenvalues ​​as nodes of the decision tree as the initial model to fit the training sample data, obtaining the fitted atomic number, and calculating the residual between the fitted atomic number and the true value; S02, taking the residual as the new target value, reconstructing a new decision tree, and fitting the residual using the new decision tree to obtain this decision tree model; S03, adding the current decision tree model to the previous iterative decision tree model to obtain the current iterative decision tree model; S04, repeating the above steps S02-S03 until a preset number of iterations is reached, and obtaining an iterative prediction model; S05, inputting the characteristic value of each sample into the iterative prediction model to obtain the predicted atomic number; S06. Obtain a corresponding relationship table between the atomic number of each liquid and the liquid type according to the predicted atomic number and the liquid type corresponding to the sample.

9. An X-ray machine liquid identification system based on dual sources and dual viewing angles, using an X-ray machine liquid identification method based on dual sources and dual viewing angles as described in any one of claims 1 to 8, characterized in that: include: An acquisition module, used for acquiring an energy spectrum grayscale image of a horizontal viewing angle and an energy spectrum grayscale image of a vertical viewing angle generated by a dual-source dual-viewing angle X-ray irradiation package; The target detection module is used to perform target detection and segmentation on the energy spectrum grayscale images under two viewing angles to obtain the horizontal viewing angle wrapped area and the vertical viewing angle wrapped area; The container recognition module is used to select the unobstructed horizontal container part in the horizontal perspective wrapping area, select the unobstructed vertical container part in the vertical perspective wrapping area, and solve the intersection of the horizontal container part and the vertical container part to obtain the minimum unobstructed intersection part of the container under the two perspectives; The liquid recognition module is used to obtain the energy spectrum grayscale value corresponding to the minimum intersection part and input it into the pre-trained liquid recognition model to obtain the predicted liquid type. The liquid recognition model uses a gradient boosting decision tree to predict the liquid type.

10. A computer-readable storage medium, characterized in that: include: one or more processors; A storage unit for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement a dual-source dual-viewing X-ray machine liquid identification and verification method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Intelligent security inspection method for identifying liquid components

    CN113781426A

  • Multi-view target identification method and system based on Internet of Things

    CN113807349A

  • Multi-view image processing method, device and system and storage medium

    CN114648483A

  • Unmanned aerial vehicle cluster multi-view fusion aerial photography port monitoring method and system, and medium

    CN117409340A

Cited By

  • Liquid identification method and device, storage medium and electronic equipment

    CN119361006A