CN111811617B - Liquid level prediction method based on short-time Fourier transform and convolutional neural network - Google Patents
Liquid level prediction method based on short-time Fourier transform and convolutional neural network Download PDFInfo
- Publication number
- CN111811617B CN111811617B CN202010660942.8A CN202010660942A CN111811617B CN 111811617 B CN111811617 B CN 111811617B CN 202010660942 A CN202010660942 A CN 202010660942A CN 111811617 B CN111811617 B CN 111811617B
- Authority
- CN
- China
- Prior art keywords
- neural network
- convolutional neural
- layer
- liquid level
- convolution
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01F—MEASURING VOLUME, VOLUME FLOW, MASS FLOW OR LIQUID LEVEL; METERING BY VOLUME
- G01F23/00—Indicating or measuring liquid level or level of fluent solid material, e.g. indicating in terms of volume or indicating by means of an alarm
- G01F23/22—Indicating or measuring liquid level or level of fluent solid material, e.g. indicating in terms of volume or indicating by means of an alarm by measuring physical variables, other than linear dimensions, pressure or weight, dependent on the level to be measured, e.g. by difference of heat transfer of steam or water
- G01F23/28—Indicating or measuring liquid level or level of fluent solid material, e.g. indicating in terms of volume or indicating by means of an alarm by measuring physical variables, other than linear dimensions, pressure or weight, dependent on the level to be measured, e.g. by difference of heat transfer of steam or water by measuring the variations of parameters of electromagnetic or acoustic waves applied directly to the liquid or fluent solid material
- G01F23/296—Acoustic waves
- G01F23/2966—Acoustic waves making use of acoustical resonance or standing waves
Landscapes
- Physics & Mathematics (AREA)
- Acoustics & Sound (AREA)
- Electromagnetism (AREA)
- Thermal Sciences (AREA)
- Fluid Mechanics (AREA)
- General Physics & Mathematics (AREA)
- Measurement Of Levels Of Liquids Or Fluent Solid Materials (AREA)
Abstract
The invention discloses a non-contact liquid level prediction method based on a convolutional neural network. The method comprises the steps of firstly, obtaining a resonance wave data set required by an experiment through an acoustic resonance liquid level measuring instrument. And secondly, performing short-time Fourier transform on the time domain data set, and converting the one-dimensional time domain waveform signal into a two-dimensional frequency spectrum pattern form to be used as the input of the convolutional neural network. Then, a regression model is constructed based on the convolutional neural network, the mean square error is selected as a loss function, and an Adam function is selected as an optimization algorithm. And finally, inputting the training set into the constructed convolutional neural network model for modeling, and then inputting the test set into the trained convolutional neural network model to obtain the predicted liquid level height. The method realizes the mapping process from the original data to the task target by constructing a convolution neural network regression model; by iterative optimization of model parameters, the generalization capability of the convolutional neural network model and the accuracy of a prediction result are improved.
Description
Technical Field
The invention belongs to the field of deep learning, and designs a liquid level prediction method based on short-time Fourier transform and a convolutional neural network.
Background
The liquid level is a kind of level, and refers to the height of the liquid level in a closed container or an open container. Level measurement is a method of determining the level height, primarily by detecting the characteristic properties of the material on either side of the level, or the changes in some of the same physical parameters (e.g., resistance, capacitance, pressure differential, speed of sound, optical energy, etc.) during propagation. Depending on whether or not the measuring device is in contact with the liquid to be measured, there are classified into a contact measuring method and a non-contact measuring method. Common non-contact measuring methods include radar, laser, ultrasonic and other measuring methods
(1) The liquid level measuring method based on ultrasonic reflection comprises the following steps: the characteristics of good directivity, easy operation, etc. become one of the most common methods. The measuring principle is that ultrasonic waves are transmitted to the liquid level and echoes are received, and the distance from the liquid level to the sound wave receiving device is calculated by multiplying the sound velocity by the time of the round-trip range. However, in actual industrial application, foreign substances such as foam, residue and sediment are often generated on the surface of the liquid to be measured. When the ultrasonic waves encounter the obstacles, parasitic reflection easily occurs, and a propagation path is changed, so that the measurement effect is seriously influenced, and the measurement precision of the ultrasonic waves is greatly reduced.
(2) Based on the low frequency sound wave wavelength method: the low-frequency sound wave has longer wavelength and can be diffracted when meeting the obstacle, namely, the sound wave can bypass the obstacle to continue to propagate, and parasitic reflection is avoided. Based on the Resonance principle of low-Frequency sound waves, the liquid level height is converted from the initial Resonance Frequency (Resonance Frequency RF), and a better measuring effect is obtained. However, the maximum range of this method depends on the initial RF, while the minimum value of the frequency is limited by factors such as the speaker principle, type, sound source volume and mass, and is typically only 20 Hz. If the measurement is carried out under the standard sound velocity c of 331.45m/s, the maximum range is only 8.28 m. Moreover, the sensitivity of the microphone is higher, and the lowest audio frequency which can be sensed by the microphone is about 20Hz, which greatly limits the application of the method in long-distance measurement.
(3) In order to solve the problem of limited measuring distance in the low-frequency sound wave resonance measuring method, the liquid level measuring method based on the fixed frequency band sound wave resonance changes the emitted low-frequency sound wave signal into a frequency sweeping signal of a fixed frequency band. The improved method does not need to extract basic resonance frequency points, instead extracts a series of resonance frequency points, and converts the distance between the measuring device and the liquid level according to the difference value of adjacent resonance frequency points. In the liquid level prediction method based on acoustic resonance, a large amount of irrelevant original data is deleted in the characteristic extraction process such as extraction, and the calculation amount is reduced. However, the artificial set feature extraction is only to analyze data information from one angle of the signal, the method may obtain relatively optimal features, many original information is abandoned, and in a noisy environment, the problem of multiple selection or omission of resonance points occurs, so that the liquid level measurement accuracy is greatly reduced.
In recent years, deep learning is widely applied to the fields of image processing and natural language processing, an end-to-end learning method is the most important aspect of distinguishing other algorithms, the whole learning process is not divided into artificial subproblems, but the whole learning process is completely handed to a deep learning model to directly learn mapping from original input to expected output, and a global optimal solution is more likely to be obtained.
Disclosure of Invention
Aiming at the defects in the prior art, the invention provides a liquid level prediction method based on short-time Fourier transform and a convolutional neural network.
The invention comprises the following steps:
step (1) acquiring a data set
The data used by the invention are acquired by an acoustic resonance liquid level measuring instrument (liquid level instrument for short), a loudspeaker of the measuring system of the equipment sends out sine waves of 1000 to 2500Hz, and a microphone acquires and transmits back resonance waves in real time and stores the resonance waves. And selecting complete and undisturbed sound wave data from the measured liquid level database, and taking the corresponding measurement length as a data tag.
Step (2) feature extraction
Carrying out short-time Fourier transform on 5000 groups of collected original signals to convert one-dimensional time domain waveform signals into a time-frequency domain spectrogram form of two-dimensional data; the mathematical formula for the short-time fourier transform (STFT) is as follows:
where y (n) is an audio signal, g (n) is a window function, f is frequency, t is time, e, π are respectively a natural logarithm base and a circumference ratio, both of which are constants.
Step (3) constructing a convolutional neural network
The invention builds a three-layer convolution neural network regression model; adam is selected as an optimization algorithm, and mean square error MSE is selected as a loss function.
Each layer of the built convolutional neural network model comprises a convolutional layer, a pooling layer and a nonlinear activation layer. The convolution kernel size of the convolution layer Conv1 of the first layer of the convolution neural network is 5 multiplied by 5, the number of channels is 6, the step length is 1, the maximum pooling layer kernel size is 2, and the step length is 1; the convolution kernel size of the convolution layer Conv2 of the second layer of convolution neural network is 5 × 5, the step size is 1, the number of channels is 16, the maximum pooling layer kernel size is 2, and the step size is 1; the convolution kernel size of the convolution layer Conv3 of the third layer of the convolution neural network is 5 multiplied by 5, the step length is 1, the number of channels is 120, the maximum value pooling layer kernel size is 2 multiplied by 2, the step length is 1, and the number of hidden nodes of the full-connection layer Fc1 is 120; the number of hidden nodes of the full connection layer Fc2 is 84; the number of hidden nodes of the full-link layer Fc3 is 1.
Step (4) training and evaluating of convolutional neural network
The collected 5000 groups of data sets are divided into a training set, a verification set and a test set according to the ratio of 8:1: 1. Firstly, inputting training set data into the model established in step 3, then inputting a test set into the trained convolutional neural network, and outputting the predicted liquid level height.
Adam is an extension of the optimization algorithm, which is a stochastic gradient descent method, that can iteratively update the network weights based on training data. In recent years, the algorithm is widely applied to the field of deep learning, especially to tasks such as computer vision and natural language processing. Therefore, the Adam algorithm is selected as the optimization algorithm of the invention.
In machine learning, a loss function (loss function) is used for estimating the degree of inconsistency between a predicted value and a true value of a model, and the smaller the loss function is, the better the robustness of the model is generally represented, and the loss function is used for guiding the learning of model parameters.
The invention selects the mean square error as a loss function, which is the mean of the sum of squares of the difference between the predicted value and the label, and the formula is as follows:
wherein y isiThe sample label of the i-th sample,is a predicted value and n represents the total number of samples.
From the above evaluation results, a convolutional neural network that takes into account both the prediction error and the network complexity (parameters and calculation amount) is preferable as the final model.
The invention has the beneficial effects that: the method adopts a fixed frequency band acoustic resonance liquid level prediction method, can enlarge the liquid level measurement range, and converts each audio signal into a two-dimensional frequency domain through short-time Fourier transform to be used as the input of a convolutional neural network; the method comprises the steps of realizing the mapping process from original data to task targets by constructing a convolutional neural network regression model; by iterative optimization of model parameters, the generalization capability of the convolutional neural network model and the accuracy of a prediction result are improved.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2. liquid level prediction system based on acoustic resonance principles;
FIG. 3 is a waveform diagram and a time-frequency diagram of a time domain collected by a microphone;
figure 4 training loss curve.
Detailed Description
The invention will be further described with reference to the accompanying drawings.
Each step of the method is described in detail according to the algorithm flow chart shown in fig. 1, in combination with the actual measurement environment and the liquid level measurement example.
Step 1: obtaining data
A prediction model data set is constructed on the acoustic resonance liquid level measuring device, as shown in fig. 2, a loudspeaker plays a sine wave of a fixed frequency band, and a microphone collects resonance wave data and stores the data in a memory card arranged in a processor. In the experiment, audio data with labels of 0.6m, 0.8m and 1.0m … … 10.4.4 m are collected, and each label collects 5000 groups of data in total as a data set, wherein 100 groups of data are collected. Filtering processing such as Gaussian average filtering, median filtering and the like can be carried out on the original one-dimensional time domain waveform signal, and then min-max normalization processing is carried out.
Step 2: feature extraction
And (3) according to the prior knowledge and expert experience of the related field, performing short-time Fourier transform (STFT) processing on the original signal, and converting the one-dimensional time domain waveform signal processed in the step (1) into a spectrogram form of a time-frequency domain with a two-dimensional structure. And extracting features such as mean feature, variance feature and integral feature of the spectrogram, which can reflect the characteristics of the frequency domain signal. The mathematical formula for the short-time fourier transform (STFT) is as follows:
where y (n) is an audio signal and g (n) is a window function. f is frequency, t is time, e, pi are natural logarithm base number and circumferential ratio, respectively, both of which are constants. Fig. 3 shows a time-domain waveform diagram of a microphone with a label of 10 and a time-frequency diagram after short-time fourier transform.
And step 3: building convolutional neural network model
And establishing a three-layer convolutional neural network model. The structure of the designed convolutional neural network and its hyper-parameters are shown in table 1.
Table 1: CNN network architecture
Where "f" represents the convolution kernel, "s" is the step size, and "p" is the fill parameter.
And 4, step 4: training and optimization of convolutional neural networks
(1) And (3) training and optimizing the convolutional neural network under the deep learning framework of the pitorch by using the data set obtained in the step (2) to obtain a convolutional neural network model capable of predicting the liquid level height. In this embodiment, the height of the liquid level is a continuous value, so a regression model based on a convolutional neural network is constructed. And the difference between the predicted value and the actual value of Mean Square Error (MSE) is adopted.
(2) The neural network trains and tests the generated data set, and the evaluation of the effect of deep learning mainly depends on a training loss curve and a correct rate curve. Fig. 4 is a training loss function curve for 20 iterations with a learning rate of 0.001.
(3) Evaluation and improvement of deep convolutional neural network
And evaluating the performance of the deep convolutional neural network model based on the classification accuracy.
And adjusting model hyper-parameters (the number of convolution layers, the number of convolution kernels, the type of a nonlinear activation function, the learning rate and the like), retraining the model and evaluating the performance of the model.
According to the evaluation result, a structure which gives consideration to both accuracy and network complexity (parameter number and calculated amount) is selected as a final model, and model representation capability and generalization capability are improved. Table 2 shows five sets of data randomly selected from the training set and the predicted results are output, and table 3 shows five sets of data randomly selected from the testing set and the predicted results are output.
Table 2: training set prediction results
Table 3: test set prediction results
Claims (1)
1. A liquid level prediction method based on short-time Fourier transform and a convolutional neural network is characterized by comprising the following steps:
step (1) of acquiring a data set
Carrying out data acquisition through an acoustic resonance liquid level measuring instrument; the loudspeaker of the liquid level measuring instrument emits 1000-2500 Hz sine waves, and the microphone collects and transmits back resonance waves in real time and stores the resonance waves; selecting thousands of complete and undisturbed resonance waves from the measured resonance wave data, and taking the corresponding measurement length as a data label so as to construct a data set;
step (2) of feature extraction
Performing short-time Fourier transform on all groups of resonance wave signals of the data set, and converting one-dimensional time domain waveform signals into a two-dimensional frequency spectrum graph form;
step (3) of constructing a convolutional neural network
Building a three-layer convolutional neural network model; selecting Adam as an optimization algorithm and MSE as a target function;
each layer of the built convolutional neural network model comprises a convolutional layer, a pooling layer and a nonlinear activation layer;
the convolution kernel size of the first layer of convolution neural network convolution layer Conv1 is 5 × 5, the number of channels is 6, the step length is 1, the maximum pooling layer kernel size is 2, and the step length is 1;
the convolution kernel size of the convolution layer Conv2 of the second layer of convolution neural network is 5 × 5, the step size is 1, the number of channels is 16, the maximum pooling layer kernel size is 2, and the step size is 1;
the convolution kernel size of the convolution layer Conv3 of the third layer of the convolution neural network is 5 multiplied by 5, the step length is 1, the number of channels is 120, the maximum value pooling layer kernel size is 2 multiplied by 2, the step length is 1,
the number of hidden nodes of the full connection layer Fc1 is 120; the number of hidden nodes of the full connection layer Fc2 is 84; the number of hidden nodes of the full-link layer Fc3 is 1.
Step (4) training and evaluating of convolutional neural network
Dividing all data in the data set into a training set, a verification set and a test set according to the ratio of 8:1: 1; inputting the training set data into the model established in the step 3, evaluating the model trained on the basis of the test set by the verification set, inputting the test set into the trained convolutional neural network, and outputting the predicted liquid level height.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010660942.8A CN111811617B (en) | 2020-07-10 | 2020-07-10 | Liquid level prediction method based on short-time Fourier transform and convolutional neural network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010660942.8A CN111811617B (en) | 2020-07-10 | 2020-07-10 | Liquid level prediction method based on short-time Fourier transform and convolutional neural network |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111811617A CN111811617A (en) | 2020-10-23 |
CN111811617B true CN111811617B (en) | 2022-06-14 |
Family
ID=72842242
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010660942.8A Active CN111811617B (en) | 2020-07-10 | 2020-07-10 | Liquid level prediction method based on short-time Fourier transform and convolutional neural network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111811617B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112649065B (en) * | 2020-12-22 | 2024-08-20 | 上海海能信息科技股份有限公司 | Method and device for acquiring liquid level value based on metallurgical eddy current liquid level signal |
CN112580588B (en) * | 2020-12-29 | 2024-01-12 | 西北工业大学 | Intelligent flutter signal identification method based on empirical mode decomposition |
CN113033894B (en) * | 2021-03-24 | 2023-05-02 | 南方电网数字电网研究院有限公司 | Daily electricity quantity prediction method, device, computer equipment and storage medium |
CN113361819B (en) * | 2021-07-08 | 2023-04-07 | 武汉中科牛津波谱技术有限公司 | Linear prediction method and device |
CN113607097B (en) * | 2021-08-06 | 2023-02-17 | 浙江大学 | Scouring depth monitoring device and method based on acoustic test |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10650806B2 (en) * | 2018-04-23 | 2020-05-12 | Cerence Operating Company | System and method for discriminative training of regression deep neural networks |
CN109444863A (en) * | 2018-10-23 | 2019-03-08 | 广西民族大学 | A kind of estimation method of the narrowband ultrasonic echo number based on convolutional neural networks |
CN110866448A (en) * | 2019-10-21 | 2020-03-06 | 西北工业大学 | Flutter signal analysis method based on convolutional neural network and short-time Fourier transform |
CN111220958B (en) * | 2019-12-10 | 2023-05-26 | 西安宁远电子电工技术有限公司 | Radar target Doppler image classification and identification method based on one-dimensional convolutional neural network |
-
2020
- 2020-07-10 CN CN202010660942.8A patent/CN111811617B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN111811617A (en) | 2020-10-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111811617B (en) | Liquid level prediction method based on short-time Fourier transform and convolutional neural network | |
CN105929024B (en) | Concrete defect intellectualized detection and quantitative identification method | |
US11855265B2 (en) | Acoustic signal based analysis of batteries | |
CN106990018B (en) | A kind of prestressed concrete beam Grouted density intelligent identification Method | |
CN106537136A (en) | Virtual multiphase flow metering and sand detection | |
CN117007681B (en) | Ultrasonic flaw detection method and system | |
CN111982271A (en) | phi-OTDR pattern recognition system and method based on Wavenet | |
Yoon et al. | Deep learning-based high-frequency source depth estimation using a single sensor | |
CN108646248A (en) | A kind of passive acoustics for low-speed motion sound source tests the speed distance measuring method | |
CN116741148A (en) | Voice recognition system based on digital twinning | |
CN113468804B (en) | Underground pipeline identification method based on matrix bundles and deep neural network | |
CN117309079B (en) | Ultrasonic flying time measuring method, device, equipment and medium based on time difference method | |
Khurjekar et al. | Sim-to-real localization: Environment resilient deep ensemble learning for guided wave damage localization | |
Mercado et al. | Classification of humpback whale vocalizations using a self-organizing neural network | |
Shpigler et al. | Detection of overlapping ultrasonic echoes with deep neural networks | |
CN110779477B (en) | Acoustic method for identifying shape of object in real time | |
Feng | Condition Classification in Underground Pipes Based on Acoustical Characteristics. Acoustical characteristics are used to classify the structural and operational conditions in underground pipes with advanced signal classification methods | |
CN110991507A (en) | Road underground cavity identification method, device and system based on classifier | |
Singh et al. | Audio tagging using linear noise modelling layer | |
Li et al. | Sparse Bayesian learning for horizontal wavenumber retrieval in underwater acoustical signal processing | |
CN111007464B (en) | Road underground cavity identification method, device and system based on optimal weighting | |
CN110806444B (en) | Seabed sediment recognition and classification method based on shallow stratum profiler and SVM | |
CN102193082A (en) | Device for positioning leak source of three-sensor multi-scale constrained pipe network | |
Liew et al. | Pattern recognition of guided waves for damage evaluation in bars | |
Zhang | Flow measurement of natural gas in pipeline based on 1d-convolutional neural network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |