A method for measuring alcohol content online

Through image processing technology and U-Net model segmentation of alcohol meter images, the problems of high cost, complex maintenance and environmental impact of traditional alcohol measurement technology are solved, and low-cost and high-precision online measurement of alcohol is achieved.

CN118566223BActive Publication Date: 2025-01-14SUPCON TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410815632.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2025-01-14
Estimated Expiration
2044-06-24

AI Technical Summary

Technical Problem

Traditional alcohol measurement technology has high costs, large maintenance requirements, insufficient automation and data processing, and is susceptible to environmental impact, resulting in unstable and inaccurate measurement results.

Method used

Image processing technology and U-Net model are used to segment the alcohol meter images to detect the alcohol content of the alcohol solution in real time, and calculate the alcohol content through pre-established correspondence tables and formulas to reduce noise and improve image acquisition quality.

Benefits of technology

It improves the accuracy and operational ease of alcohol meter readings, reduces cost and maintenance complexity, and is suitable for application scenarios with low cost and high precision requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118566223B_ABST
    Figure CN118566223B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of automated testing and measurement technology, and in particular to an online alcohol content measurement method, which includes: obtaining a first original image through a pre-set image acquisition device, the first original image including the area where the alcohol meter is located; inputting the first original image into a pre-trained U-Net model to obtain a second segmented image that segments the alcohol meter above the alcohol solution liquid surface and below the liquid surface; according to the second segmented image, obtaining the pixel lengths of the alcohol meter above the alcohol solution liquid surface and below the liquid surface in the second segmented image in the vertical direction; according to the pixel lengths of the alcohol meter above the alcohol solution liquid surface and below the liquid surface in the vertical direction, and a pre-established correspondence table, obtaining the alcohol content of the current alcohol solution. Its beneficial effect is that the image is processed using image processing technology and segmentation models, which effectively improves the accuracy of the alcohol meter reading and the convenience of operation compared to the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of automated testing and measurement, and in particular to an online alcohol content measurement method. Background Art

[0002] As the demand for accurate alcohol measurement grows in industrial processes, laws and regulations, and health monitoring, traditional alcohol measurement technology has shown limitations in accuracy, ease of operation, and environmental adaptability. Existing alcohol meters often require professional operation, and their readings are easily affected by environmental conditions such as temperature, pressure, and light intensity, resulting in unstable measurement results. For example, manual alcohol meter readings are easily affected by human errors, and readings in complex environments are not accurate; density-based alcohol measurement methods may be affected by temperature changes, and the measurement results are usually not stable or accurate enough; and spectral analysis equipment is often expensive and complicated to operate, which is not suitable for all application scenarios, especially for occasions that require portability and cost. Electrochemical sensor sensors may be interfered with by environmental pollutants and require regular calibration, which increases the complexity and cost of maintenance. In addition, traditional methods also have shortcomings in the automation of readings and data processing, which limits their effectiveness in modern applications with fast pace and high precision requirements.

[0003] Therefore, an online alcohol content measurement method is proposed, which can ensure the accuracy and practicality of real-time alcohol content measurement while ensuring low cost and easy maintenance. Summary of the invention

[0004] 1. Technical issues to be resolved

[0005] In view of the above-mentioned shortcomings and deficiencies of the prior art, the present invention provides an online alcohol content measurement method, which solves the technical problems of the traditional alcohol content measurement method, such as high cost and maintenance requirements, deficiencies in automation and data processing, and susceptibility to environmental influences.

[0006] (II) Technical solution

[0007] In order to achieve the above object, the main technical solutions adopted by the present invention include:

[0008] In a first aspect, an embodiment of the present invention provides an online alcohol content measurement method, which is applied to real-time detection of the alcohol content of a solution during wine picking, and the method comprises:

[0009] S11, acquiring a first original image through a preset image acquisition device, wherein the first original image includes an area where the alcohol meter is located;

[0010] S12, inputting the first original image into a pre-trained U-Net model to obtain a second segmented image that segments the alcohol meter above the alcohol solution liquid surface and below the liquid surface;

