A method, system, and medium for liquid identification using a dual-source, dual-view X-ray machine.

By employing a dual-source, dual-view X-ray liquid identification method and utilizing a gradient boosting decision tree model, the unobstructed portion of the liquid container is identified, thus solving the problem of inaccurate identification caused by obstructed liquid containers and achieving accurate identification of liquid types.

CN118587434BActive Publication Date: 2026-11-17CHENGDU ZHIYUANHUI CULTURE & MEDIA CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing X-ray liquid identification technology cannot accurately identify liquid components, especially when the liquid container is obscured by other objects, leading to inaccurate identification.

Method used

A dual-source, dual-view X-ray liquid identification method is adopted. By acquiring the energy spectrum grayscale images from the horizontal and vertical perspectives, a gradient boosting decision tree model is used to identify the unobstructed liquid container portion, and the liquid type is predicted by the energy spectrum grayscale values ​​of the minimum intersection portion.

Benefits of technology

It effectively avoids the impact of obstructions on liquid type identification, improves the accuracy of liquid identification, and can correctly identify the type of liquid in the container.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587434B_ABST
    Figure CN118587434B_ABST
Patent Text Reader

Abstract

This invention discloses a method, system, and medium for liquid identification using a dual-source, dual-view X-ray machine. The dual views include a horizontal view and a vertical view, which are perpendicular to each other. The method acquires the energy spectrum grayscale images of the horizontal and vertical views generated by dual-source, dual-view X-ray irradiation of a package. Target detection and segmentation are performed on the energy spectrum grayscale images from both views to obtain the package region from the horizontal and vertical views. Unobstructed portions of the container are selected from both the horizontal and vertical view packages, and the intersection of these portions from the two views is calculated to obtain the minimum intersection of the unobstructed portions of the container from both views. The energy spectrum grayscale value corresponding to the minimum intersection is obtained and input into a pre-trained liquid identification model to predict the liquid type. Finding the minimum intersection of the unobstructed portions of the container within the package avoids the influence of obstructions on the identification process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of liquid security inspection technology, specifically to a liquid identification method, system, and medium based on dual-source, dual-view X-ray machine. Background Technology

[0002] Among existing security inspection technologies for liquid items, non-destructive testing methods based on X-ray transmission imaging technology have gained attention due to their high accuracy of inspection results and low sensitivity to container materials.

[0003] Current security inspection image recognition technology identifies objects by capturing their shape and color information from X-ray images. This technology can only identify solid items like knives and guns, not liquids. Because different liquids have similar atomic numbers, the color difference between X-ray images of similar liquids is small; for example, paint and glue are both green, and water, alcohol, and gasoline are both yellow. Therefore, it's impossible to distinguish different liquids based on color alone. Furthermore, liquids are generally light-colored, so the process typically involves identifying the container first, followed by liquid identification. However, liquid containers are usually placed inside packages, and objects within the package can easily obscure the liquid, making it difficult for the X-ray machine to accurately identify the liquid, resulting in inaccurate liquid identification. Summary of the Invention

[0004] The purpose of this invention is to provide a liquid identification method, system and medium based on dual-source dual-view X-ray machine. By using the energy spectrum grayscale image of dual-source dual-view, the minimum intersection of the unobstructed portion of the container in the package is found, that is, the unobstructed portion that can be seen from both views, thereby avoiding the influence of other obstructions on the identification of liquid type.

[0005] To achieve the above objectives, this application proposes the following solution:

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

[0007] S1. Obtain the energy spectrum grayscale image of the horizontal view and the energy spectrum grayscale image of the vertical view generated by dual-source dual-view X-ray irradiation of the package. The energy spectrum grayscale image includes a high-energy energy spectrum grayscale image and a low-energy energy spectrum grayscale image.

[0008] S2. Target detection and segmentation are performed on the energy spectrum grayscale images under the two perspectives to obtain the horizontal view area and the vertical view area.

[0009] S3. Select the unobstructed horizontal container portion in the horizontal view area and the unobstructed vertical container portion in the vertical view area. Solve for the intersection of the horizontal and vertical container portions to obtain the minimum intersection of the two views where the containers are not obstructed.

[0010] S4. Obtain the energy spectrum gray 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 gradient boosting decision tree to predict the liquid type.

[0011] In the existing technology, when liquid containers are placed in packages, the objects in the packages can easily obscure the liquid containers, making it difficult for X-ray machines to accurately identify the liquid containers in the packages, resulting in inaccurate identification of the liquid type.

[0012] Therefore, the concept behind this application to solve the above problem is as follows: by using the energy spectrum grayscale images from two perspectives, first find the minimum intersection of the portions where the container is not obscured in both perspectives; this yields a portion containing only the container, and liquid type identification is performed based on this portion, reducing the impact of obstructions on the identification results. Furthermore, this application uses a gradient boosting decision tree to fit the correspondence between the features of a liquid-filled container and the atomic number of the liquid, thus obtaining the corresponding liquid type. Since liquids are generally placed in containers and thus identified, only by correctly identifying the container can the type of liquid within it be further identified.

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

[0014] S31. Obtain all pixel coordinate values ​​of the horizontal container part, and filter out the minimum horizontal range set of the horizontal X coordinate from all pixel coordinate values;

[0015] S32. Obtain all pixel coordinate values ​​of the vertical container part, and filter out the minimum vertical range set of the vertical X coordinate from all pixel coordinate values.

[0016] S33. Solve for the intersection of the horizontal minimum range set and the vertical minimum range set to obtain the minimum intersection part where the container can be seen without being obscured in both the horizontal and vertical directions. At the same time, store the energy spectrum gray value of the horizontal direction corresponding to the minimum intersection part into the horizontal energy spectrum gray value set, and store the energy spectrum gray value of the vertical direction corresponding to the minimum intersection part into the vertical energy spectrum gray value set.

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

[0018] Filter and classify all pixel coordinate values, and store pixel coordinate values ​​with the same Y-axis coordinate into a pixel set to obtain several pixel sets;

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

[0020] Find the intersection of several ranges of X coordinate values ​​to obtain the smallest set of ranges.

[0021] In some specific implementations, the energy spectrum gray values ​​include high-energy gray values ​​and low-energy gray values; the horizontal energy spectrum gray set includes a horizontal high-energy gray value set and a horizontal low-energy gray value set; and the vertical energy spectrum gray set includes a vertical high-energy gray value set and a vertical low-energy gray value set. The process for obtaining the predicted liquid type is as follows:

[0022] Feature analysis was performed on 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 to obtain several feature values;

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

[0024] Based on 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 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 feature values ​​include:

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

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

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

[0029] 4) Compare the maximum and minimum gray values ​​in the horizontal direction and the maximum and minimum gray values ​​in the vertical direction among the values ​​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.

[0030] In some specific implementations, the feature values ​​also include the average gray value of the edge of the vertical container portion in the vertical direction and the average gray value of the edge of the horizontal container portion in the horizontal direction, respectively, using the Canny edge feature detection algorithm.

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

[0032] Collect containers filled with different types of liquid as training samples, preprocess the training samples, and obtain the feature value and liquid type of each sample.

[0033] The training samples are iteratively trained using a gradient boosting decision tree approach. The feature values ​​are fitted to obtain the atomic number of each sample, thereby constructing an iterative prediction model. This allows for the generation of a table showing the correspondence between the atomic number of each sample and the liquid type to which the sample belongs.

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

[0035] S01. Initialize the decision tree, use all feature values ​​as nodes of the decision tree as the initial model to fit the training sample data, obtain the atomic number of the fit, and calculate the residual between the atomic number of the fit and the true value.

[0036] S02. Using the residual as the new target value, reconstruct a new decision tree, and fit the residual using the new decision tree to obtain the current decision tree model.

[0037] S03. Add the current decision tree model to the previous iteration decision tree model to obtain the current iteration decision tree model;

[0038] S04. Repeat steps S02-S03 above until the preset number of iterations is reached to obtain the iterative prediction model;

[0039] S05. Input the feature value of each sample into the iterative prediction model to obtain the predicted atomic number;

[0040] S06. Based on the predicted atomic number and the corresponding liquid type of the sample, obtain a table showing the correspondence between the atomic number of each liquid and the liquid type.

[0041] Secondly, this application provides a liquid identification system based on a dual-source, dual-view X-ray machine, applying the liquid identification method based on a dual-source, dual-view X-ray machine of the first aspect, including:

[0042] The acquisition module is used to acquire the energy spectrum grayscale image of the horizontal view and the energy spectrum grayscale image of the vertical view generated by dual-source dual-view X-ray irradiation of the package. The energy spectrum grayscale image includes a high-energy energy spectrum grayscale image and a low-energy energy spectrum grayscale image.

