Liquid recognition method and device based on dual-energy X-ray image, equipment and storage medium
By setting up multi-scale blocks in the liquid region, extracting R-values and edge-sensitive features, and combining block-based independent prediction with multi-result fusion decision-making, the problem of insufficient accuracy and robustness in liquid recognition in existing technologies is solved, achieving high-precision recognition and rapid response for liquids such as gasoline and alcohol.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUNAN SUKE INTELLIGENT TECH CO LTD
- Filing Date
- 2026-05-22
- Publication Date
- 2026-06-19
AI Technical Summary
Existing dual-energy X-ray liquid identification methods rely on equivalent atomic numbers for classification. Due to the inherent discrimination capability of atomic numbers, they cannot accurately distinguish between multiple types of liquids such as gasoline, alcohol, water, pesticides, and sulfuric acid in real-world security inspection scenarios with complex background interference, uneven liquid thickness, and X-ray scattering. Furthermore, they suffer from problems such as high computational cost, poor model generalization, and insufficient robustness.
Based on dual-energy X-ray images, multi-scale blocks are set along the main direction axis of the liquid region to cover the liquid region and adjacent background regions. R-value features and edge-sensitive region features are extracted. A classification architecture of block-based independent prediction and multi-result fusion decision is adopted. Standardized samples are constructed through multi-scale blocks to explicitly compensate for changes in liquid thickness and X-ray scattering interference. Combined with edge-sensitive region feature enhancement, full coverage of the liquid region and feature fusion are achieved.
It significantly improves the multi-category recognition accuracy of liquids with similar atomic numbers, such as gasoline and alcohol, reduces the impact of local occlusion and scattering interference on the recognition results, adapts to liquid containers of different capacities and shapes, meets the real-time requirements of security inspection scenarios, reduces the amount of computation, and is suitable for ordinary single-view X-ray security inspection equipment.
Smart Images