[0011] S13, according to the second segmented image, obtaining the pixel lengths in the vertical direction of the alcohol meter above the alcohol solution liquid surface and below the liquid surface in the second segmented image;

[0012] S14. Obtain the alcohol content of the current alcohol solution according to the vertical pixel lengths of the alcohol meter above the alcohol solution liquid surface and below the liquid surface, and a pre-established correspondence table; the correspondence table is a relationship table in which the relative position of any scale on the alcohol meter has a one-to-one correspondence between the alcohol content and the position and the scale.

[0013] Optionally, the S11 includes:

[0014] S11-1, acquiring a third process image through a preset image acquisition device, wherein the third process image includes a transparent alcohol container containing an alcohol solution and an alcohol meter disposed inside the alcohol container;

[0015] S11-2, reducing random noise in the third process image according to a preset Gaussian blur algorithm, and adjusting the brightness and contrast of the third process image by histogram equalization;

[0016] S11-3, cropping and scaling the adjusted third process image to generate a first original image that only includes the area where the alcohol meter is located.

[0017] Optionally, the S14 includes:

[0018] S14-1, obtaining the relative position of the alcohol solution surface on the alcohol meter according to the pixel lengths in the vertical direction of the portion of the alcohol meter above the alcohol solution surface and the portion below the alcohol solution surface in the second segmented image;

[0019] S14-2, traversing the correspondence table, and determining whether there is a scale in the correspondence table that is the same as the relative position of the alcohol solution level on the alcohol meter;

[0020] If it exists, the alcohol content corresponding to the scale with the same relative position of the alcohol solution surface on the alcohol meter is used as the alcohol content of the current solution;

[0021] The corresponding relationship table is:

[0022] ;

[0023] Among them, P b is the relative position of any alcohol meter scale on the alcohol meter, A bThis is the alcohol content corresponding to this scale.

[0024] Optionally, the S14-2 further includes:

[0025] If it does not exist, the corresponding relationship table is traversed to obtain the relative positions of the two scales closest to the relative position of the alcohol solution surface on the alcohol meter, and the alcohol content of the current solution is obtained according to a preset formula 1; the formula 1 is:

[0026] ;

[0027] Among them, A c is the alcohol content of the current solution, P c is the relative position of the alcohol solution surface on the alcohol meter, P i and P j is the relative position of the two scales on the alcohol meter that are closest to the relative position of the alcohol solution surface on the alcohol meter in the corresponding relationship table, A i and A j P i and P j The corresponding alcohol content.

[0028] Optionally, the S14-1 includes:

[0029] According to the pixel lengths of the alcohol meter above the alcohol solution liquid surface and below the liquid surface in the vertical direction in the second segmented image and the preset formula 2, the relative position of the alcohol solution liquid surface on the alcohol meter is obtained;

[0030] The formula 2 is:

[0031] ;

[0032] Among them, P c is the relative position of the alcohol solution surface on the alcohol meter, L u and L d are respectively the pixel lengths in the vertical direction of the part of the alcohol meter above the alcohol solution liquid surface and the part below the liquid surface in the second segmented image; is the preset distortion coefficient.

[0033] Optionally, the S12 includes:

[0034] S12-1, inputting the first original image into a pre-trained U-Net model to obtain a fourth process image indicating the probability that each pixel belongs to the background part, the part of the alcohol meter above the liquid surface, or the part of the alcohol meter below the liquid surface;

[0035] S12-2. Obtain a second segmented image according to a preset probability threshold and the probability that each pixel in the fourth process image belongs to the background part, the part of the alcohol meter above the liquid surface, or the part of the alcohol meter below the liquid surface.

[0036] Optionally, before S11, the step further includes:

[0037] S01. Use a pre-established first training set to train the U-Net model according to a pre-set number of iterations to obtain a trained U-Net model, wherein the first training set includes at least one pre-processed labeled image, and the labeled image is an image of the alcohol meter above the liquid surface and below the liquid surface of the alcohol solution marked by labelimg.