[0043] The target detection module is used to perform target detection and segmentation on the energy spectrum grayscale images from two different perspectives to obtain the horizontal view area and the vertical view area.

[0044] The container recognition module is used to select the unobstructed horizontal container portion in the horizontal view area and the unobstructed vertical container portion in the vertical view area, and to solve the intersection of the horizontal and vertical container portions to obtain the minimum intersection of the unobstructed container portions in the two views.

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

[0046] Thirdly, this 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, which, when executed by one or more processors, enable the one or more processors to implement a liquid identification and verification method based on a dual-source, dual-view X-ray machine, as described in the first aspect.

[0049] The beneficial effects of this invention are as follows:

[0050] This application utilizes dual-source, dual-view energy spectrum grayscale images. Since the liquid needs to be contained in a liquid container, the identification of the liquid's location can be transformed into the identification of the liquid container. The minimum intersection of the unobstructed portion of the container in the package is found, that is, the unobstructed portion that can be seen from both views. The unobstructed liquid container portion is obtained, which is also the liquid portion, thus avoiding the influence of other obstructions on the identification of the liquid type. Attached Figure Description

[0051] Figure 1 This is a flowchart of a liquid identification method based on a dual-source, dual-view 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-view X-ray machine, provided in an embodiment of the present invention;

[0053] Figure 3 This is a schematic diagram illustrating the process of finding the minimum intersection in a dual-view energy spectrum, as provided in an embodiment of the present invention. Detailed Implementation

[0054] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the present invention or its application or use. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0055] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps described in these embodiments do not limit the scope of the invention.

[0056] At the same time, it should be understood that, for ease of description, the dimensions of the various parts shown in the accompanying drawings are not drawn according to actual scale.

[0057] Furthermore, for clarity and brevity, descriptions of well-known structures, functions, and configurations may have been omitted. Those skilled in the art will recognize that various changes and modifications can be made to the examples described herein without departing from the spirit and scope of this disclosure.

[0058] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.

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

[0060] Example

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

[0062] S1. Obtain the energy spectrum grayscale image of the horizontal view and the energy spectrum grayscale image of the vertical view generated by dual-source dual-view X-ray irradiation of the package. The energy spectrum grayscale image includes a high-energy energy spectrum grayscale image and a low-energy energy spectrum grayscale image.

[0063] S2. Target detection and segmentation are performed on the energy spectrum grayscale images from two different viewpoints to obtain the enclosed regions from the horizontal and vertical views. Target detection uses the YOLO target detection algorithm to locate the region containing the liquid container within the enclosed area. Since the liquid container's location may be obscured by other objects, such as… Figure 2 As shown, since liquids generally need to be contained in liquid containers, if the liquid container is full of liquid, then the identification of the liquid can be transformed into the identification of the liquid container. Specifically, it is necessary to find the unobstructed part of the container;

[0064] S3. Select the unobstructed horizontal container portion in the horizontal view area and the unobstructed vertical container portion in the vertical view area. Solve for the intersection of the horizontal and vertical container portions to obtain the minimum intersection of the unobstructed containers under the two views.

[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 origin, and the conveyor belt direction is taken as the X-axis. The specific process of step S3 is as follows:

[0066] S31. Obtain all pixel coordinate values ​​of the horizontal container part, and filter out the minimum horizontal range set of the horizontal X coordinate from all pixel coordinate values;

[0067] The filtering process is as follows: filter and classify all pixel coordinate values, store pixel coordinate values ​​with the same Y-axis coordinate into a pixel set, denoted as Xn, to obtain several pixel sets X1, X2...Xn; solve for the range of X coordinate values ​​of each pixel set to obtain several ranges of X coordinate values; solve for the intersection of several ranges of X coordinate values ​​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)), and the pixel set Xn((1,6), (2,6), ..., (xn,6)), and x1 < x2 ... < xn; then the range of the X coordinate is 2 ~ x1, 5 ~ x2, 1 ~ xn; and the smallest range set is 5 ~ x1.

[0069] S32. Obtain all pixel coordinate values ​​of the vertical container part, and filter out the minimum vertical range set of the vertical X coordinate from all pixel coordinate values.

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

[0071] If x1 < y2, then the intersection of the X-axis is 6 to x1; and the x-coordinate of the minimum intersection of the horizontal and vertical directions is the X-axis coordinate value of 6 to x1. Therefore, for the perspectives of the two directions, among all the pixel coordinate values ​​of each energy spectrum, only the corresponding pixels whose X-coordinate values ​​contain the part of 6 to x1 remain. The energy spectrum gray values ​​corresponding to these pixels are stored in the horizontal energy spectrum gray set and the vertical energy spectrum gray set, respectively.

