Plastic bottle liquid component detection method and device
By using wifi signal transceiver and receiver devices and smart terminals, combined with neural network models, the existing liquid component detection equipment is solved, and fast, accurate and low-cost liquid component detection is achieved.
Patent Information
- Application Number
- CN202411861989.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2044-12-17
AI Technical Summary
Existing liquid component testing equipment is costly and inconvenient, making it difficult to achieve fast, accurate and low-cost liquid component testing.
By using wifi signal transceiver and receiving devices and smart terminals, data is sent and data penetrated through plastic bottles, channel state information is obtained, amplitude vectors and similarity vectors are extracted, and liquid composition classification prediction model is input, and detection is performed based on neural networks.
It realizes fast, contactless and low-cost liquid component detection, and can accurately identify components such as apple juice, Sprite, Coke, water, alcohol, gasoline, etc., with high detection efficiency and an accuracy rate of more than 90%.
Smart Images

Figure CN119811523A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of liquid detection, and in particular to a method and a device for detecting liquid components in a plastic bottle. Background Art
[0002] Rapid detection of liquid components is widely used in subways and high-speed trains. Passengers carrying plastic drinks in high-speed trains and subways need to quickly test their components to determine their safety. Plastic packaging products are widely available, and the unsafe components contained in them will endanger traffic safety. The existing technical equipment measuring instruments use different conductivity of liquids with different components to measure the components, and the equipment is expensive and not portable. Summary of the invention
[0003] The purpose of the present invention is to provide a method and device for detecting liquid components in plastic bottles, so as to provide portable, low-cost and rapid liquid component detection and provide accurate results for rapid identification of liquid components.
[0004] To achieve the above object, the present invention provides the following solutions:
[0005] On the one hand, a method for detecting liquid components in a plastic bottle is provided, comprising:
[0006] Sending data to a plastic bottle to be inspected that is filled with liquid, and receiving data that penetrates the plastic bottle to be inspected that is filled with liquid;
[0007] Acquire channel state information according to the received data;
[0008] Extracting the channel state information to obtain an amplitude vector and a similarity vector, and concatenating the amplitude vector and the similarity vector to obtain an input vector;
[0009] The input vector is input into a liquid component classification prediction model to obtain a liquid component detection result, wherein the liquid component classification prediction model is constructed based on a neural network and is obtained through training based on a training set, and the training set includes channel state information of different liquid components.
[0010] Optionally, sending data to a plastic bottle to be detected that contains liquid, and receiving data that penetrates the plastic bottle to be detected that contains liquid includes:
[0011] A ping data packet is sent to the plastic bottle containing liquid to be detected via a WiFi device transmitter, and a WiFi device receiver identifies the ping data packet to obtain a pilot symbol of the physical layer and the ping data packet, wherein the pilot symbol is sent to a wireless channel via an antenna during the process of sending the ping data packet.
[0012] Optionally, obtaining channel state information according to the received data includes:
[0013] The sequence number of the ping data packet sent by the WiFi device transmitter is obtained, the ping data packets with disordered sequence numbers are discarded, the continuous data packets are saved and the data packets with discontinuous sequence numbers are saved within a preset range, and the channel state information is obtained, wherein the channel state information is two-dimensional data of time series.
[0014] Optionally, extracting the channel state information to obtain the amplitude vector and the similarity vector includes:
[0015] Performing non-zero judgment on each sub-channel information in the channel state information, and acquiring sub-channel data with non-zero data value;
[0016] Extracting the real part and the imaginary part of the sub-channel data with non-zero data values to obtain the amplitude vector;
[0017] The cosine similarity between the sub-channel data with non-zero data values is calculated to obtain the similarity vector.
[0018] Optionally, the liquid component classification prediction model includes: an LSTM long short-term memory network, a first fully connected layer, a flattening layer, a second fully connected layer, and an output classification layer;
[0019] Among them, the LSTM long short-term memory network performs feature extraction on the input vector to obtain associated features, inputs the associated features into the first fully connected layer to obtain overall features, inputs the overall features into the flattening layer for feature compression, inputs the compressed overall features into the second fully connected layer, and the second fully connected layer maps the compressed overall features to the output classification layer to obtain the liquid component detection result.
[0020] On the other hand, a plastic bottle liquid composition detection device is provided, including a wifi signal transceiver and a smart terminal;
[0021] The wifi signal transceiver device is used to place a plastic bottle to be detected containing liquid between the wifi signal transceiver devices to send data and receive data that penetrates the plastic bottle to be detected containing liquid;
[0022] The intelligent terminal is used to obtain channel state information based on received data, extract the channel state information, obtain an amplitude vector and a similarity vector, concatenate the amplitude vector and the similarity vector, obtain an input vector, input the input vector into a liquid component classification prediction model, and obtain a liquid component detection result, wherein the liquid component classification prediction model is constructed based on a neural network and is obtained through training based on a training set, and the training set includes channel state information of different liquid components.
[0023] The beneficial effects of the present invention are as follows: the present invention provides a method and device for quickly detecting the liquid composition of a plastic bottle, firstly sending data to the plastic bottle to be detected containing liquid, and receiving data penetrating the plastic bottle to be detected containing liquid; secondly obtaining channel state information according to the received data; extracting the channel state information again, obtaining the amplitude vector and the similarity vector, splicing the amplitude vector and the similarity vector, obtaining the input vector; finally inputting the input vector into the liquid composition classification prediction model, obtaining the liquid composition detection result, wherein the liquid composition classification prediction model is constructed based on a neural network. When the present invention is capable of communicating, both parties use the channel state information in the channel communication to classify and identify the liquid composition; it can be used to detect components such as apple juice, Sprite, cola, water, alcohol, gasoline, etc., and obtain accurate prediction results through the pre-trained neural network model intelligent algorithm, so as to achieve the purpose of fast, contactless and low-cost detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 This is a flow chart of a method for detecting liquid components in a plastic bottle according to an embodiment of the present invention;
[0026] Figure 2 This is a schematic diagram of a plastic bottle liquid composition detection device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0028] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0029] Embodiment 1:
[0030] like Figure 1 As shown, this embodiment provides a method for detecting liquid components in a plastic bottle, comprising:
[0031] Send data to the plastic bottle to be tested that contains liquid, and receive data that penetrates the plastic bottle to be tested that contains liquid;
[0032] Acquire channel state information according to the received data;
[0033] Extract the channel state information, obtain the amplitude vector and the similarity vector, and concatenate the amplitude vector and the similarity vector to obtain the input vector;
[0034] The input vector is input into the liquid component classification prediction model to obtain the liquid component detection result, wherein the liquid component classification prediction model is constructed based on a neural network and is trained based on a training set, and the training set includes channel state information of different liquid components.
[0035] Specifically, when a wifi signal is sent from the transmitter to the receiver, the signal may reach the receiver through multiple paths, which may include direct, reflected, diffraction, and transmission paths. The signal arrival time, phase, amplitude, and frequency of each path may be different, which will lead to a superposition effect of the received signal. When a plastic bottle filled with liquid is placed between the transceiver, the amplitude, phase, and frequency of the propagating signal will change, which will be reflected in the channel response of each subcarrier channel received by the receiver. These changes are related to the composition of the liquid in the plastic bottle placed between the transceiver, and its impact can be established through modeling to establish a correlation, so that it can be analyzed and identified. At the same time, the neural network model intelligent algorithm is used for prediction to achieve the purpose of fast, contactless, and low-cost detection.
[0036] Among them, the method for obtaining the training set is to place the signal transceiver devices of the WiFi equipment at a distance of about 15 cm, place a plastic bottle filled with different liquids in the middle position of the WiFi signal transceiver used for sensing, and place it for 2-3 seconds. Use a computer or an intelligent terminal with a USB interface to connect the receiving device to receive ping data, pre-process the ping data, remove data with disordered receiving sequence numbers, incomplete data, and incorrect format, and then extract the CSI (channel state information) sub-channel data, remove invalid sub-channel data, take the sub-channel data with non-zero data values and extract it, obtain the amplitude vector and similarity vector, splice the amplitude vector and the similarity vector, and obtain the splicing vector including different liquid components as the training set.
[0037] Furthermore, sending data to the plastic bottle to be detected containing liquid, and receiving data penetrating the plastic bottle to be detected containing liquid include:
[0038] A ping data packet is sent to a plastic bottle to be tested containing liquid through the transmitting end of the WiFi device, and the receiving end of the WiFi device identifies the ping data packet and obtains the pilot symbol and the ping data packet of the physical layer. In the process of sending the ping data packet, the pilot symbol is sent to the wireless channel through the antenna.
[0039] The principle of the method of this embodiment is to use a wifi transceiver device for data transmission. WiFi communication uses orthogonal frequency division multiplexing modulation technology (OFDM). OFDM divides frequency resources into multiple subcarriers, and each subcarrier transmits independent data symbols. At the transmitting end, the wifi device performs channel estimation by sending pilot symbols. The pilot symbol is a known reference signal. The receiving end can estimate the channel response on each subcarrier in the propagation channel space by comparing the received pilot symbol with the known transmitted symbol.
[0040] Specifically, write the sender program and compile it into a binary file and burn it into the ESP32-S3 sender A. After power-on, it can automatically run to actively send ping broadcast packets. In this process, the device wifi driver and physical layer will automatically handle the generation and transmission of OFDM symbols, carry the pilot symbol modulation and send it to the wireless channel through the antenna. The automatic receiving program written on the receiving end B is compiled into a binary file and flashed into ESP32-S3, and automatically runs after power-on. The function of the receiving end B is to automatically receive broadcast data and identify broadcast data packets with the sending address A. In the communication process, the receiver demodulates the wireless channel to obtain the pilot symbols of the physical layer and the sent ping data packets. Through the special program written, the pilot symbols on the physical layer can be obtained on the receiving device to perform channel estimation and calculate the channel response.
[0041] Further, according to the received data, acquiring the channel state information includes:
[0042] Obtain the sequence number of the ping data packet sent by the WiFi device transmitter, discard the ping data packets with disordered sequence numbers, save the continuous data packets and save the data packets with discontinuous sequence numbers within a preset range, and obtain the channel state information, wherein the channel state information is two-dimensional data of time series.
[0043] Specifically, the complete channel response data (received data packet) is of fixed length. The automated program determines whether the channel response meets the fixed length, automatically discards erroneous data packets with incomplete data length, and performs a preprocessing process on complete data packets.
[0044] Preprocessing process: For each complete channel response data packet received, extract the packet sequence number sent by sender A in the communication, discard the packets with disordered sequence numbers, save the continuous data of the received data packets, and save the data with sequence numbers that are discontinuous within a certain range to form time-series CSI two-dimensional data.
[0045] Furthermore, extracting the channel state information to obtain the amplitude vector and the similarity vector includes:
[0046] Performing non-zero judgment on each sub-channel information in the channel state information, and obtaining sub-channel data with non-zero data values;
[0047] Extracting the real part and the imaginary part of the sub-channel data with non-zero data values to obtain an amplitude vector;
[0048] The cosine similarity between sub-channel data with non-zero data values is calculated to obtain a similarity vector.
[0049] Specifically, a non-zero determination is performed on each sub-channel in the stored CSI data, and the non-zero sub-channels are selected to form new valid CSI sub-channel data.
[0050] Extract the real and imaginary parts of the complex vector quantum channel data composed of effective CSI and calculate its amplitude. The complex vector is expressed as:
[0051] Y i =a i +b i j
[0052] Where i represents the i-th subchannel, a i represents its real part, b i represents its imaginary part. The expression for calculating its amplitude is Thus, a new two-dimensional vector V of the amplitude of each sub-channel is constructed.
[0053] V=[V0 V1 … V i … V m ]
[0054] Cosine similarity is used to describe the factors affecting the object to be detected between adjacent CSI channels. The calculation of cosine similarity includes:
[0055]
[0056] Among them, Y qi and Y q(i+1)are the vector complex values of the qth row, ith subchannel and the qth row, i+1th subchannel in the CSI data, respectively. j is the number of received time series data.
[0057] Through this calculation process, the column vector C corresponding to the cosine similarity expression of the original CSI data can be obtained.
[0058] C=[C0 C1 … C i … Cm]
[0059] C i =cos(θ) i
[0060] Among them, C i It represents the cosine similarity value between the i-th subchannel and the i+1-th subchannel.
[0061] The input vector I is obtained by concatenating the amplitude vector V and the similarity vector C by column, and is used as the input vector of the subsequent neural network classification model.
[0062] I=[V|C]
[0063] Furthermore, the neural network classification prediction model includes: LSTM long short-term memory network, first fully connected layer, flattening layer, second fully connected layer, output classification layer;
[0064] Among them, the LSTM long short-term memory network extracts features from the input vector, obtains associated features, inputs the associated features into the first fully connected layer, obtains overall features, inputs the overall features into the flattening layer for feature compression, and inputs the compressed overall features into the second fully connected layer. The second fully connected layer maps the compressed overall features to the output classification layer to obtain the liquid composition detection results.
[0065] Specifically, the aforementioned method obtains sensor data by collecting a large amount of plastic bottled apple juice, Sprite, Coke, water, alcohol, and gasoline, and trains the neural network classification prediction model. The neural network classification prediction model uses a hybrid model constructed by LSTM (Long Short-Term Memory Network) + the first fully connected layer + flattening layer + the second fully connected layer + output classification layer. LSTM is used for feature extraction of time series data, and can extract associated features for continuous channel state data in time, wherein the associated features include factors of each sub-channel affected by the components of the object to be measured, which are related to amplitude, frequency, and phase, and are directly associated with the components of the object to be measured. The first fully connected layer further abstracts the features to obtain overall features, which reflect the comprehensive influence factors of the components of the object to be measured on amplitude, frequency, and phase, and reflect the comprehensive influence on all sub-channels of CSI. The flattening layer is used to further compress the features, and the second fully connected layer is used to map the features to an output layer with multiple output nodes, each node corresponding to a classification. The output layer is used to perform classification discrimination tasks, and finally forms a model M for classification prediction.
[0066] Embodiment 2:
[0067] A plastic bottle liquid component detection device, including a wifi signal transceiver and an intelligent terminal;
[0068] A wifi signal transceiver device is used to send data to a plastic bottle to be detected that is filled with liquid and is fixedly placed in a position area between wifi signal transceivers, and receive data that penetrates the plastic bottle to be detected that is filled with liquid;
[0069] The intelligent terminal is used to obtain channel state information according to received data, extract the channel state information, obtain an amplitude vector and a similarity vector, concatenate the amplitude vector and the similarity vector, obtain an input vector, input the input vector into a liquid component classification prediction model, and obtain a liquid component detection result, wherein the liquid component classification prediction model is constructed based on a neural network and obtained through training based on a training set, and the training set includes channel state information of different liquid components.
[0070] The principle is that the device first obtains CSI data, and the data is preprocessed to remove data with disordered receiving sequence numbers, incomplete data, and incorrect formats. Then, the data of each CSI subchannel is extracted, invalid subchannel data is removed, and CSI subchannel data with non-zero data values is taken. The valid subchannel data is processed in two steps. The first step is to extract the complex value of the valid CSI subchannel to calculate its amplitude V, and at the same time calculate the cosine similarity value C of the data between the valid subchannels. In the second step, the amplitude V and the cosine similarity vector C in the previous step are spliced into a new vector I. Then the synthesized new vector I is used as the data input of the neural network model to construct the classification training of the LSTM (long-term and short-term time series data prediction neural network) neural network model, and the trained neural network model M that can measure solutions of various different components is obtained. The data obtained by the wifi device is sent to the model M in real time for classification, recognition and judgment to obtain accurate recognition results.
[0071] The component detection device in this embodiment also includes a power supply for supplying power to the WiFi signal transceiver device.
[0072] The liquid component detection achieved by the above device includes: Figure 2 As shown, the distance between the WiFi signal transceiver devices is about 15 cm. Using the detection equipment and related algorithms, place the plastic bottle containing the above liquid in the middle position of the WiFi signal transceiver used for sensing, leave it there for 2-3 seconds, and use a computer or an intelligent terminal with a USB interface to connect the receiving device to receive data and run the measurement and analysis algorithm. The analysis and detection algorithm automatically gives the possible measurement results of the components, and the accuracy of the detection results can reach more than 90%.
[0073] This embodiment uses two embedded wifi devices ESP32-S3 to perform wifi broadcast communication, so that one party can send ping data packets for a long time, and the other party can receive data packets. The receiving end extracts the wifi signal strength information transmitted by the transmitter and parses it into wifi CSI data. CSI data is a combination of multiple sub-channel data of wifi channel state information composed of signal strengths of transmitted signals in different frequency bands in the propagation wireless channel space. By using the characteristics that electromagnetic waves will change the amplitude, phase, and frequency of the original signal in different frequency bands when penetrating liquids of different components, causing characteristic changes, a set of artificial intelligence neural network models is established to identify liquids of different components in plastic bottles. The characteristics of the influence of different solutions on the amplitude, phase, and different frequency bands of the propagation signal are classified and identified, so as to realize non-contact rapid detection of different solutions, which not only has low detection cost, but also short detection time and high detection efficiency. At the same time, the overall detection device has a simple structure and good portability.
[0074] The embodiments described above are only descriptions of the preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Without departing from the design spirit of the present invention, various modifications and improvements made to the technical solutions of the present invention by ordinary technicians in this field should all fall within the protection scope determined by the claims of the present invention.
Claims
1. A method for detecting liquid components in plastic bottles, characterized in that: include: Sending data to a plastic bottle to be inspected that is filled with liquid, and receiving data that penetrates the plastic bottle to be inspected that is filled with liquid; Acquire channel state information according to the received data; Extracting the channel state information to obtain an amplitude vector and a similarity vector, and concatenating the amplitude vector and the similarity vector to obtain an input vector; The input vector is input into a liquid component classification prediction model to obtain a liquid component detection result, wherein the liquid component classification prediction model is constructed based on a neural network and is obtained through training based on a training set, and the training set includes channel state information of different liquid components.
2. The method for detecting liquid components in plastic bottles according to claim 1, characterized in that: Sending data to a plastic bottle to be detected that is filled with liquid, and receiving data that penetrates the plastic bottle to be detected that is filled with liquid include: A ping data packet is sent to the plastic bottle containing liquid to be detected via a WiFi device transmitter, and a WiFi device receiver identifies the ping data packet to obtain a pilot symbol of the physical layer and the ping data packet, wherein the pilot symbol is sent to a wireless channel via an antenna during the process of sending the ping data packet.
3. The method for detecting liquid components in plastic bottles according to claim 2, characterized in that: According to the received data, obtaining the channel state information includes: The sequence number of the ping data packet sent by the WiFi device transmitter is obtained, the ping data packets with disordered sequence numbers are discarded, the continuous data packets are saved and the data packets with discontinuous sequence numbers are saved within a preset range, and the channel state information is obtained, wherein the channel state information is two-dimensional data of time series.
4. The method for detecting liquid components in plastic bottles according to claim 1, characterized in that: Extracting the channel state information to obtain an amplitude vector and a similarity vector includes: Performing non-zero judgment on each sub-channel information in the channel state information, and acquiring sub-channel data with non-zero data value; Extracting the real part and the imaginary part of the sub-channel data with non-zero data values to obtain the amplitude vector; The cosine similarity between the sub-channel data with non-zero data values is calculated to obtain the similarity vector.
5. The method for detecting liquid components in plastic bottles according to claim 1, characterized in that: The liquid composition classification prediction model includes: an LSTM long short-term memory network, a first fully connected layer, a flattening layer, a second fully connected layer, and an output classification layer; Among them, the LSTM long short-term memory network performs feature extraction on the input vector to obtain associated features, inputs the associated features into the first fully connected layer to obtain overall features, inputs the overall features into the flattening layer for feature compression, inputs the compressed overall features into the second fully connected layer, and the second fully connected layer maps the compressed overall features to the output classification layer to obtain the liquid component detection result.
6. The detection device of the method for detecting liquid components in plastic bottles according to any one of claims 1 to 5, characterized in that: Including wifi signal transceiver and smart terminal; The wifi signal transceiver device is used to send data to the plastic bottle to be detected containing liquid placed between the wifi signal transceiver devices, and receive data that penetrates the plastic bottle to be detected containing liquid; The intelligent terminal is used to obtain channel state information according to the received data, extract the channel state information, obtain an amplitude vector and a similarity vector, concatenate the amplitude vector and the similarity vector, obtain an input vector, and input the input vector into a liquid component classification prediction model. Obtaining liquid component detection results, wherein the liquid component classification prediction model is constructed based on a neural network, The training set is obtained based on training, and the training set includes channel state information of different liquid components.
Citation Information
Patent Citations
Method and device for measuring complex dielectric constant of liquid based on Wi-Fi signals
CN112595898A
Non-contact liquid component identification model training method, identification method, system and device
CN117056794A
Liquid material identification method based on RFID passive perception and machine learning
CN117633645A
Liquid type detection method and device based on acoustic perception and medium
CN117890461A
Method and device for analyzing measured signal
CN1475799A