[0038] Optionally, the S01 includes:

[0039] S01-1, using a pre-established first training set according to a pre-set number of iterations and a pre-set stochastic gradient descent optimization algorithm, training the U-Net model, and adjusting the model parameters of the U-Net model according to a cross entropy loss function obtained during the training process to obtain an initial U-Net model;

[0040] S01-2, rotating, scaling and flipping all the label images in the first training set respectively to obtain a second training set;

[0041] S01-3. Use the second training set to train the initial U-Net model according to a preset number of iterations and a preset stochastic gradient descent optimization algorithm, and adjust the model parameters of the U-Net model according to the cross entropy loss function obtained during the training process to obtain a trained U-Net model.

[0042] Optionally, the U-Net model includes: an encoding layer, an intermediate layer and a decoding layer;

[0043] The encoding layer includes four convolutional layers, each of which is followed by a maximization layer;

[0044] The intermediate layer includes two convolutional layers;

[0045] The decoding layer includes four transposed convolutional layers, each of which is followed by a sampling operation;

[0046] Each convolutional layer of the encoding layer and the intermediate layer, as well as the transposed convolutional layer of the decoding layer, includes corresponding convolution, batch normalization, and activation functions; and any convolutional layer of the encoder is connected to the decoder transposed convolutional layer of its corresponding decoder.

[0047] In a second aspect, an embodiment of the present invention provides an online alcohol content measurement system, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement an online alcohol content measurement method.

[0048] (III) Beneficial effects

[0049] The beneficial effect of the present invention is that the online alcohol content measurement method of the present invention uses image processing technology and segmentation model to process images, which effectively improves the accuracy of alcohol meter readings and the convenience of operation compared with the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] Figure 1 This is a flow chart of an online alcohol content measurement method according to Example 1 of the present invention;

[0051] Figure 2 This is a simplified structural diagram of an online alcohol content measuring device according to Example 1 of the present invention;

[0052] Figure 3 This is a structural schematic diagram of an online alcohol content measurement method according to Example 2 of the present invention;

[0053] Figure 4 Schematic diagram of image processing of an online alcohol content measurement method according to Example 2 of the present invention. DETAILED DESCRIPTION

[0054] In order to better explain the present invention and facilitate understanding, some words are explained below:

[0055] Image segmentation: Image segmentation is a technique in computer vision and image processing. It is a process of dividing a digital image into multiple regions or objects. The purpose of this process is to simplify or change the representation of the image so that it is easier to analyze and interpret. The key to image segmentation is to distinguish different objects from the background in the image, or to divide the image into regions with similar characteristics (such as color, brightness, texture).

[0056] The present invention will be described in detail below through specific implementation modes in conjunction with the accompanying drawings.

[0057] An online alcohol content measurement method proposed in an embodiment of the present invention uses image processing technology and a segmentation model to process images, which effectively improves the accuracy of alcohol meter readings and the convenience of operation compared to the prior art.

[0058] In order to better understand the above technical solution, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a clearer and more thorough understanding of the present invention and to fully convey the scope of the present invention to those skilled in the art.

[0059] Example 1

[0060] This embodiment provides an online alcohol content measurement method, and its flow chart is as follows: Figure 1 As shown, the method is based on an online alcohol content measurement device, such as Figure 2 As shown, it is used to detect the alcohol content of the solution in real time during the wine picking process, wherein the online alcohol content measurement device includes an image acquisition device, an alcohol container and an alcohol meter, wherein the alcohol meter is arranged inside the alcohol container, and the alcohol meter can only float up and down with the alcohol solution (it can be limited left and right to prevent tilting), and the inner wall and outer wall of the alcohol container provided with a liquid inlet and a liquid outlet are both transparent; the scale of the alcohol meter is not uniform, based on the relative position of the alcohol meter scale in the vertical direction of the alcohol meter, the relative position of any scale of the alcohol meter on the alcohol meter is established, and there is a corresponding relationship table with a one-to-one correspondence between the alcohol content and the position and the scale.

