A Liquid Classification and Recognition Method Based on Attention-GRU Network
By using the Attention_GRU network combined with wavelet transformation and autoencoder method in liquid hazardous goods detection, the problem of liquid hazardous goods detection error and low efficiency in the prior art is solved, and higher identification accuracy and efficiency are achieved.
Patent Information
- Application Number
- CN202211028195.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-25
- Publication Date
- 2025-04-22
- Estimated Expiration
- 2042-08-25
AI Technical Summary
The prior art has problems of error and low efficiency in the detection of liquid hazardous goods, especially in the security inspection method combined with man-machine, which makes it easy for staff to miss inspection if they are not focused.
The liquid classification and identification method based on the Attention_GRU network is adopted to perform shallow feature extraction through wavelet transformation and improved autoencoder, and deep feature extraction is used to perform deep feature extraction to realize the classification of ultra-wideband centimeter wave liquid hazardous goods detection signals.
It improves the accuracy and efficiency of liquid hazardous goods identification, reduces the workload of staff, and enhances the accuracy of feature extraction and classification.
Smart Images

Figure CN115392308B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to classification and identification of hazardous liquids, and in particular to a liquid classification and identification method based on an Attention_GRU network. Background Art
[0002] At present, the main security inspection methods used in my country rely on X-ray machines, handheld liquid dangerous goods detectors and manual assistance methods. Although these security inspection methods are relatively mature and have relatively good detection effects, these methods have some shortcomings and cannot completely prevent the entry of liquid dangerous goods, and there are certain errors. At present, most of the security inspection equipment for dangerous goods detection is carried out by combining man and machine, so a lot of manpower and material resources need to be invested in the security inspection process. At the same time, security inspection staff must maintain a relatively concentrated attention during the security inspection process and always observe the items carried by passengers to ensure that dangerous goods are not carried. In this process, when there are too many people and too many types of items, the staff may be distracted or miss inspections.
[0003] Although physical and manual methods can be used to identify the items carried as liquids, further verification is needed as to what the liquids are. It is of research significance to identify the items carried as liquids and further classify the liquids while increasing the efficiency and accuracy of security inspections and reducing the workload of staff. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a liquid classification and recognition method based on the Attention_GRU network. The autoencoder with added constraints is used to perform shallow feature extraction on the signal after wavelet decomposition, and the Attention-GRU network is used to further perform deep feature extraction, thereby realizing the classification of ultra-wideband centimeter-wave liquid hazardous goods detection signals, and effectively improving the accuracy of liquid hazardous goods identification.
[0005] The objective of the present invention is achieved through the following technical solution: A liquid classification and recognition method based on Attention_GRU network, comprising the following steps:
[0006] S1. Collect known types of liquid dangerous goods as samples and detect the raw data and environmental noise of the samples;
[0007] S2, cleaning and preprocessing the collected raw data;
[0008] S3, using wavelet transform combined with improved autoencoder to extract shallow features from the preprocessed data to obtain a shallow feature sequence;
[0009] S4. Repeat steps S1 to S3 for different known types of liquid dangerous goods to obtain shallow features of different liquid dangerous goods, and mark the shallow features based on the categories of the liquid dangerous goods and add them to the training set;
[0010] S5. The shallow feature sequence is further subjected to deep feature extraction through the Attention-GRU network to obtain the output of feature extraction and classification.
[0011] Wherein, the step S1 comprises:
[0012] The liquid dangerous goods sample is tested by using a broadband beam focusing system to obtain a scattering parameter curve of the sample as raw data; the obtained scattering parameter curve is the ultra-wideband centimeter-wave liquid dangerous goods detection signal UWB-CMW-DLDS;
[0013] Then the air is detected using a broadband beam focusing system to obtain the scattering parameter curve of the air as the environmental noise.
[0014] Furthermore, the step S2 comprises:
[0015] S201. Clean the scattering parameter curve of the sample, delete duplicate data, and eliminate data errors;
[0016] S202. Preprocess the scattering parameter curve of the cleaned sample, and the preprocessing is implemented by squelching and filling:
[0017] The data of the collected air samples is used as environmental noise. The scattering parameter curve of the cleaned sample is subtracted from the scattering parameter curve of the air to remove the noise and achieve the effect of noise suppression. The noise suppression formula is as follows:
[0018]
[0019] Where S is the sample scattering parameter curve after noise reduction, S sa Scattering parameter curve of the cleaned sample, S em is the scattering parameter curve of air;
[0020] Filling the sample scattering parameter curve after muting to obtain the preprocessed sample scattering parameter curve;
[0021] Two types of vector network analyzers were used during the acquisition process. Due to the problems of the vector network analyzer itself, the frequency sweep intervals between the acquired data were greatly different. This caused the acquired ultra-wideband centimeter-wave liquid hazardous goods detection signals to have different lengths. To address this problem, a unified signal length was adopted. The specific steps are as follows: 800 points within 8GHz-18GHz were set as a unified length, data greater than the unified length was deleted, and data less than the unified length was padded with 0 in the missing frequency band.
[0022] Furthermore, the step S3 comprises:
[0023] S301. Using the sym5 wavelet of the symlet wavelet system, the pre-processed sample scattering parameter curve is subjected to a 5-layer discrete wavelet decomposition, and a total of 5 layers of high-frequency signals and 5 layers of low-frequency signals are obtained, with a total of 10 wavelet components, so that the signal characteristics of different liquids are obviously different;
[0024] S302. Combining the wavelet components of each frequency into a group of wavelet decomposition component combination signals;
[0025] S303. Perform shallow feature extraction on the wavelet decomposition component combination signal through an improved autoencoder with added constraints to obtain a shallow feature data sequence.
[0026] Furthermore, the step S5 comprises:
[0027] S501. Set the number of iterations;
[0028] S502, compare the shallow feature data sequence obtained in step S3 with the hidden layer data h of the GRU network at the previous moment t-1 Input the linear layer of attention together;
[0029] S503. Perform normalization processing through the softmax layer to obtain a normalized weight value Attn_weight;
[0030] S504. Multiply the obtained weight value and the shallow feature data sequence element by element through the Mul operation unit to obtain the attention result;
[0031] S505. Combine the attention result with h t-1 Input into the GRU network to get the hidden layer data h at the next moment t , enter the iterative process;
[0032] S506. When the maximum number of iterations is reached, the obtained h t Through the output of the fully connected layer, the results of feature extraction and classification are obtained.
[0033] The beneficial effects of the present invention are as follows: (1) The algorithm proposed in the present invention combines wavelet transform with deep learning algorithm for the first time, and utilizes the relevant properties of wavelet transform to perform wavelet decomposition on the collected ultra-wideband centimeter-wave liquid dangerous goods detection signal, obtain and save the wavelet components of each frequency. This not only expands the dimension of the data set, but also enhances the interpretability of the data. It improves the problem of small data volume in the data set, and also decomposes the data signals of each frequency, so that the differences in data signal characteristics are clear. This improves the effect of shallow feature extraction.
[0034] (2) The present invention designs an autoencoder with added constraints. Compared with the traditional autoencoder, it has certain advantages in feature extraction of ultra-wideband centimeter-wave liquid dangerous goods detection signals. For example, the one-dimensional convolutional neural network used in the encoder stage has advantages such as simple structure and reduced possibility of overfitting compared with the multi-layer perceptron. In the decoder stage, the decoder with constraints and internal structure set to 3 deconvolution layers can better output the details of the signal and make the autoencoder more purposeful compared with the traditional decoder. Using the autoencoder with added constraints to perform shallow feature extraction on the signal after wavelet decomposition will make the extracted feature differences clearer, so as to improve the accuracy of classification later.
[0035] (3) The present invention proposes an improved Attention-GRU algorithm as a deep feature extraction algorithm. The GRU network model is selected because it has a simpler structure and fewer parameters than LSTM. In addition, the attention mechanism is introduced into the structure of the GRU network. The weight of the attention mechanism is used to extract the criticality of the liquid signal, so as to expand the feature difference of the data. By taking advantage of the advantages of recurrent neural networks in processing sequence signals and the importance of the attention mechanism to distinguish the signals, the attention mechanism is combined with the GRU network and applied to the deep feature extraction and classification of ultra-wideband centimeter-wave liquid dangerous goods detection signals, which enhances the accuracy of feature extraction and classification.
[0036] (4) The classification algorithms based on WT-AE and Attention-GRU have improved the accuracy of liquid hazardous goods classification compared with other commonly used traditional algorithms and deep algorithms. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a flow chart of the overall method of the present invention;
[0038] Figure 2 is a schematic diagram of a broadband beam focusing system in an embodiment;
[0039] Figure 3 It is a schematic diagram of the principle of the encoder in the embodiment;
[0040] Figure 4 Schematic diagram of the principle of the improved autoencoder in the embodiment;
[0041] Figure 5 Schematic diagram of the internal structure of the decoder in the embodiment;
[0042] Figure 6 Flowchart of the shallow feature extraction algorithm.
[0043] Figure 7 Flowchart of the deep feature extraction algorithm. DETAILED DESCRIPTION
[0044] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings, but the protection scope of the present invention is not limited to the following.
[0045] like Figure 1 As shown, a liquid classification and recognition method based on the Attention_GRU network includes the following steps:
[0046] S1. Collect the original data of liquid dangerous goods detection signals and environmental noise;
[0047] The broadband beam focusing system is used to detect the liquid dangerous goods to be tested, and the scattering parameters of the liquid dangerous goods to be tested are obtained; the obtained scattering parameters are the ultra-wideband centimeter-wave liquid dangerous goods detection signals (UWB-CMW-DLDS)
[0048] Then the air is detected using a broadband beam focusing system to obtain the scattering parameters of the air as environmental noise.
[0049] like Figure 2 As shown, in an embodiment of the present application, a broadband beam focusing system of an ultra-wideband centimeter signal is used to collect signals, and the broadband beam focusing system of the ultra-wideband centimeter signal is composed of a pair of double-ridged horn antennas A and B, a pair of focusing lenses L1 and L2, a stage (fixture) S for holding samples, a signal source, and a vector network analyzer for analyzing signals; a transparent bottle of dangerous liquid to be tested is placed on the stage, and the ultra-wideband centimeter signal emitted by the signal source through antenna B generates an echo signal and a transmission signal after hitting an object, and the transmission signal is received by antenna A, and the signal source and antenna A are connected to the vector network analyzer, and the scattering parameters are analyzed by the vector network analyzer; when measuring air, no liquid is placed in the transparent bottle, and the measured parameters are the scattering parameters of the air;
[0050] S2, cleaning and preprocessing the collected raw data;
[0051] S201. Clean the data on the principle of retaining the original data, delete duplicate data, and eliminate data errors;
[0052] S202. Preprocess the cleaned data, adopt the method of noise reduction and filling to solve the problem of large noise interference and poor identity of the cleaned data:
[0053] When collecting data, the collected data of the empty sample or air sample is used as the background noise. The noise can be removed by subtracting the scattering parameter curve of the empty sample from the sample scattering curve to achieve the effect of noise suppression. The noise suppression formula is shown below.
[0054]
[0055] Where S is the scattering parameter after noise suppression, S sa is the scattering parameter of the sample, S em is the scattering parameter of air;
[0056] Two types of vector network analyzers were used during the acquisition process. Due to the problems of the vector network analyzer itself, the frequency sweep intervals between the acquired data were greatly different. This caused the acquired ultra-wideband centimeter-wave liquid hazardous goods detection signals to have different lengths. To address this problem, a unified signal length was adopted. The specific steps are as follows: 800 points within 8GHz-18GHz were set as a unified length, data greater than the unified length was deleted, and data less than the unified length was padded with 0 in the missing frequency band.
[0057] S3, using wavelet transform combined with improved autoencoder to extract shallow features from the preprocessed data to obtain a shallow feature sequence;
[0058] S301. Using the symlet wavelet system, the sym5 wavelet is selected to perform wavelet decomposition on the pre-processed UWB-CMW-DLDS, and a 5-layer discrete wavelet decomposition is performed to obtain a total of 5 layers of high-frequency signal and 5 layers of low-frequency signal data results, so that the signal characteristics of different liquids are obviously different;
[0059] S302. Combining wavelet components of different frequencies into a new UWB-CMW-DLDS data containing each component;
[0060] That is, at each frequency, the components of all samples at that frequency form a new set of data;
[0061] S303. The new data is subjected to shallow feature extraction through an improved autoencoder with added constraints to obtain a shallow feature data sequence. The improved autoencoder comprises four parts: input, encoder, decoder and output; the encoder and decoder are symmetrical in structure:
[0062] like Figure 3As shown, in the embodiment of the present application, the internal structure of the encoder is provided with 2 convolution layers, and the first layer uses 3 convolution layers, and then the 3 data passing through the first layer are combined and input into the second convolution layer to obtain the encoded output;
[0063] like Figure 4 As shown, in an embodiment of the present application, the decoder is a decoder with added classification constraints, which is different from the traditional decoder. The dotted box A is the traditional decoder, and the dotted box B is the classification constraint structure. By adding classification constraints to the traditional decoder part, the autoencoder can be more purposeful.
[0064] Figure 4 The training set labels mentioned in the figure are the labels assigned when the original data is collected.
[0065] Figure 4 The wavelet decomposition component combination signal is 11-dimensional data after wavelet transform (10-dimensional data obtained by wavelet transform and one-dimensional original data combined to form 11-dimensional data in total). The encoded output obtained by the encoder is output to branches A and B respectively to obtain two loss functions, which are then superimposed into a total loss function. The decoder combines these two structures by adding the loss functions of the two structures. The loss functions are the loss function loss in the autoencoder and the loss function loss in the encoder. encode ; Loss function defined in the classification constraint loss class .
[0066] Commonly used loss functions include MSE mean square error loss function, log loss, cross entropy loss, etc. encode The cross entropy loss is used, as shown in formula (1).
[0067]
[0068] Loss function of classification constraint class The mean square error (MSE) is used, as shown in formula (2).
[0069]
[0070] The total loss function loss is shown in formula (3).
[0071] loss=loss encode +αloss class (3)
[0072] Where α is a coefficient with a value of 0.0002, which is used to control the impact of the two loss functions on the total loss function. The value of the loss function indicates the degree of difference between the model's predicted value and the true value. The smaller the value of the loss function, the closer the model's result is to the true value.
[0073] Among them, MLP is a multi-layer perceptron, which includes an input layer, a hidden layer, and an output layer, and different layers are fully connected. The so-called full connection means that any neuron in the previous layer is connected to any neuron in the next layer. Since this is a classification problem, Softmax is selected as the activation function of the MLP output layer. Its function is to normalize the data, that is, each output signal value is between 0-1, and the sum of all signals is 1. The normalized signal obtained is the probability of classification. The loss function is a multivariate function, and its independent variables include all weights and all biases in the network. From the expression of the loss function, it can be seen that in order to minimize the loss function, the difference between the actual output and the expected output must be minimized. Therefore, during the training process, the loss function needs to be optimized by updating the weights along the negative gradient direction of the loss function.
[0074] like Figure 5 As shown, the internal structure of the decoder is composed of three deconvolution layers. The reason for using three deconvolution layers is to ensure that the decoding output has sufficient details.
[0075] The specific extraction process is to use the 5th order discrete wavelet transform to decompose the original collected ultra-wideband centimeter wave liquid dangerous goods detection signal and obtain each frequency component, and then save the original signal and each frequency classification. Then, the encoding part of the autoencoder encodes the original signal through 2 layers of convolution layers to obtain a set of data containing wavelet components, and finally inputs the decoder part, and uses the deconvolution layer for decoding, and finally obtains 3 outputs: encoding output, decoding output, and classification output. The sequence of the decoded output is the frequency components after the 5th order wavelet decomposition, and is also a sequence composed of shallow feature signals extracted by the wavelet transform-autoencoder as a shallow feature extraction algorithm.
[0076] like Figure 6 As shown, it is the flowchart of the shallow feature extraction algorithm.
[0077] S4. Repeat steps S1 to S3 for different known types of liquid dangerous goods to obtain shallow features of different liquid dangerous goods, and mark the shallow features based on the categories of the liquid dangerous goods and add them to the training set;
[0078] S5. The shallow feature sequence is further subjected to deep feature extraction through the Attention-GRU network to obtain the output of feature extraction and classification.
[0079] In the embodiments of the present application, the deep feature extraction algorithm structure design principle is as follows Figure 7 As shown, step S4 includes:
[0080] S501. Set the number of iterations;
[0081] S502: The decoded output of the autoencoder obtained in step S3 is compared with the hidden layer data h of the GRU network at the previous moment. t-1 Input the linear layer of attention together;
[0082] S503. Perform normalization processing through the softmax layer to obtain a normalized weight value Attn_weight;
[0083] S504. Multiply the obtained weight value and the shallow feature data sequence element by element through the Mul operation unit to obtain the attention result;
[0084] S505. Combine the attention result with h t-1 Input into the GRU network to get the hidden layer data h at the next moment t , enter the iterative process;
[0085] S506. When the maximum number of iterations is reached, the obtained h t Through the output of the fully connected layer, the results of feature extraction and classification are obtained.
[0086] The GRU network can solve the problem of long-term dependency caused by gradient explosion. Its structure is as follows: Figure 7 As shown in the GRU network part, GRU has two gates: update gate and reset gate. The update gate is used to decide which information to discard and which information to add, and the reset gate is used to decide the degree to which the previous information is discarded. When GRU propagates forward once, its internal calculation process is:
[0087] Update gate: u t =σ(w ux x t +w uh h t-1 +b u )
[0088] Reset gate: r t =σ(w rx x t +w rh h t-1 +b r )
[0089] Memory Unit:
[0090] Output:
[0091] From a forward propagation of GRU, we can find that the current moment of GRU introduced into the memory unit will be stored and updated, which can generate long-term dependency on information. This can solve the long-term dependency problem well.
[0092] The attention mechanism updates each component of the sequence by aggregating the global information of the complete input sequence. The most obvious function of the attention mechanism is that it can effectively represent the important information in the data and then conduct learning and training. The attention mechanism generally uses the relevant features of the data to learn the weights, and then combines the obtained weights with the original feature information for weighted summation, thereby playing the role of feature enhancement. Adding the attention mechanism can enhance feature extraction. Adding the Attention weight in the feature extraction process highlights the differentiated influence of the input ultra-wideband centimeter-wave liquid dangerous goods detection signal on the output in different frequency bands, which can improve the feature distinction for the subsequent classification of ultra-wideband centimeter-wave liquid dangerous goods detection signals and thus improve the classification accuracy of ultra-wideband centimeter-wave liquid dangerous goods detection signals, while also making the algorithm more interpretable.
[0093] like Figure 7 As shown in the figure, the attention mechanism includes the following units:
[0094] (1) Linear unit: Its function is to connect the input signal and the hidden layer through the linear unit to set the input and output dimensions;
[0095] (2) Softmax unit: Its function is to normalize the data and obtain the attention mechanism weight;
[0096] (3)Weight unit: It is the weight value obtained after normalization;
[0097] (4) Mul operation unit: multiply the input signal by the obtained weight element by element to obtain the importance of the input signal frequency band;
[0098] (5) Applied unit: This unit is the importance of the information contained in the obtained signal. It is also the output of the attention mechanism.
[0099] from Figure 7 It can be seen that the hidden layer h t-1 With input ultra-wideband centimeter wave liquid dangerous goods detection signal x tThe input and output dimensions are set through the Linear layer together; the data is then normalized through the softmax layer to obtain the Attn_weight weight, and then the importance of the input signal frequency band is calculated through the Mul operation unit to obtain an Attn_applied about the importance of the information contained in the ultra-wideband centimeter-wave liquid dangerous goods detection signal, and then the obtained Attn_applied is compared with h t-1 Input them into the GRU network together to get h t , pass it through the fully connected layer to obtain the output of feature extraction and classification. )
[0100] The above is a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, and should not be regarded as excluding other embodiments, but can be used in other combinations, modifications and environments, and can be modified within the scope of the concept described herein through the above teachings or the technology or knowledge of the relevant field. The changes and modifications made by those skilled in the art do not depart from the spirit and scope of the present invention, and should be within the scope of protection of the claims attached to the present invention.
Claims
1. A liquid classification and recognition method based on Attention_GRU network, characterized by: The following steps are involved: S1. Collect known types of liquid dangerous goods as samples and detect the raw data and environmental noise of the samples; S2, cleaning and preprocessing the collected raw data; S3, using wavelet transform combined with improved autoencoder to extract shallow features from the preprocessed data to obtain a shallow feature sequence; The improved autoencoder comprises an encoder part and a decoder part: The encoder part includes two convolution modules. The first convolution module includes three parallel branches. The first two branches are composed of one convolution layer, and the third branch is composed of one convolution layer and one pooling layer. The outputs of the three branches of the first convolution module are combined and input into the second convolution module containing one convolution layer to obtain the output of the encoder part. The decoder part includes 3 deconvolution layers; S4. Repeat steps S1 to S3 for different known types of liquid dangerous goods to obtain shallow features of different liquid dangerous goods, and mark the shallow features based on the categories of the liquid dangerous goods and add them to the training set; S5, the shallow feature sequence is further subjected to deep feature extraction through the Attention-GRU network to obtain the output of feature extraction and classification; The step S5 comprises: S501. Set the number of iterations; S502. Combine the shallow feature data sequence obtained in step S3 with the hidden layer data h of the GRU network at the previous moment t-1 Input the linear layer of attention together; S503. Perform normalization processing through the softmax layer to obtain a normalized weight value Attn_weight; S504. Multiply the obtained weight value and the shallow feature data sequence element by element through the Mul operation unit to obtain the attention result; S505. Combine the attention result with h t-1 Input into the GRU network to get the hidden layer data h at the next moment t , enter the iterative process; S506. When the maximum number of iterations is reached, the obtained h t Through the output of the fully connected layer, the results of feature extraction and classification are obtained.
2. According to claim 1, a liquid classification and recognition method based on the Attention_GRU network is characterized in that: The step S1 comprises: The liquid dangerous goods sample is tested by using a broadband beam focusing system to obtain the scattering parameter curve of the sample as the original data; the obtained scattering parameter curve is the ultra-wideband centimeter-wave liquid dangerous goods detection signal UWB-CMW-DLDS; Then the air is detected using a broadband beam focusing system to obtain the scattering parameter curve of the air as the environmental noise.
3. According to claim 1, a liquid classification and recognition method based on Attention_GRU network is characterized in that: The step S2 comprises: S201. Clean the scattering parameter curve of the sample, delete duplicate data, and eliminate data errors; S202. Preprocess the scattering parameter curve of the cleaned sample, and the preprocessing is implemented by squelching and filling: The data of the collected air samples is used as environmental noise. The scattering parameter curve of the cleaned sample is subtracted from the scattering parameter curve of the air to remove the noise and achieve the effect of noise suppression. The noise suppression formula is as follows: Where S is the sample scattering parameter curve after noise reduction, S sa Scattering parameter curve of the cleaned sample, S em is the scattering parameter curve of air; Filling the sample scattering parameter curve after muting to obtain the preprocessed sample scattering parameter curve; The filling process includes: setting 800 points within 8GHz-18GHz as a uniform length, deleting data larger than the uniform length, and filling 0 in the missing frequency band for data smaller than the uniform length.
4. The liquid classification and recognition method based on the Attention_GRU network according to claim 1 is characterized in that: The step S3 comprises: S301. Using the sym5 wavelet of the symlet wavelet system, the pre-processed sample scattering parameter curve is subjected to a 5-layer discrete wavelet decomposition, and a total of 5 layers of high-frequency signals and 5 layers of low-frequency signals are obtained, with a total of 10 wavelet components, so that the signal characteristics of different liquids are obviously different; S302. Combining the wavelet components of each frequency into a group of wavelet decomposition component combination signals; S303. Perform shallow feature extraction on the wavelet decomposition component combination signal through an improved autoencoder with added constraints to obtain a shallow feature data sequence.