[0072] S33. Solve for the intersection of the horizontal minimum range set and the vertical minimum range set to obtain the minimum intersection part where the container can be seen without being obscured in both the horizontal and vertical directions. At the same time, store the energy spectrum gray value of the horizontal direction corresponding to the minimum intersection part into the horizontal energy spectrum gray value set, and store the energy spectrum gray value of the vertical direction corresponding to the minimum intersection part into the vertical energy spectrum gray value set.

[0073] If the liquid container contains a lot of liquid, it can be understood as a relatively large liquid container to be identified. In this case, the color of the energy spectrum grayscale image will be darker. If it contains only a small amount of liquid, 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 energy spectrum grayscale values, which include high-energy grayscale values ​​and low-energy grayscale values. The horizontal energy spectrum grayscale set includes a horizontal set of high-energy grayscale values ​​and a horizontal set of low-energy grayscale values. The vertical energy spectrum grayscale set includes a vertical set of high-energy grayscale values ​​and a vertical set of low-energy grayscale values. The process of obtaining the predicted liquid type is as follows:

[0074] S311. Perform feature analysis on 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 to obtain several feature values.

[0075] Specifically, multiple points can be selected from the minimum intersection of the horizontal and vertical directions. For each point, there are horizontal high-energy gray values, horizontal low-energy gray values, vertical high-energy gray values, and vertical low-energy gray values. Therefore, N values ​​are selected from the sets of horizontal high-energy gray values, horizontal low-energy gray values, vertical high-energy gray values, and vertical low-energy gray values, respectively. The feature values ​​include the following nine values ​​T1 to T9:

[0076] 1) Calculate the difference T1 between the gray values ​​in the horizontal and vertical directions; I v I represents the value selected from the set of high-energy grayscale values. h This indicates the value selected from the set of high-energy grayscale values ​​in the vertical direction;

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

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

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

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

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

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

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

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

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

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

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

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

[0089] S312. Input several feature values ​​into the iterative prediction model and fit them using a gradient boosting decision tree to obtain the predicted atomic number.

[0090] S313. Based on the correspondence between atomic number and liquid type, find the liquid type corresponding to the predicted atomic number.

[0091] S4. Obtain the energy spectrum gray 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 gradient boosting decision tree to predict the liquid type.

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

[0093] S41. Collect liquid containers filled with different types of liquid as training samples. Preprocess the training samples. The preprocessing process is the process of steps S1-S3. In this way, 9 feature values ​​and their corresponding liquid types can be obtained for each training sample data.

[0094] S42. The training samples are iteratively trained using a gradient boosting decision tree method, and the feature values ​​are fitted to obtain the atomic number of each sample, thereby constructing an iterative prediction model. A table showing the correspondence between the atomic number of each sample and the liquid type to which the sample belongs can be obtained.

[0095] Specifically, the iterative training method is as follows:

[0096] S01. Initialize the decision tree, use all feature values ​​as nodes of the decision tree as the initial model to fit the training sample data, obtain the atomic number of the fit, and calculate the residual between the atomic number of the fit and the true value.

[0097] S02. Using the residual as the new target value, reconstruct a new decision tree, and fit the residual using the new decision tree to obtain the current decision tree model.

[0098] S03. Add the current decision tree model to the previous iteration decision tree model to obtain the current iteration decision tree model;

[0099] S04. Repeat steps S02-S03 above until the preset number of iterations is reached to obtain the iterative prediction model;

[0100] S05. Input the feature value of each sample into the iterative prediction model to obtain the predicted atomic number;

[0101] S06. Based on the predicted atomic number and the corresponding liquid type of the sample, obtain a table showing the correspondence between the atomic number of each liquid and the liquid type.

[0102] In this application, the gradient boosting decision tree method uses the above nine feature values ​​as feature variables, and the target variable is the atomic number. The model trained in this way can predict the type of liquid. 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 feature values ​​for all liquid types. Prepare 100 samples for each feature value. 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 iteration, a new decision tree is trained. The decision tree contains 9 features, and the model fits the residuals.

[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's predictions.

[0106] 4. Train a new model: Using the residuals as the new target value, train a new decision tree model. The decision tree contains 9 features to reduce the residuals. This new model only fits a small portion of the residuals, rather than the entire training data.

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

[0108] 6. Repeat the above steps until the preset number of iterations is reached or a certain stopping criterion is met.

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

[0110] 8. Prediction: Using the final ensemble model, the nine detected liquid features are used as parameters to make predictions and obtain the predicted atomic numbers.

[0111] 9. Based on the table showing the relationship between atomic numbers and liquid types, determine the liquid type.

[0112] Example 2

[0113] This embodiment provides a liquid identification system based on a dual-source, dual-view X-ray machine, applying the liquid identification method based on a dual-source, dual-view X-ray machine in Embodiment 1, including:

[0114] The acquisition module is used to acquire the energy spectrum grayscale image of the horizontal view and the energy spectrum grayscale image of the vertical view generated by dual-source dual-view X-ray irradiation of the package. The energy spectrum grayscale image includes a high-energy energy spectrum grayscale image and a low-energy energy spectrum grayscale image.

[0115] The target detection module is used to perform target detection and segmentation on the energy spectrum grayscale images from two different perspectives to obtain the horizontal view area and the vertical view area.

[0116] The container recognition module is used to select the unobstructed horizontal container portion in the horizontal view area and the unobstructed vertical container portion in the vertical view area, and to solve the intersection of the horizontal and vertical container portions to obtain the minimum intersection of the unobstructed container portions in the two views.

[0117] The liquid identification module is used to obtain the energy spectrum gray value corresponding to the minimum intersection part and input it into the pre-trained liquid identification model to obtain the predicted liquid type. The liquid identification model uses a gradient boosting decision tree method 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, which, when executed by one or more processors, enable the one or more processors to implement the liquid identification and verification method based on dual-source dual-view X-ray machine according to Embodiment 1.

[0122] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Based on the technical essence of the present invention, any simple modifications, equivalent substitutions, and improvements made to the above embodiments within the spirit and principles of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A dual-source dual-view based X-ray machine liquid identification method, characterized in that, Dual perspectives include a horizontal perspective and a vertical perspective that are perpendicular to each other, and specifically include the following steps: S1. Obtain the energy spectrum grayscale image of the horizontal view and the energy spectrum grayscale image of the vertical view generated by dual-source dual-view X-ray irradiation of the package. S2. Target detection and segmentation are performed on the energy spectrum grayscale images under the two perspectives to obtain the horizontal view area and the vertical view area. S3. Select the unobstructed horizontal container portion within the horizontal view area and the unobstructed vertical container portion within the vertical view area. Solve for the intersection of the horizontal and vertical container portions to obtain the minimum intersection of the unobstructed containers under the two views. Store the energy spectrum gray value in the horizontal direction corresponding to the minimum intersection into the horizontal energy spectrum gray value set, and store the energy spectrum gray value in the vertical direction corresponding to the minimum intersection into the vertical energy spectrum gray value set. S4. Obtain the energy spectrum gray 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 gradient boosting decision tree to predict the liquid type. The energy spectrum gray values ​​include high-energy gray values ​​and low-energy gray values. The horizontal energy spectrum gray value set includes a horizontal high-energy gray value set and a horizontal low-energy gray value set. The vertical energy spectrum gray value set includes a vertical high-energy gray value set and a vertical low-energy gray value set. The process of obtaining the predicted liquid type is as follows: Feature analysis was performed on 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 to obtain several feature values; 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 feature values ​​include: 1) Calculate the difference T1 between the gray values ​​in the horizontal and vertical directions; , This indicates the value selected from the set of high-energy grayscale values. This indicates the value selected from the set of high-energy grayscale values ​​in the vertical direction; 2) Calculate the difference between the high-energy and low-energy grayscale images in the vertical direction. , This indicates the value selected from the set of vertical high-energy grayscale values. This indicates the value selected from the set of vertical low-energy grayscale values; 3) Calculate the difference between the high-energy and low-energy grayscale images in the horizontal direction. , This indicates the value selected from the set of high-energy grayscale values. This indicates the value selected from the set of low-energy grayscale values. 4) Compare the maximum and minimum gray values ​​in the horizontal direction and the maximum and minimum gray values ​​in the vertical direction among the values ​​selected from the set of horizontal high-energy gray values, the set of horizontal low-energy gray values, the set of vertical high-energy gray values, and the set of vertical low-energy gray values, respectively. Several feature values ​​are input into an iterative prediction model and fitted using a gradient boosting decision tree to obtain the predicted atomic number. Based on the correspondence between atomic number and liquid type, find the liquid type corresponding to the predicted atomic number.