[0061] The method comprises:

[0062] S01-1, using the pre-established first training set according to a pre-set number of iterations and a pre-set stochastic gradient descent optimization algorithm, to train the U-Net model, and based on the cross entropy loss function obtained during the training process and the model parameters of the physical U-Net model, to obtain an initial U-Net model;

[0063] S01-2, rotating, scaling and flipping all the label images in the first training set respectively to obtain a second training set;

[0064] S01-3. Use the second training set to train the initial U-Net model according to a preset number of iterations and a preset stochastic gradient descent optimization algorithm, and adjust the model parameters of the U-Net model according to the cross entropy loss function obtained during the training process to obtain a trained U-Net model.

[0065] S02, obtaining the pixel length of the alcohol meter based on a pre-established mapping relationship between the pixel coordinate system and the world coordinate system and a pre-obtained actual length of the alcohol meter;

[0066] S11-1, acquiring a third process image through an image acquisition device, where the third process image includes a transparent alcohol container containing an alcohol solution and an alcohol meter disposed inside the alcohol container;

[0067] S11-2, reducing random noise in the third process image according to a preset Gaussian blur algorithm, and adjusting the brightness and contrast of the third process image by histogram equalization, so that the scale of the alcohol meter in the third process image is clearly visible;

[0068] S11-3, cropping the adjusted third process image to include only the alcohol meter area, and scaling it to a suitable size for processing, to obtain a first original image.

[0069] S12-1, inputting the first original image into the trained U-Net model, and obtaining a fourth process image indicating the probability that each pixel belongs to the background part, the part of the alcohol meter above the liquid surface, or the part of the alcohol meter below the liquid surface;

[0070] S12-2. Obtain a second segmented image according to a preset probability threshold and the probability that each pixel in the fourth process image belongs to the background part, the part of the alcohol meter above the liquid surface, or the part of the alcohol meter below the liquid surface.

[0071] S13. According to the second segmented image, obtain the pixel lengths in the vertical direction of the alcohol meter above the alcohol solution liquid surface and below the liquid surface in the second segmented image.

[0072] S14-1, obtaining the relative position of the alcohol solution surface on the alcohol meter according to the pixel lengths in the vertical direction of the portion of the alcohol meter above the alcohol solution surface and the portion below the alcohol solution surface in the second segmented image and a preset formula 2;

[0073] The formula 2 is:

[0074] ;

[0075] Among them, P c is the relative position of the alcohol solution surface on the alcohol meter, L u and L d are respectively the pixel lengths in the vertical direction of the part of the alcohol meter above the alcohol solution liquid surface and the part below the liquid surface in the second segmented image; is the preset distortion coefficient.

[0076] It is obtained by pre-set formula 3, which is:

[0077] ;

[0078] in, is the distortion coefficient, Lu and L d are respectively the pixel lengths in the vertical direction of the part of the alcohol meter above the alcohol solution liquid surface and the part below the liquid surface in the second segmented image; The pixel length for alcohol.

[0079] S14-2, traversing the correspondence table, and determining whether there is a scale in the correspondence table that is the same as the relative position of the alcohol solution level on the alcohol meter;

[0080] If it exists, the alcohol content corresponding to the scale with the same relative position of the alcohol solution surface on the alcohol meter is used as the alcohol content of the current solution;

[0081] The corresponding relationship table is:

[0082] ;

[0083] Among them, P b is the relative position of any alcohol meter scale on the alcohol meter, A b This is the alcohol content corresponding to this scale.

[0084] If it does not exist, the corresponding relationship table is traversed to obtain the relative positions of the two scales closest to the relative position of the alcohol solution surface on the alcohol meter, and the alcohol content of the current solution is obtained according to a preset formula 1; the formula 1 is:

[0085] ;

[0086] Among them, A c is the alcohol content of the current solution, P c is the relative position of the alcohol solution surface on the alcohol meter, P i and P j is the relative position of the two scales on the alcohol meter that are closest to the relative position of the alcohol solution surface on the alcohol meter in the corresponding relationship table, A i and A j P i and P j The corresponding alcohol content.

[0087] An online alcohol content measurement method proposed in an embodiment of the present invention uses image processing technology and a segmentation model to process images, which effectively improves the accuracy of alcohol meter readings and the convenience of operation compared to the prior art.

[0088] Example 2

[0089] This embodiment provides an online alcohol content measurement method, the structure of which is as follows: Figure 3 As shown, including:

[0090] A pre-configured camera is used to photograph the alcohol meter at a fixed angle and distance. During the image acquisition process, the optical fibers are evenly distributed to avoid reflection and shadow interference. A third process image is obtained, which includes a transparent alcohol container containing an alcohol solution and an alcohol meter disposed inside the alcohol container.

[0091] Preprocess the captured third process image to reduce the impact of noise and optimize the analysis effect, including:

[0092] Noise reduction: Reduce random noise in the image through Gaussian blur algorithm;

[0093] Brightness and contrast adjustment: adjust the brightness and contrast of the image through histogram equalization to ensure that the scale of the alcohol meter is clearly visible;

[0094] Cropping and scaling: Crop the image to only contain the alcohol meter area and scale it to a suitable size for processing;

[0095] A first original image after preprocessing is obtained.

[0096] The U-Net model is used to segment the first original image after preprocessing to determine the alcohol meter parts above and below the liquid surface. The steps for building and using the model are as follows:

[0097] Labeling: For the preprocessed training images, use labelimg to label the alcohol meter areas above and below the liquid surface and use them as training data to train the U-Net model.

[0098] Enhancement: Perform data augmentation on training images, including rotation, scaling, and flipping, to increase the generalization ability of the model.

[0099] The architecture of the U-Net model is: encoder (downsampling part), intermediate layer and decoder (upsampling part); the encoder includes four convolutional layers, each of which includes convolution, batch normalization and activation function (ReLU), and each convolutional layer is followed by a maximization layer; the intermediate layer includes two convolutional layers, each of which also includes convolution, batch normalization and activation function; the decoding layer includes four transposed convolutional layers, each of which includes convolution, batch normalization and activation function, and each transposed convolutional layer is followed by an upsampling operation. Each layer of the encoder is connected to the corresponding decoder layer to retain detailed information.

[0100] Training hyperparameters: Loss function: Cross entropy loss function, used to compare the difference between model output and true annotation;

[0101] Optimization algorithm: Stochastic Gradient Descent (SGD) optimization algorithm, which is used to adjust the network weights to minimize the loss function;

[0102] Learning rate: The initial learning rate is 0.01, which controls the step size of weight update;

[0103] Iterations: The number of iterations during training, set to 100;

[0104] Batch size: The number of images included in each batch during training, set to 16.

[0105] Testing and Validation: Cross-validation: Use data that was not used in training to test the performance of the model and evaluate its accuracy and generalization ability;

[0106] Parameter adjustment: Adjust model parameters based on test results to improve the accuracy of the model.

[0107] Finally, the trained U-Net model is obtained.

[0108] Image segmentation: The first original image is input into the trained U-Net model, and the model outputs a fourth process image indicating the probability that each pixel belongs to the background part, the part of the alcohol meter above the liquid surface, or the part of the alcohol meter below the liquid surface; according to the pre-set probability threshold and the probability that each pixel in the fourth process image belongs to the background part, the part of the alcohol meter above the liquid surface, or the part of the alcohol meter below the liquid surface, small areas are further removed and holes are filled through morphological operations to obtain a second segmented image.

[0109] After the first original image is obtained from the third process image after preprocessing, it is input into the trained U-Net model to obtain the second segmented image. The schematic diagram of the above process is as follows Figure 4 shown.

[0110] Determine the reading: according to the pixel lengths of the alcohol meter above the alcohol solution liquid surface and below the liquid surface in the vertical direction in the second segmented image, and the preset formula 2, obtain the relative position of the alcohol solution liquid surface on the alcohol meter;

[0111] The formula 2 is:

[0112] ;

[0113] Among them, P c is the relative position of the alcohol solution surface on the alcohol meter, L u and L d are respectively the pixel lengths in the vertical direction of the part of the alcohol meter above the alcohol solution liquid surface and the part below the liquid surface in the second segmented image; is the preset distortion coefficient.

[0114] It is obtained by pre-set formula 3, which is:

[0115] ;

[0116] in, is the distortion coefficient, L u and L d are respectively the pixel lengths in the vertical direction of the part of the alcohol meter above the alcohol solution liquid surface and the part below the liquid surface in the second segmented image; The pixel length of the alcohol meter is determined in advance.

[0117] Traversing the correspondence table, and determining whether there is a scale in the correspondence table that is the same as the relative position of the alcohol solution level on the alcohol meter;

[0118] If it exists, the alcohol content corresponding to the scale with the same relative position of the alcohol solution surface on the alcohol meter is used as the alcohol content of the current solution;

[0119] The corresponding relationship table is:

[0120] ;

[0121] Among them, P b is the relative position of any alcohol meter scale on the alcohol meter, A b This is the alcohol content corresponding to this scale.

[0122] If it does not exist, the corresponding relationship table is traversed to obtain the relative positions of the two scales closest to the relative position of the alcohol solution surface on the alcohol meter, and the alcohol content of the current solution is obtained according to a preset formula 1; the formula 1 is:

[0123] ;

[0124] Among them, A c is the alcohol content of the current solution, P c is the relative position of the alcohol solution surface on the alcohol meter, P i and P j is the relative position of the two scales on the alcohol meter that are closest to the relative position of the alcohol solution surface on the alcohol meter in the corresponding relationship table, A i and A j P i and P j The corresponding alcohol content.

[0125] On the basis of ensuring the quality of image acquisition, this embodiment effectively improves the accuracy of the alcohol meter reading and the convenience of operation through image processing and segmentation algorithms, and solves the problems of the prior art in terms of operation complexity and reading accuracy.

[0126] In the description of the present invention, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0127] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium; it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0128] In the present invention, unless otherwise clearly specified and limited, when a first feature is “on” or “below” a second feature, it may be that the first and second features are in direct contact, or that the first and second features are in indirect contact through an intermediate medium. Moreover, when a first feature is “above”, “above” or “above” a second feature, it may be that the first feature is directly above or obliquely above the second feature, or it may simply mean that the first feature is higher in level than the second feature. When a first feature is “below”, “below” or “below” a second feature, it may be that the first feature is directly below or obliquely below the second feature, or it may simply mean that the first feature is lower in level than the second feature.

[0129] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.

[0130] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may alter, modify, replace and modify the above embodiments within the scope of the present invention.

Claims

1. An online alcohol content measurement method, characterized in that: The method is applied to real-time detection of the alcohol content of a solution during wine picking, and the method comprises: S11, acquiring a first original image through a preset image acquisition device, wherein the first original image includes an area where the alcohol meter is located; S12, inputting the first original image into a pre-trained U-Net model to obtain a second segmented image that segments the alcohol meter above the alcohol solution liquid surface and below the liquid surface; S13, according to the second segmented image, obtaining the pixel lengths in the vertical direction of the alcohol meter above the alcohol solution liquid surface and below the liquid surface in the second segmented image; S14-1. Obtain the relative position of the alcohol solution surface on the alcohol meter according to the vertical pixel lengths of the alcohol meter above the alcohol solution surface and below the alcohol solution surface in the second segmented image and a preset formula 2; the scale of the alcohol meter is not uniform; the formula 2 is: ; Among them, P c is the relative position of the alcohol solution surface on the alcohol meter, L u and L d are respectively the pixel lengths in the vertical direction of the part of the alcohol meter above the alcohol solution liquid surface and the part below the liquid surface in the second segmented image; is the preset distortion coefficient, , L0 is the predetermined pixel length of the alcohol meter; S14-2, traversing the correspondence table, and determining whether there is a scale in the correspondence table that is the same as the relative position of the alcohol solution level on the alcohol meter; If it exists, the alcohol content corresponding to the scale with the same relative position of the alcohol solution surface on the alcohol meter is used as the alcohol content of the current solution; the corresponding relationship table is: ; Among them, P b is the relative position of any alcohol meter scale on the alcohol meter, A b This is the alcohol content corresponding to this scale.