Figure CN122244808A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of X-ray security inspection technology, specifically a liquid identification method, device, equipment, and storage medium based on dual-energy X-ray images. Background Technology
[0002] X-ray security inspection equipment is widely used in security checks at airports, train stations, customs, and other locations to detect dangerous items in luggage and parcels. Identification of liquid hazardous materials, such as gasoline, pesticides, and strong acids, is a crucial function of these systems. Existing security inspection systems typically employ dual-energy X-ray imaging technology, simultaneously acquiring high-energy and low-energy X-ray images to analyze the materials of objects.
[0003] In dual-energy X-ray imaging systems, the equivalent atomic number of a substance can be calculated using a material lookup table obtained from system calibration by analyzing the relationship between high-energy and low-energy signals, and an equivalent atomic number map can be generated, thus enabling the differentiation of different materials. However, in practical applications, relying solely on equivalent atomic numbers for liquid identification still presents the following problems: some liquids have similar atomic numbers; different X-ray penetration paths cause variations in high and low energy attenuation and atomic number fluctuations; and real-world scenarios include X-ray scattering, light source attenuation, complex background interference, and differences at different detection positions.
[0004] Therefore, a new technical solution for liquid identification based on dual-energy X-ray imaging is needed. Summary of the Invention
[0005] The purpose of this application is to provide a liquid identification method, apparatus, device, and storage medium based on dual-energy X-ray images to solve the following technical problems in the prior art: Existing dual-energy X-ray liquid identification methods mainly rely on equivalent atomic numbers for classification. Due to the inherent discrimination limitation of atomic numbers, they cannot accurately distinguish multiple types of liquids such as gasoline, alcohol, water, pesticides, and sulfuric acid in actual security inspection scenarios such as complex background interference, uneven liquid thickness, and X-ray scattering. At the same time, some solutions have problems such as reliance on dedicated dual-view hardware / trays, large computational load, poor model generalization, and insufficient robustness, which makes it difficult to improve security inspection efficiency and accuracy.
[0006] To achieve the above objectives, this application provides a liquid identification method based on dual-energy X-ray imaging for identifying liquids inside security inspection parcel containers, including: The region of interest is determined based on the boundary of the container within the package; within the region of interest, the main direction axis of the liquid region is obtained; multiple multi-scale blocks aligned with the main direction are set along the main direction axis, each block simultaneously covering the target liquid region and the adjacent background reference region of the target liquid region; The target liquid region is sampled in blocks, and a feature extraction operation including at least the extraction of R-value features is performed in each block; wherein, the R-value features are constructed based on high and low energy attenuation data, which are obtained by solving the block-based dual-energy X-ray images, and the dual-energy X-ray images include a high-energy image reflecting the attenuation information after high-energy X-rays interact with matter and a low-energy image reflecting the attenuation information after low-energy X-rays penetrate the object; The edge-sensitive regions in the liquid region with drastic thickness changes and significant scattering interference are located. Feature extraction operations are performed independently on the edge-sensitive regions to obtain boundary supplementary features. The boundary supplementary features are then fused with the R-value features corresponding to each block to obtain the fused features of each block. The fusion features of each segment are input into a preset classification model to obtain independent local classification results. A fusion decision is made on all independent local classification results to determine the final liquid category.
[0007] Preferably, the method of setting multiple multi-scale blocks aligned with the main direction axis is specifically to set multiple blocks symmetrically distributed along the main direction axis, and to set at least two different scale blocks.
[0008] Preferably, the R-value features include a first R-value feature, a second R-value feature, and a third R-value feature; wherein: The first R-value feature is based on the ratio of the liquid high-energy mean to the background high-energy mean, and the ratio of the liquid low-energy mean to the background low-energy mean, and is obtained by normalization. The second R-value feature is obtained by normalizing the mean difference between the low-energy and high-energy liquids. The third R-value feature is obtained by normalizing the differences between the background low-energy mean and the liquid low-energy mean, the differences between the background high-energy mean and the liquid high-energy mean, the ratio of the liquid low-energy mean to the liquid high-energy mean, and the ratio of the background low-energy mean to the background high-energy mean.
[0009] Preferably, the location of the edge-sensitive region is specifically as follows: a fused grayscale image is generated based on the dual-energy X-ray image, and a threshold segmentation method is used to extract sub-regions from the liquid region whose high and low energy attenuation is less than a preset high and low energy attenuation threshold as edge-sensitive regions.
[0010] Preferably, the fusion decision for all independent local classification results is specifically as follows: a majority voting mechanism is used to determine the final liquid category; if the number of votes is the same, the classification probability scores of each block are combined, and the category with the highest total score is taken as the final identification result.
[0011] Preferably, the shape of the multi-scale blocks is a slanted rectangle, including large-scale slanted rectangle blocks, medium-scale slanted rectangle blocks, and small-scale slanted rectangle blocks.
[0012] Preferably, the feature extraction operation further includes: for each block, extracting basic features for characterizing statistical conditions, gradient features for characterizing gradient conditions, and combined features for characterizing the combination of the target liquid region and the adjacent background reference region of the target liquid region.
[0013] To achieve the above objectives, this application also provides a liquid identification device based on dual-energy X-ray imaging, which applies the liquid identification method based on dual-energy X-ray imaging as described above, including: The block construction module is configured to: determine the region of interest based on the boundary of the container within the package; obtain the main direction axis of the liquid region within the region of interest; set multiple multi-scale blocks aligned with the main direction along the main direction axis, with each block simultaneously covering the target liquid region and the adjacent background reference region of the target liquid region; The feature extraction module is configured to: sample the target liquid region in blocks, and perform feature extraction operations, including at least the extraction of R-value features, within each block; wherein the R-value features are constructed based on high and low energy attenuation data, which are obtained by solving the block-based dual-energy X-ray images, and the dual-energy X-ray images include a high-energy image reflecting the attenuation information after high-energy X-rays interact with matter and a low-energy image reflecting the attenuation information after low-energy X-rays penetrate an object; The edge fusion module is configured to: locate edge-sensitive regions in the liquid region with drastic thickness changes and significant scattering interference; independently perform feature extraction operations on the edge-sensitive regions to obtain boundary supplementary features; and fuse the boundary supplementary features with the R-value features corresponding to each block to obtain the fused features of each block. The fusion decision module is configured to: input the fusion features of each block into a preset classification model to obtain independent local classification results, perform fusion decision on all independent local classification results, and determine the final liquid category.
[0014] To achieve the above objectives, this application also provides a liquid identification device based on dual-energy X-ray imaging, including at least one processor, at least one memory, and a data bus; The processor and the memory communicate with each other via the data bus; The memory stores program instructions that can be executed by the processor, which invokes the program instructions to execute the liquid identification method based on dual-energy X-ray images as described above.
[0015] To achieve the above objectives, this application also provides a storage medium storing a computer program thereon, which, when executed by a processor, implements the liquid identification method based on dual-energy X-ray images as described above.
[0016] The liquid identification method, apparatus, device, and storage medium based on dual-energy X-ray imaging of this application have the following beneficial effects: By setting up multi-scale blocks that simultaneously cover the liquid and adjacent background along the main directional axis of the liquid region, standardized paired samples of liquid and background are constructed from the sampling source, which completely solves the problems of strong subjectivity and poor adaptability of existing sampling methods. It can be adapted to liquid containers of different capacities and shapes, and achieve full-range feature coverage of the liquid region.
[0017] By constructing physical invariance features based on high and low energy decay data within the blocks, explicit compensation for liquid thickness variations and X-ray scattering interference is achieved. This breaks through the discrimination bottleneck of existing technologies based on a single equivalent atomic number, and significantly improves the multi-category recognition accuracy of liquids with similar atomic numbers, such as gasoline and alcohol.
[0018] By locating edge-sensitive areas and extracting supplementary features for fusion, the feature blind spots of the main block sampling are compensated, the feature expression of the most severely interfered areas is strengthened in a targeted manner, and the recognition robustness in complex scenarios is further improved.
[0019] The classification architecture, which adopts block-based independent prediction and multi-result fusion decision-making, significantly reduces the impact of local occlusion, local thickness anomalies, or local scattering interference on the final result, and significantly improves the system's fault tolerance. At the same time, it only processes within the region of interest, with low computational load, which can meet the real-time requirements of security inspection scenarios.
[0020] The overall solution is implemented entirely in software, without relying on dual-view hardware, dedicated liquid trays or other specialized equipment. It can be directly adapted to ordinary single-view X-ray security inspection equipment, with low deployment costs and strong versatility. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 A flowchart illustrating the liquid identification method based on dual-energy X-ray images provided in this application embodiment; Figure 2 The diagram shows the structure of a liquid identification device based on dual-energy X-ray images provided in this application embodiment; in the diagram: 10, block construction module; 20, feature extraction module; 30, edge fusion module; 40, fusion decision module.
[0023] The implementation, functional features, and advantages of this invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0024] The technical solutions in the embodiments of this application will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0025] In this document, the term "comprising" is intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0026] To address the problems of existing liquid identification methods that mainly rely on atomic numbers for classification, are limited by the inherent distinguishability of atomic numbers, and have low classification accuracy under complex backgrounds, thickness variations, and X-ray scattering interference, this embodiment discloses a liquid identification method, apparatus, device, and storage medium based on dual-energy X-ray images. In summary, the core technical content of this embodiment is to provide a liquid identification method based on centerline oblique rectangular blocks and physical invariance features.
[0027] The following explains some concepts involved in this embodiment.
[0028] Dual-energy X-ray images include high-energy images and low-energy images. High-energy images represent images with a higher average X-ray absorption spectrum, which can be obtained directly from or derived from multispectral raw data, and are used to reflect the attenuation information of high-energy X-rays after interacting with matter. Low-energy images represent absorption attenuation images of lower average energy X-rays, acquired by multi-energy X-ray security inspection equipment through a low-energy channel, and are used to reflect the attenuation information of low-energy X-rays after penetrating an object.
[0029] Equivalent atomic number map, a material characteristic image obtained by looking up a table based on the decay data of the high-energy and low-energy maps.
[0030] The liquid identification method based on dual-energy X-ray imaging in this embodiment will now be described.
[0031] Reference Figure 1 , Figure 1 A flowchart illustrating the liquid identification method based on dual-energy X-ray images provided in this application embodiment.
[0032] like Figure 1As shown, this embodiment discloses a liquid identification method based on dual-energy X-ray imaging for identifying liquids inside security inspection parcel containers, including: S10: Determine the region of interest based on the boundary of the container within the package; within the region of interest, obtain the main direction axis of the liquid region; set multiple multi-scale blocks aligned with the main direction along the main direction axis, with each block simultaneously covering the target liquid region and the adjacent background reference region of the target liquid region.
[0033] For determining the region of interest based on the container's boundary within the package: This embodiment acquires high-energy grayscale images, low-energy grayscale images, and corresponding pseudo-color images generated by X-ray security inspection equipment scanning packages.
[0034] The pseudo-color image is processed using an existing pre-trained deep learning model to detect and output the boundary coordinates of the container in the image, the complete mask of the container, and the mask of the liquid region inside the container.
[0035] To improve processing efficiency, the coordinates of the container boundary are used as a basis to expand outwards. The region of interest is obtained from 1 pixel, and the corresponding high-energy grayscale image, low-energy grayscale image, container mask, and liquid mask are extracted from this region of interest; where the number of pixels is 1. It adapts to the resolution; for example, it can be 10 to 25 pixels.
[0036] Median filtering is applied to the high-energy grayscale image and low-energy grayscale image within the region of interest to remove salt-and-pepper noise.
[0037] To obtain the main directional axis of the liquid region within the region of interest, this embodiment uses the center line of the liquid principal axis extracted based on the container mask as the main directional axis of the liquid region.
[0038] Specifically, multiple multi-scale blocks aligned with the main direction are set along the main direction axis. Specifically, multiple blocks are symmetrically distributed along the main direction axis, and at least two different scale blocks are set.
[0039] As a preferred embodiment of this invention, the shape of the multi-scale blocks is a slanted rectangle, including large-scale slanted rectangle blocks, medium-scale slanted rectangle blocks, and small-scale slanted rectangle blocks.
[0040] In this specific application, using the center line as the axis of symmetry and combining it with a liquid mask, three different scales of oblique rectangular templates are preset to sample the liquid region in blocks, constructing three sets of oblique rectangular blocks. Each set contains two columns of blocks, aligned along the center line. Each column contains several adjacent oblique rectangular blocks; for example, large-scale oblique rectangular blocks have two, medium-scale oblique rectangular blocks have three, and small-scale oblique rectangular blocks have four. Each oblique rectangular block simultaneously covers part of the liquid region and the adjacent background region. It should be noted that the large, medium, and small scales in this embodiment are adaptively adjusted according to the resolution.
[0041] It should be noted that the block-segmentation strategy adopted in this embodiment aims to construct standardized liquid-background paired samples from the sampling source, providing a natural and unified data foundation for subsequent calculation of physically invariant features. Simultaneously, the multi-scale design accommodates the full-area feature coverage requirements of liquid containers of different capacities and shapes, enriching the multi-scale expression of features. The block shape can be a slanted rectangle, and the number of scales can be up to three, or even a slider strategy can be used instead of the block-segmentation strategy. In practical applications of this embodiment, the block shape can also be adjusted to any geometric shape aligned with the main axis of the liquid, such as a parallelogram or trapezoid, depending on the actual scenario. The number of scales can also be flexibly set to two, four, or more based on the resolution and recognition accuracy requirements of the security inspection equipment. This sampling design, with main-direction alignment, synchronous liquid and background coverage, and multi-scale adaptive sampling, overcomes the technical biases of existing technologies that rely on manually defined fixed areas, discrete point sampling, or global image fusion. It fundamentally solves the common industry problems of existing sampling methods, such as strong subjectivity, poor adaptability, and the inability to provide effective samples for explicit physical compensation of thickness and scattering. However, it is worth noting that using a slider strategy instead of a block strategy will generate a large number of overlapping sampling areas, causing the features of the same pixels to be repeatedly extracted and calculated, significantly increasing the overall computational load and memory usage. This embodiment, on the other hand, uses non-overlapping multi-scale blocks symmetrically distributed along the main axis, which reduces overlapping areas and redundant calculations compared to a sliding window, fundamentally avoiding redundant computation. While ensuring the integrity of feature coverage and recognition accuracy across the entire liquid region, it can reduce the computational load in the feature extraction stage, fully meeting the real-time requirements of security inspection equipment.
[0042] Regarding S10, in summary, this embodiment determines the region of interest based on the container boundary, obtains the main directional axis of the liquid region, and sets up multi-scale blocks along the axis, with each block simultaneously covering the liquid region and the adjacent background reference region, ultimately providing a basis for block sampling. Combining the symmetrical distribution of blocks along the main directional axis and the inclusion of at least two different scales, and the blocks being oblique rectangles (specifically large, medium, and small scales), its core function is to thoroughly solve the common problems of unreasonable sampling methods in existing technologies and the inability to obtain natural paired samples of liquid and background. This step specifically addresses four types of deficiencies in existing technologies: First, existing methods based on region difference heavily rely on manually defined container interior / exterior regions, exhibiting strong subjectivity and poor adaptability; second, existing methods based on cross-shaped region fusion employ fixed-shape global image fusion, lacking a mechanism for simultaneous sampling of liquid and background; third, existing methods based on base material decomposition rely on dedicated liquid tray hardware, failing to achieve accurate sampling on ordinary single-view security inspection equipment; and fourth, existing methods based on point sampling only perform discrete point sampling, failing to fully cover the overall features of the liquid region.
[0043] The aforementioned multi-scale oblique rectangular block sampling design not only fundamentally solves the inherent defects of existing sampling methods, but also provides an indispensable prerequisite for subsequent explicit compensation for liquid thickness variations and X-ray scattering interference. That is, the paired data of the liquid region and the background reference region naturally contained in each block is the core foundation for constructing physical invariance characteristics with material-essential differentiation.
[0044] S20: The target liquid region is sampled in blocks, and a feature extraction operation including at least the extraction of R-value features is performed in each block; wherein, the R-value features are constructed based on high and low energy attenuation data, which are obtained by solving the block dual-energy X-ray images, and the dual-energy X-ray images include a high-energy image reflecting the attenuation information after the interaction of high-energy X-rays with matter and a low-energy image reflecting the attenuation information after the low-energy X-rays penetrate the object.
[0045] Specifically, the feature extraction operation also includes: for each block, extracting basic features to characterize the statistical situation, gradient features to characterize the gradient situation, and combined features to characterize the combination of the target liquid region and the adjacent background reference region of the target liquid region.
[0046] Specifically, the R-value features include the first R-value feature, the second R-value feature, and the third R-value feature; where: The first R-value feature is based on the ratio of the liquid high-energy mean to the background high-energy mean, and the ratio of the liquid low-energy mean to the background low-energy mean, and is obtained by normalization. The second R-value feature is obtained by normalizing the mean difference between the low-energy and high-energy liquids. The third R-value feature is obtained by normalizing the differences between the background low-energy mean and the liquid low-energy mean, the differences between the background high-energy mean and the liquid high-energy mean, the ratio of the liquid low-energy mean to the liquid high-energy mean, and the ratio of the background low-energy mean to the background high-energy mean.
[0047] In the specific application of this embodiment, preliminary feature extraction is performed independently on each oblique rectangular block, specifically including: Basic characteristics, or basic statistical characteristics, include the high-energy / low-energy mean, median, variance, and the ratio of high-energy to low-energy mean between the liquid region and the background region.
[0048] Gradient features, also known as high-level gradient features, are calculated using Laplacian convolution kernels to compute the mean gradient, logarithmic mean gradient, and gradient mean ratio for both high and low energies. It should be noted that in this embodiment, gradient calculation can use Sobel, Prewitt, or other convolution kernels instead of the Laplacian convolution kernel.
[0049] The combined features include the ratio of high-energy mean to low-energy mean and the ratio of high-energy logarithmic mean to the liquid region and background region.
[0050] In this specific application, the R-value feature is a set of physically invariant R-value features calculated for each oblique rectangular block to compensate for the effects of liquid thickness and X-ray scattering. As a preferred embodiment of this invention, the R-value feature includes a first R-value feature. Second R-value characteristics and the third R-value feature The corresponding mathematical expression is as follows: in, This indicates a logarithmic calculation to complete the normalization.
[0051] It should be noted that, in this embodiment, the R-value feature can be added to or replaced with other log-normalized forms based on the high and low energy decay ratio.
[0052] Regarding S20, in summary, this embodiment extracts R-value features based on high and low energy attenuation data within each block. Combined with the first R-value feature... Second R-value characteristics Third R-value characteristics The construction logic and supplementary basic features, gradient features, and combined features improve the feature extraction system. Its core function breaks through the limitation of existing technologies using only atomic number features, achieving explicit physical compensation for liquid thickness variations and X-ray scattering interference. Based on S20, this embodiment specifically addresses the following technical deficiencies: First, existing end-to-end deep learning methods rely entirely on black-box features, lacking any explicit compensation mechanism for thickness and scattering; second, existing region-difference-based methods can only output a single effective atomic number, failing to achieve accurate identification of multiple liquid categories; third, existing cross-device model training methods only address data migration issues, without designing any compensation features for thickness, scattering, or atomic number discrimination; fourth, existing point-sampling-based methods have overly simplistic feature extraction capabilities, insufficient for compensating for thickness unevenness and scattering interference; fifth, existing base material decomposition-based methods only extract global base material decomposition features, resulting in very limited material discrimination.
[0053] The aforementioned multi-dimensional physical invariance feature system has effectively solved the problems of thickness and scattering interference in the liquid body region. However, in actual security inspection scenarios, the edge of the liquid region remains a high-risk area for identification errors due to the most drastic thickness changes and the most significant X-ray scattering effects. Existing technologies have not designed targeted enhancement mechanisms for this special region, and feature extraction from main block sampling is also insufficient to fully capture the differentiated information of the edge region. Therefore, this embodiment further introduces an edge-sensitive region enhancement processing flow.
[0054] S30: Locate the edge-sensitive region in the liquid area where the thickness changes drastically and the scattering interference is significant. Perform feature extraction operation independently on the edge-sensitive region to obtain boundary supplementary features. Fuse the boundary supplementary features with the R-value features corresponding to each block to obtain the fused features of each block.
[0055] Specifically, the location of edge-sensitive regions is as follows: based on the dual-energy X-ray image, a fused grayscale image is generated, and a threshold segmentation method is used to extract sub-regions from the liquid region where the high and low energy attenuation is less than the preset high and low energy attenuation thresholds as edge-sensitive regions.
[0056] In this specific application, to further reduce the influence of liquid thickness and scattering interference, liquid boundary enhancement processing is performed: the high-energy image is... With low energy diagram fusion to generate fused grayscale image ; within the liquid mask area OTSU threshold segmentation is used to identify regions with smaller high and low energy attenuation as sub-regions of interest. Feature extraction operations, including basic features, gradient features, combined features, and R-value features, are repeatedly performed on these sub-regions to obtain supplementary boundary features. It should be noted that the determination of smaller high and low energy attenuation in this embodiment—that is, the extraction of sub-regions with high and low energy attenuation less than a preset high and low energy attenuation threshold—is based on numerical comparisons after setting corresponding high and low energy attenuation thresholds according to knowledge known to those skilled in the art or actual needs.
[0057] In summary, this embodiment identifies edge-sensitive regions in the liquid region characterized by drastic thickness variations and significant scattering interference. Features are independently extracted from these regions to obtain supplementary boundary features. These supplementary boundary features are then fused with the R-value features corresponding to each block to obtain block-based fused features. By combining this with the generation of a fused grayscale image from dual-energy X-ray images and employing threshold segmentation to locate edge-sensitive regions, S30 compensates for the feature blind spots in the main block sampling and specifically enhances the feature representation of the most severely interfered regions. In general, S30 addresses the following shortcomings in existing technologies: existing point-sampling methods completely ignore the special interference characteristics of boundary regions, resulting in significant feature blind spots; existing region-difference methods are highly sensitive to thickness unevenness and scattering interference, leading to extremely high error rates in boundary region identification; and existing cross-region fusion methods fail to adequately compensate for overall thickness variations and scattering interference, with boundary region interference severely impacting the final identification results.
[0058] Through the targeted enhancement and feature fusion of the aforementioned edge-sensitive regions, this embodiment has constructed a complete block feature system covering the entire liquid body and edge area, possessing both physical invariance and anti-interference capabilities. However, existing technologies generally employ a decision-making mode that combines global feature fusion with single-prediction. Local occlusion, local thickness anomalies, or local scattering interference can still directly lead to errors in the global recognition results, exhibiting extremely poor fault tolerance. To completely solve this problem, this embodiment adopts a classification architecture that combines independent block prediction with multi-result fusion decision-making.
[0059] S40: Input the fusion features of each block into the preset classification model to obtain independent local classification results, perform fusion decision on all independent local classification results, and determine the final liquid category.
[0060] Specifically, a fusion decision is made for all independent local classification results. Specifically, a majority voting mechanism is used to determine the final liquid category. If the number of votes is the same, the classification probability scores of each block are combined, and the category with the highest total score is taken as the final identification result.
[0061] In the specific application of this embodiment, all feature vectors extracted from each oblique rectangle block, namely basic features, gradient features, combined features, R-value features, and boundary supplementary features, are input into a preset machine learning classification model, for example, a generalized linear model (GLM), a support vector machine (SVM), or an ensemble model thereof, to independently predict the liquid category. The category includes, but is not limited to, dangerous / non-dangerous liquids such as gasoline, alcohol, water, pesticides, and sulfuric acid.
[0062] In the specific application of this embodiment, the classification results of all blocks are integrated for decision-making: the final category is determined by a majority voting mechanism; if there is a tie in the number of votes, the predicted probability scores of each block for all categories are combined, and the category with the highest total score is taken as the final identification result.
[0063] In summary, this embodiment inputs the fusion features of each block into a preset classification model to obtain independent local classification results, and then performs a fusion decision on all local classification results to determine the final liquid category. Combined with a majority voting mechanism, where the category with the highest total classification probability score is used when votes are tied, S40 completely changes the existing single-prediction global model, significantly improving the system's fault tolerance and robustness. This specifically addresses the following shortcomings of existing technologies: end-to-end deep learning methods use single-prediction global methods, where local occlusion or interference can directly lead to global errors; dual-view hardware-based methods rely on complex CT reconstruction algorithms, resulting in high computational cost and poor real-time performance, making block-based parallel processing impossible; and region-difference-based methods predict based only on features from a single region, exhibiting extremely low fault tolerance.
[0064] Overall, this invention, based on steps S10 to S40, forms a complete and closed-loop technical chain with strong synergistic effects between each step. Specifically, directional block sampling provides the necessary sample foundation for calculating physically invariant features, core feature extraction achieves explicit compensation for key interferences, edge enhancement and fusion fills in feature blind spots, and integrated decision-making ultimately transforms the advantages of local features into high global robustness. This synergistic effect produces the following technical results in this embodiment: oblique rectangular block segmentation ensures that each sample simultaneously contains liquid and background; combined with the R-value features corresponding to thickness / scattering invariance and OTSU boundary enhancement, it effectively compensates for liquid thickness variations and X-ray scattering interference, solving the problem of insufficient discrimination of existing atomic number methods; and the classification accuracy is significantly improved in scenarios with uneven thickness and severe scattering. Furthermore, processing is only performed in the region of interest, eliminating the need for full-image computation; and the integrated decision-making after independent block prediction results in low computational load, making it suitable for real-time security checks.
[0065] Reference Figure 2 , Figure 2The diagram shows the structure of a liquid identification device based on dual-energy X-ray images provided in this application embodiment; in the diagram: 10, block construction module; 20, feature extraction module; 30, edge fusion module; 40, fusion decision module.
[0066] like Figure 2 As shown, this embodiment also discloses a liquid identification device based on dual-energy X-ray images, which applies the liquid identification method based on dual-energy X-ray images as described above, including: The segmentation construction module 10 is configured to: determine the region of interest based on the boundary of the container within the package; obtain the main direction axis of the liquid region within the region of interest; and set multiple multi-scale segments aligned with the main direction along the main direction axis, with each segment simultaneously covering the target liquid region and the adjacent background reference region of the target liquid region.
[0067] The feature extraction module 20 is configured to: perform block sampling on the target liquid region, and perform feature extraction operations, including at least the extraction of R-value features, within each block; wherein the R-value features are constructed based on high and low energy attenuation data, which are obtained by solving the block dual-energy X-ray images, and the dual-energy X-ray images include a high-energy image reflecting the attenuation information after high-energy X-rays interact with matter and a low-energy image reflecting the attenuation information after low-energy X-rays penetrate an object.
[0068] The edge fusion module 30 is configured to: locate edge-sensitive regions in the liquid region with drastic thickness changes and significant scattering interference; independently perform feature extraction operations on the edge-sensitive regions to obtain boundary supplementary features; and fuse the boundary supplementary features with the R-value features corresponding to each block to obtain the fused features of each block.
[0069] The fusion decision module 40 is configured to: input the fusion features of each block into a preset classification model to obtain independent local classification results, perform fusion decision on all independent local classification results, and determine the final liquid category.
[0070] This embodiment also discloses a liquid identification device based on dual-energy X-ray imaging, including at least one processor, at least one memory, and a data bus; The processor and memory communicate with each other via a data bus; The memory stores program instructions that can be executed by the processor, which calls the program instructions to execute the liquid identification method based on dual-energy X-ray images as described above.
[0071] This embodiment also discloses a storage medium on which a computer program is stored. When the computer program is executed by a processor, it implements the liquid identification method based on dual-energy X-ray images as described above.
[0072] It should be noted that the liquid identification device, apparatus, and storage medium based on dual-energy X-ray images in this embodiment correspond to the aforementioned liquid identification method based on dual-energy X-ray images. Therefore, any content not specifically described in the liquid identification device, apparatus, and storage medium based on dual-energy X-ray images in this embodiment, including but not limited to functional definitions, working principles, and technical effects, can be referred to the description in the aforementioned liquid identification method based on dual-energy X-ray images, and will not be repeated here.
[0073] To further illustrate the technical effectiveness of the liquid identification method, apparatus, device, and storage medium based on dual-energy X-ray imaging in this embodiment, the following aspects are summarized: test conditions, different liquid volumes and placement postures, multi-category recognition effectiveness, binary classification effectiveness for safe / hazardous liquids, comparison with existing methods, and on-site playback data. This embodiment uses the final output result of the entire bottle of liquid as the evaluation object, focusing on illustrating the stability, recognition improvement effect, and application adaptability of this embodiment in the scenario of liquid security inspection in plastic bottles.
[0074] This embodiment uses dual-energy X-ray imaging for liquid region localization. Multi-scale blocks are constructed along the main axis of the liquid. Within each block, the target liquid region and its adjacent background reference region are simultaneously sampled, and R-value features, high- and low-energy image statistical features, equivalent atomic number features, and boundary supplementation features are extracted. After each block independently outputs its local classification results, the entire liquid category is obtained through majority voting and probability score fusion, thereby reducing the impact of local noise, plastic bottle walls, liquid surface disturbances, and occluded backgrounds on the recognition results.
[0075] In practical implementation, the algorithm flow can be described as follows: Step 1: Acquire dual-energy X-ray images of the package to be inspected, including high-energy and low-energy images; Step 2: Determine the region of interest for the liquid based on the plastic bottle boundary, grayscale distribution, and edge response, and estimate the principal axis of the liquid region; Step 3: Arrange large, medium and small oblique rectangular blocks along the main axis so that the blocks simultaneously cover the target liquid area and the adjacent background reference area; Step 4: Calculate the high and low energy attenuation relationship within each effective block, and extract R-value features such as the first R-value feature, the second R-value feature, and the third R-value feature; Step 5: Extract the high-energy image features, low-energy image features, equivalent atomic number features, basic statistical features, and gradient features corresponding to the blocks; Step 6: Locate edge-sensitive areas with significant thickness changes or scattering interference, such as the liquid edge, bottle bottom, and bottle mouth; extract boundary supplementary features and fuse them with block features. Step 7: Input the fused features into the trained classification model to obtain the local class and class probability of each block; Step 8: Perform majority voting on the local results of multiple valid blocks; when the number of votes is the same or the difference is small, combine the category probability score to determine the final recognition result.
[0076] The specific testing conditions and evaluation criteria for this implementation will now be explained.
[0077] This implementation guide uses the statistical analysis of liquid samples from plastic bottles as an example. The test set contains 780 independent liquid samples from plastic bottles, covering categories such as water, beverages, milk, cooking oil, low-alcohol beverages, medical alcohol, gasoline, paint thinner, pesticides, and strong acid / alkali cleaning solutions. Training and test samples are isolated according to collection batch and bottle number to prevent the same liquid from appearing in both the training and test sets simultaneously.
[0078] The evaluation metric is based on the final identification result of the entire bottle. Multi-class accuracy is calculated by dividing the number of correctly identified samples by the total number of test samples. The safety / hazard binary classification metric is mapped according to manually labeled safety attributes, where hazardous liquids include medical alcohol, gasoline, paint thinner, pesticides, and strong acid / alkali cleaning solutions. Samples where the liquid region cannot be stably segmented, the number of effective segments is insufficient, or the model outputs an incorrect category are all counted as misidentifications.
[0079] The following is a description of the specific experimental example implemented in this study.
[0080] Experiment Example 1: Recognition performance under different liquid volumes and placement postures Changes in liquid volume alter the effective penetration path of X-rays within the liquid. At lower liquid volumes, the effective liquid area is smaller, with the bottle bottom and background areas occupying a larger proportion of the segmented area, making it easier to introduce interference. As the liquid volume increases, the number of effective liquid pixels increases, and multiple scale segments can obtain more stable attenuation and R-value features. Therefore, the overall recognition performance improves with increasing liquid volume. To verify the adaptability of the embodiment to changes in liquid volume, the test samples were grouped according to the proportion of liquid height to the effective height of the plastic bottle. The statistical results are shown in Table 1.
[0081] Table 1. Identification results under different liquid volume conditions As shown in Table 1, with increasing liquid volume, the proportion of the effective liquid area in the segment increases, and the recognition accuracy gradually improves from 88.4% under low liquid volume conditions to 96.8% under high liquid volume conditions. This indicates that the multi-scale segmentation and voting mechanism of this embodiment can make full use of more complete liquid area information, and the overall recognition effect is more stable when the liquid volume is higher.
[0082] Besides the liquid volume, factors such as the transparency of different plastic bottles, bottle shape, placement, and overlap with other objects also affect the stability of local features. A breakdown of statistical results for typical plastic bottle conditions is shown in Table 2.
[0083] Table 2. Robustness test results of plastic bottles and their placement conditions. It should be noted that Table 2 presents the robustness statistics for each item of the plastic bottle samples. The same sample may fall under multiple conditions simultaneously; therefore, the sample counts for each row are not totaled. As can be seen from Table 2, this embodiment maintains relatively stable recognition performance under conditions of transparent PET plastic bottles, plastic bottles with different appearances, slight tilt, and partial background overlap. Multi-scale segmentation and voting fusion can reduce the impact of anomalies in a single region on the overall bottle judgment, enabling this embodiment to adapt to common plastic bottle security inspection scenarios.
[0084] Experiment Example 2: Multi-category Liquid Recognition Performance To verify the ability of this embodiment to distinguish between liquids in plastic bottles with different material properties, a multi-category identification test was conducted on ten categories of liquids, including safe and hazardous liquids. The test results are shown in Table 3.
[0085] Table 3 shows that samples with significant differences from other categories, such as water and strong acid / alkali cleaning solutions, have higher identification accuracy. Gasoline, paint thinner, pesticides, and alcohol-containing liquids show some overlap in their characteristic ranges, leading to relatively concentrated misidentifications. These results are closer to the characteristics of actual plastic bottle liquid safety inspection data; that is, this embodiment can reliably distinguish most liquids and maintain good identification ability for boundary samples with similar material compositions or low liquid volumes.
[0086] In security inspection applications, in addition to specific categories, the most important aspect is the binary classification of safe liquids versus hazardous liquids. After mapping the categories in Table 3 to safe / hazardous attributes, the binary classification results are shown in Table 4.
[0087] Table 4 Statistical Results of the Two-Classification of Safe / Hazardous Liquids Referring to Table 4, the binary classification results are higher than the multi-class accuracy, indicating that some multi-class misidentifications occur within the same safety attribute, such as confusion between water and low-concentration beverages, or gasoline and paint thinner. In actual security inspection scenarios, this type of error has a relatively small impact on safety / hazard judgment. Of particular concern are the 15 samples where hazardous liquids were judged as safe, which mainly occurred under conditions of low liquid volume, strong obstruction, or volatile solvents with characteristics similar to safe oils.
[0088] Experiment Example 3: Comparison Experiment with Existing Methods To illustrate the improvement of this embodiment compared to existing methods, the following comparative experiments were conducted on the same plastic bottle test set: Method A used only low-energy image grayscale statistical features; Method B used high- and low-energy image statistical features; Method C used the R-value and equivalent atomic number features of the entire bottle region; Method D used single-scale block R-value features and performed voting; this embodiment uses multi-scale block segmentation, integrates R-value, high- and low-energy images, equivalent atomic number, and boundary supplementation features, and performs voting decision-making. The comparison results are shown in Table 5.
[0089] Table 5 Comparison results of different recognition methods As shown in Table 5, when using only low-energy images or simple high- and low-energy statistical features, the model's ability to express differences in liquid materials is limited, resulting in relatively low recognition accuracy. The whole-bottle R-value and equivalent atomic number can improve material discrimination, but they are still easily averaged by the liquid surface, bottle bottom, and local background regions. Single-scale segmentation can improve local anomaly issues, but it is insufficient for adapting to different plastic bottle sizes and orientations. This embodiment achieves a multi-class accuracy of 93.6% through multi-scale segmentation, liquid / background pairwise sampling, boundary supplementation features, and voting fusion; compared to methods A, B, C, and D, this represents improvements of 16.9, 12.7, 8.7, and 4.8 percentage points, respectively, demonstrating a more significant improvement.
[0090] The real passenger data test of this embodiment will now be described.
[0091] To examine the generalization ability of this embodiment in a near-real-world security check environment, anonymized on-site channel playback data and manually verified plastic bottle samples were used for testing. Since the proportion of hazardous liquid samples in real passenger data was relatively low, the hazardous liquid portion was supplemented using on-site retested samples; this data was only used for effectiveness verification and did not participate in model training or threshold adjustment. The statistical results are shown in Table 6.
[0092] As shown in Table 6, this embodiment maintains a relatively stable recognition performance in the on-site playback of plastic bottle data. Compared with the standard test set, the background, placement angle, and manual verification standards of the packages in the real passenger data are more complex, resulting in slight fluctuations in the overall consistency rate. A small number of inconsistent samples mainly stem from insufficient effective liquid area, incomplete boundaries caused by overlapping items, and inconsistencies between the granularity of the manual verification category and the granularity of the algorithm output.
[0093] Based on the above experimental results, in summary, this embodiment achieved a multi-class recognition accuracy of 93.6% on 780 independent plastic bottle test samples, an overall accuracy of 96.0% for safety / hazardous binary classification, and a hazardous liquid detection rate of 95.4%. Compared with schemes that only use low-energy grayscale, high-low energy statistics, or whole-bottle R-values, this embodiment shows a stable improvement in both multi-class recognition and hazardous liquid detection.
[0094] The error distribution shows that this embodiment performs better on high-volume plastic bottle samples. Low-volume, significantly tilted, overlapping background, and liquids with similar material properties remain the main challenges. These error distributions are consistent with actual X-ray plastic bottle liquid recognition scenarios, indicating that multi-scale segmentation, boundary supplementation features, and voting fusion mainly improve stability under complex conditions, rather than relying on a single feature to generate accidental high scores.
[0095] Therefore, this embodiment can improve the accuracy and robustness of liquid identification in plastic bottles by utilizing existing dual-energy X-ray images without adding dedicated dual-view hardware or additional tray constraints. It is suitable for identifying common types of liquids in plastic bottles in security inspection packages and for initial screening of safe / hazardous liquids.
[0096] In summary, the liquid identification method, apparatus, device, and storage medium based on dual-energy X-ray imaging in this embodiment have at least the following technical optimizations and corresponding effects: By setting up multi-scale blocks that simultaneously cover the liquid and adjacent background along the main directional axis of the liquid region, standardized paired samples of liquid and background are constructed from the sampling source, which completely solves the problems of strong subjectivity and poor adaptability of existing sampling methods. It can be adapted to liquid containers of different capacities and shapes, and achieve full-range feature coverage of the liquid region.
[0097] By constructing physical invariance features based on high and low energy decay data within the blocks, explicit compensation for liquid thickness variations and X-ray scattering interference is achieved. This breaks through the discrimination bottleneck of existing technologies based on a single equivalent atomic number, and significantly improves the multi-category recognition accuracy of liquids with similar atomic numbers, such as gasoline and alcohol.
[0098] By locating edge-sensitive areas and extracting supplementary features for fusion, the feature blind spots of the main block sampling are compensated, the feature expression of the most severely interfered areas is strengthened in a targeted manner, and the recognition robustness in complex scenarios is further improved.
[0099] The classification architecture, which adopts block-based independent prediction and multi-result fusion decision-making, significantly reduces the impact of local occlusion, local thickness anomalies, or local scattering interference on the final result, and significantly improves the system's fault tolerance. At the same time, it only processes within the region of interest, with low computational load, which can meet the real-time requirements of security inspection scenarios.
[0100] The overall solution is implemented entirely in software, without relying on dual-view hardware, dedicated liquid trays or other specialized equipment. It can be directly adapted to ordinary single-view X-ray security inspection equipment, with low deployment costs and strong versatility.
[0101] In the embodiments provided in this application, it should be understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, code, or any suitable combination thereof. For hardware implementation, the processor may be implemented in one or more of the following: application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, other electronic units designed to implement the functions described herein, or combinations thereof. For software implementation, some or all of the processes of the embodiments may be performed by a computer program instructing the associated hardware. During implementation, the program may be stored in a computer-readable storage medium or transmitted as one or more instructions or code on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein communication media include any medium that facilitates the transmission of a computer program from one place to another. Storage media may be any available medium accessible to a computer. Computer-readable storage media may include, but are not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code having the form of instructions or data structures and accessible to a computer.
[0102] Finally, it should be noted that the above description is only a preferred embodiment of this application and is not intended to limit this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A dual-energy X-ray image-based liquid identification method for identifying a liquid in a security screening parcel container, characterized by, include: The region of interest is determined based on the boundary of the container within the package; Within the region of interest, obtain the principal axis of the liquid region; Multiple multi-scale blocks aligned with the main direction are set along the main direction axis. Each block simultaneously covers the target liquid region and the adjacent background reference region of the target liquid region. The target liquid region is sampled in blocks, and a feature extraction operation including at least the extraction of R-value features is performed in each block; wherein, the R-value features are constructed based on high and low energy attenuation data, which are obtained by solving the block-based dual-energy X-ray images, and the dual-energy X-ray images include a high-energy image reflecting the attenuation information after high-energy X-rays interact with matter and a low-energy image reflecting the attenuation information after low-energy X-rays penetrate the object; The edge-sensitive regions in the liquid region with drastic thickness changes and significant scattering interference are located. Feature extraction operations are performed independently on the edge-sensitive regions to obtain boundary supplementary features. The boundary supplementary features are then fused with the R-value features corresponding to each block to obtain the fused features of each block. The fusion features of each segment are input into a preset classification model to obtain independent local classification results. A fusion decision is made on all independent local classification results to determine the final liquid category.
2. The liquid recognition method based on dual-energy X-ray images according to claim 1, characterized in that, The method involves setting multiple multi-scale blocks aligned with the main direction axis, specifically multiple blocks symmetrically distributed along the main direction axis, and setting at least two different scale blocks.
3. The dual-energy X-ray image-based liquid identification method of claim 1, wherein, The R-value features include a first R-value feature, a second R-value feature, and a third R-value feature; wherein: The first R-value feature is based on the ratio of the liquid high-energy mean to the background high-energy mean, and the ratio of the liquid low-energy mean to the background low-energy mean, and is obtained by normalization. The second R-value feature is obtained by normalizing the mean difference between the low-energy and high-energy liquids. The third R-value feature is obtained by normalizing the differences between the background low-energy mean and the liquid low-energy mean, the differences between the background high-energy mean and the liquid high-energy mean, the ratio of the liquid low-energy mean to the liquid high-energy mean, and the ratio of the background low-energy mean to the background high-energy mean.
4. The dual-energy X-ray image-based liquid identification method of claim 1, wherein, The location of the edge-sensitive region is specifically as follows: a fused grayscale image is generated based on the dual-energy X-ray image, and a threshold segmentation method is used to extract sub-regions from the liquid region whose high and low energy attenuation is less than a preset high and low energy attenuation threshold as edge-sensitive regions.
5. The dual-energy X-ray image-based liquid identification method of claim 1, wherein, The fusion decision for all independent local classification results is specifically as follows: a majority voting mechanism is used to determine the final liquid category; if the number of votes is the same, the classification probability scores of each block are combined, and the category with the highest total score is taken as the final identification result.
6. The dual-energy X-ray image-based liquid identification method according to claim 2, characterized in that, The multi-scale blocks are shaped like oblique rectangles, including large-scale oblique rectangle blocks, medium-scale oblique rectangle blocks, and small-scale oblique rectangle blocks.
7. The liquid identification method based on dual-energy X-ray imaging according to claim 1, characterized in that, The feature extraction operation further includes: for each block, extracting basic features for characterizing statistical conditions, gradient features for characterizing gradient conditions, and combined features for characterizing the combination of the target liquid region and the adjacent background reference region of the target liquid region.
8. A liquid identification device based on dual-energy X-ray imaging, employing the liquid identification method based on dual-energy X-ray imaging as described in any one of claims 1 to 7, characterized in that, include: The block construction module is configured to: determine the region of interest based on the boundary of the container within the wrapper; Within the region of interest, obtain the principal axis of the liquid region; Multiple multi-scale blocks aligned with the main direction are set along the main direction axis. Each block simultaneously covers the target liquid region and the adjacent background reference region of the target liquid region. The feature extraction module is configured to: sample the target liquid region in blocks, and perform feature extraction operations, including at least the extraction of R-value features, within each block; wherein the R-value features are constructed based on high and low energy attenuation data, which are obtained by solving the block-based dual-energy X-ray images, and the dual-energy X-ray images include a high-energy image reflecting the attenuation information after high-energy X-rays interact with matter and a low-energy image reflecting the attenuation information after low-energy X-rays penetrate an object; The edge fusion module is configured to: locate edge-sensitive regions in the liquid region with drastic thickness changes and significant scattering interference; independently perform feature extraction operations on the edge-sensitive regions to obtain boundary supplementary features; and fuse the boundary supplementary features with the R-value features corresponding to each block to obtain the fused features of each block. The fusion decision module is configured to: input the fusion features of each block into a preset classification model to obtain independent local classification results, perform fusion decision on all independent local classification results, and determine the final liquid category.
9. A liquid identification device based on dual-energy X-ray imaging, characterized in that, Includes at least one processor, at least one memory, and a data bus; The processor and the memory communicate with each other via the data bus; The memory stores program instructions that can be executed by the processor, which invokes the program instructions to execute the liquid identification method based on dual-energy X-ray images as described in any one of claims 1 to 7.
10. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the liquid identification method based on dual-energy X-ray images as described in any one of claims 1 to 7.