2. The liquid identification method based on dual-source, dual-view X-ray machine 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 origin, and the conveyor belt direction is taken as the X-axis. The specific process of step S3 is as follows: S31. Obtain all pixel coordinate values ​​of the horizontal container part, and filter out the minimum horizontal range set of the horizontal X coordinate from all pixel coordinate values; S32. Obtain all pixel coordinate values ​​of the vertical container part, and filter out the minimum vertical range set of the vertical X coordinate from all pixel coordinate values. S33. Solve for the intersection of the horizontal minimum range set and the vertical minimum range set to obtain the minimum intersection part where the container can be seen without being obscured in both the horizontal and vertical directions. At the same time, store the energy spectrum gray value of the horizontal direction corresponding to the minimum intersection part into the horizontal energy spectrum gray value set, and store the energy spectrum gray value of the vertical direction corresponding to the minimum intersection part into the vertical energy spectrum gray value set.

3. The liquid identification method based on dual-source, dual-view X-ray machine according to claim 2, characterized in that, The method for filtering the smallest range set is as follows: Filter and classify all pixel coordinate values, and store pixel coordinate values ​​with the same Y-axis coordinate into a pixel set to obtain several pixel sets; Solve for the range of X coordinate values ​​for each pixel set to obtain several ranges of X coordinate values; Find the intersection of several ranges of X coordinate values ​​to obtain the smallest set of ranges.

4. The liquid identification method based on dual-source, dual-view X-ray machine according to claim 1, characterized in that, The feature values ​​also include the average gray value of the edge of the vertical container portion in the vertical direction and the average gray value of the edge of the horizontal container portion in the horizontal direction, using the Canny edge feature detection algorithm.

5. The liquid identification method based on dual-source, dual-view X-ray machine according to claim 1, characterized in that, The training process is as follows: Collect containers filled with different types of liquid as training samples, preprocess the training samples, and obtain the feature value and liquid type of each sample. The training samples are iteratively trained using a gradient boosting decision tree approach. The feature values ​​are fitted to obtain the atomic number of each sample, thereby constructing an iterative prediction model and obtaining a table showing the correspondence between the atomic number of each sample and the liquid type to which the sample belongs.

6. The liquid identification method based on dual-source, dual-view X-ray machine according to claim 5, characterized in that, The iterative training method is as follows: S01. Initialize the decision tree, use all feature values ​​as nodes of the decision tree as the initial model to fit the training sample data, obtain the atomic number of the fit, and calculate the residual between the atomic number of the fit and the true value. S02. Using the residual as the new target value, reconstruct a new decision tree, and fit the residual using the new decision tree to obtain the current decision tree model. S03. Add the current decision tree model to the previous iteration decision tree model to obtain the current iteration decision tree model; S04. Repeat steps S02-S03 above until the preset number of iterations is reached to obtain the iterative prediction model; S05. Input the feature value of each sample into the iterative prediction model to obtain the predicted atomic number; S06. Based on the predicted atomic number and the corresponding liquid type of the sample, obtain a table showing the correspondence between the atomic number of each liquid and the liquid type.

7. A dual-source, dual-view X-ray machine liquid identification system, employing the dual-source, dual-view X-ray machine liquid identification method as described in any one of claims 1-6, characterized in that, include: The acquisition module is used to acquire the energy spectrum grayscale images of the horizontal and vertical views generated by dual-source dual-view X-ray irradiation of the package. The target detection module is used to perform target detection and segmentation on the energy spectrum grayscale images from two different perspectives to obtain the horizontal view area and the vertical view area. The container recognition module is used to select the unobstructed horizontal container portion in the horizontal view area and the unobstructed vertical container portion in the vertical view area, and to solve the intersection of the horizontal and vertical container portions to obtain the minimum intersection of the unobstructed container portions in the two views. The liquid identification module is used to obtain the energy spectrum gray value corresponding to the minimum intersection part and input it into the pre-trained liquid identification model to obtain the predicted liquid type. The liquid identification model uses a gradient boosting decision tree method to predict the liquid type.

8. A computer-readable storage medium, characterized in that, include: One or more processors; A storage unit is used to store one or more programs, which, when executed by one or more processors, enable the one or more processors to implement a dual-source, dual-view X-ray machine liquid identification method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Intelligent security inspection method for identifying liquid components

    CN113781426A

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

    CN114648483A