2. The method for online measuring alcohol content according to claim 1, characterized in that: The S11 includes: S11-1, acquiring a third process image through a preset image acquisition device, wherein the third process image includes a transparent alcohol container containing an alcohol solution and an alcohol meter disposed inside the alcohol container; S11-2, reducing random noise in the third process image according to a preset Gaussian blur algorithm, and adjusting the brightness and contrast of the third process image by histogram equalization; S11-3, cropping and scaling the adjusted third process image to generate a first original image that only includes the area where the alcohol meter is located.

3. The alcohol content online measurement method according to claim 2, characterized in that: The S14-2 also includes: If it does not exist, the corresponding relationship table is traversed to obtain the relative positions of the two scales closest to the relative position of the alcohol solution surface on the alcohol meter, and the alcohol content of the current solution is obtained according to a preset formula 1; the formula 1 is: ; Among them, A c is the alcohol content of the current solution, P c is the relative position of the alcohol solution surface on the alcohol meter, P i and P j is the relative position of the two scales on the alcohol meter that are closest to the relative position of the alcohol solution surface on the alcohol meter in the corresponding relationship table, A i and A j P i and P j The corresponding alcohol content.

4. The method for online measuring alcohol content according to claim 1, characterized in that: The S12 includes: S12-1, inputting the first original image into a pre-trained U-Net model to obtain a fourth process image indicating the probability that each pixel belongs to the background part, the part of the alcohol meter above the liquid surface, or the part of the alcohol meter below the liquid surface; S12-2. Obtain a second segmented image according to a preset probability threshold and the probability that each pixel in the fourth process image belongs to the background part, the part of the alcohol meter above the liquid surface, or the part of the alcohol meter below the liquid surface.

5. The method for online measuring alcohol content according to claim 1, characterized in that: The S11 and before also include: S01. Use a pre-established first training set to train the U-Net model according to a pre-set number of iterations to obtain a trained U-Net model, wherein the first training set includes at least one pre-processed labeled image, and the labeled image is an image of the alcohol meter above the liquid surface and below the liquid surface of the alcohol solution marked by labelimg.

6. The method for online measuring alcohol content according to claim 5, characterized in that: The S01 includes: S01-1, using a pre-established first training set according to a pre-set number of iterations and a pre-set stochastic gradient descent optimization algorithm, training the U-Net model, and adjusting the model parameters of the U-Net model according to a cross entropy loss function obtained during the training process to obtain an initial U-Net model; S01-2, rotating, scaling and flipping all the label images in the first training set respectively to obtain a second training set; S01-3. Use the second training set to train the initial U-Net model according to a preset number of iterations and a preset stochastic gradient descent optimization algorithm, and adjust the model parameters of the U-Net model according to the cross entropy loss function obtained during the training process to obtain a trained U-Net model.

7. The method for online measuring alcohol content according to claim 1, characterized in that: The U-Net model includes: an encoding layer, an intermediate layer and a decoding layer; The encoding layer includes four convolutional layers, each of which is followed by a maximization layer; The intermediate layer includes two convolutional layers; The decoding layer includes four transposed convolutional layers, each of which is followed by a sampling operation; Each convolutional layer of the encoding layer and the intermediate layer, as well as the transposed convolutional layer of the decoding layer, includes corresponding convolution, batch normalization, and activation functions; and any convolutional layer of the encoder is connected to the decoder transposed convolutional layer of its corresponding decoder.

8. An alcohol content online measurement system, comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the online alcohol content measurement method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Intelligent water level monitoring method based on image recognition

    CN110223341A

  • Online alcoholic strength acquisition system and method

    CN113484189A