An independent bubble segmentation method for gas-liquid two-phase flow, an electronic device, and a storage medium
By using pre-trained features to extract neural network models, combined with the multi-size gas-liquid two-phase flow bubble images acquired by the experimental device, the Pretrain-VGG19-Unet model is trained, which solves the problem of poor real-time performance in complex scenarios and large-scale data processing in the existing technology, and realizes high-precision and high-efficiency gas-liquid two-phase flow bubble segmentation.
Patent Information
- Application Number
- CN202310406373.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-17
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2043-04-17
AI Technical Summary
The existing gas-liquid two-phase flow bubble segmentation technology has poor real-time performance when processing complex scenarios and large amounts of data, making it difficult to meet the needs of automatic detection.
The gas-liquid two-phase flow independent bubble segmentation method based on pretrained features is adopted. By building an experimental device, the gas-liquid two-phase flow bubble images of multiple sizes and different distribution states are obtained, and the Pretrain-VGG19-Unet model is used for training and segmentation.
The prediction accuracy and training efficiency of gas-liquid two-phase bubble segmentation are improved, the depth and generalization capabilities of the model are enhanced, and the bubble segmentation under different working conditions can be quickly and accurately handled to meet the needs of automatic detection.
Smart Images

Figure CN116468891B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of multiphase flow characteristics analysis and the fields of flow pattern recognition and flow rate measurement. Specifically, it relates to a method for segmenting independent bubble images of gas-liquid two-phase flow. Background Art
[0002] In gas-liquid two-phase flow, there is often a flow containing bubbles. The size and size distribution of the bubbles often determine the flow structure and motion law of the two-phase fluid, and even affect the overall performance of the two-phase flow system. For example, in a nuclear reactor, the void fraction of gas-liquid two-phase flow has a great impact on the stability of the nuclear reactor power, the flow and heat transfer characteristics in the reactor, and the operation safety, and the bubble size plays an extremely important role in the distribution of the void fraction.
[0003] For gas-liquid two-phase flow, both the bubbles and the water itself are transparent, and the interface between the bubbles and the water has many levels of light reflection and darkness; in addition, due to the movement, the bubbles have large irregular changes in both amplitude and frequency. Therefore, it is often difficult to distinguish the boundary between water and bubbles in the photographed bubble photos. The factors affecting the photo quality are: 1. Camera parameters (exposure time, depth of field, etc.); 2. Photographic lighting (type of light source, intensity, lighting direction, light ratio, etc.); 3. Optical noise. It is very difficult to segment the bubbles reasonably and effectively. Therefore, to achieve automatic detection of the bubble distribution, finding a feasible and effective segmentation algorithm is a relatively key task.
[0004] Currently, the segmentation of gas-liquid two-phase flow images generally uses traditional segmentation methods, such as threshold-based segmentation algorithms, edge detection-based segmentation algorithms, etc. Dinh and Choi [1] extracted and calculated the bubble size by processing techniques such as filtering, edge detection, and image binarization on the images of two-phase bubbly flow and slug flow in a vertical pipe. Zhang Wenyin et al. [2] improved the Canny algorithm (edge detection-based algorithm) for segmenting the images of bubbly flow in gas-liquid two-phase flow. Li Hongwei et al. [3] applied the improved contour algorithm to gas-liquid two-phase flow images. Zhou Hongjuan et al. [4] studied the segmentation of bubbles using particle swarm optimization-enhanced Otsu method. Shi Lilian et al. [5] studied the segmentation of bubble images in gas-liquid two-phase flow using morphological segmentation methods.
[0005] Traditional segmentation algorithms can achieve good results in simple scenarios, but in different scenarios, the parameters of each module need to be independently designed, which is cumbersome. In the face of complex scenarios, it is difficult to design an algorithm with good generalization performance; and they all perform overall processing on the pixels within a certain area, and it is difficult to achieve semantic-level segmentation.
[0006] In the process of presenting the present disclosure, the inventors found that in almost all existing gas-liquid two-phase flow bubble segmentation techniques, there is a specific applicable range. Although the accuracy is relatively high, the real-time performance is poor, and it is difficult to process a large amount of data. In many industrial application scenarios, the demand for automatic detection cannot be met.
[0007] Cited Literature
[0008] [1] Dinh T B, Choi T S. Application of image processing techniques in air / water two phase flow[J]. Mechanics Research Communications, 1999, 26(4): 463-468.
[0009] [2] Zhang Wenyin, Jin Ningde. Gas-liquid two-phase bubbly flow image segmentation algorithm based on improved Canny operator[J]. Computer Engineering and Science, 2009, 31(8): 137-139.
[0010] [3] Li Hongwei, Zhou Yunlong, Wu Jian. Application of improved contour method in gas-liquid two-phase flow images[J]. Journal of Shenyang University of Technology, 2011.
[0011] [4] Zhou Hongjuan, Zhou Yunlong. Research on bubble segmentation method based on particle swarm optimization enhanced Otsu method[J]. Journal of Northeast Electric Power University. 2011, 31(01).
[0012] Shi Lilian, Ye Jun, Shen Hongwei. Morphological segmentation method for gas-liquid two-phase flow bubble images[J]. Automation instrument . 2012, 33(10) Summary of the Invention
[0013] The present disclosure provides a method for segmenting independent bubbles in gas-liquid two-phase flow, an electronic device, and a storage medium, which can solve the problems of the prior art pointed out in the background art.
[0014] Basic Solution 1:
[0015] A method for segmenting independent bubble images in gas-liquid two-phase flow, characterized in that it includes:
[0016] Step S1, building a gas-liquid two-phase flow experimental device capable of changing the gas-liquid ratio;
[0017] Step S2, using a high-speed camera to obtain gas-liquid two-phase flow images under different flow states in a vertical pipe;
[0018] Step S3: Obtain training data, where the training data includes gas-liquid two-phase flow bubble images of multiple sizes and different distribution states (i.e., under different flow states) and the labeled images corresponding to each gas-liquid two-phase flow bubble image;
[0019] Step S4: Obtain a pre-trained feature extraction neural network model and construct an initial gas-liquid two-phase flow independent bubble segmentation model based on the feature extraction neural network model;
[0020] Step S5: Train the initial gas-liquid two-phase flow independent bubble segmentation model based on the training data;
[0021] Step S6: Based on the trained gas-liquid two-phase flow independent bubble segmentation model, obtain the bubble labeled image in the gas-liquid two-phase flow to be segmented, and obtain the segmentation result of the gas-liquid two-phase flow bubble image.
[0022] On the basis of the basic solution 1, further optimization is carried out to obtain solution 2: In step S2, the acquisition of the gas-liquid two-phase flow image is to collect the image signals of the gas-liquid two-phase flow bubble distribution under different working conditions. In an experimental device composed of a vertical pipeline, a high-speed camera and a computer, by collecting the image signals of different bubble distributions on the vertical pipeline, the gas phase and liquid phase flow rates are fixed and changed respectively to obtain the bubble distribution states under different gas-liquid flow rates, and the images thereof are collected.
[0023] Improve solution 2 to obtain solution 3:
[0024] In step S4, the neural network model is the VGG19 model in the Visual Geometry Group model; the initial gas-liquid two-phase flow independent bubble segmentation model is the Pretrain-VGG19-Unet model.
[0025] On the basis of solution 3, further optimization is carried out to obtain solution 4: The feature extraction neural network VGG19 model includes an input layer, m feature extraction convolutional structures, p fully connected structures and an output layer, where m and p are both positive integers. Each feature extraction convolutional structure includes at least two convolutional layers and one pooling layer, and the fully connected structure includes multiple fully connected layers.
[0026] On the basis of solution 4, further optimization is carried out to obtain solution 5:
[0027] In step S4, the Pretrain-VGG19-Unet model includes:
[0028] A feature extraction part, where the feature extraction part includes the input layer of the feature extraction neural network VGG19 model and the first n feature extraction convolutional structures, where n is a positive integer less than or equal to m;
[0029] An image restoration part, where the image restoration part includes n image restoration convolution structures and an output structure. Each image restoration convolution structure includes at least two convolutional layers and an upsampling layer, and the output structure includes at least two convolutional layers and an output layer.
[0030] Based on Scheme 5, further optimization is carried out to obtain Scheme 6: The upsampling layer performs upsampling calculation on the image output by the previous convolutional layer; the upsampling calculation includes the following steps:
[0031] Step S21, upsampling. Based on the bilinear interpolation method, four coordinate points in the image output by the previous convolutional layer of the upsampling layer are used to confirm one coordinate point of the new image for image magnification;
[0032] Step S22, perform feature splicing and use two 3×3 convolutional layers and the ReLU activation function for operation;
[0033] Step S23, repeat Steps S21 and S22 four times;
[0034] Step S24, finally connect a 1×1 convolutional layer for dimensionality reduction processing, that is, reduce the number of channels to a specific number and output the segmentation map.
[0035] Based on Scheme 6, further optimization is carried out to obtain Scheme 7: The pooling layer adopts the max pooling method, and the sampling window is 2×2; the upsampling layer adopts the bilinear interpolation method.
[0036] The present disclosure also has two other application aspects:
[0037] An electronic device includes a processor and a memory for storing instructions executable by the processor; wherein, the processor is configured to call the instructions stored in the memory to execute the method described in any one of Schemes 1 to 7.
[0038] A computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the method described in any one of Schemes 1 to 7 is implemented.
[0039] The above at least one technical solution adopted by one or more embodiments of this specification can achieve the following beneficial effects:
[0040] The method provided by the present disclosure is an independent bubble segmentation method for gas-liquid two-phase flow based on a pre-trained feature extraction neural network model. On the one hand, the neural network model is used to increase the depth of the model and improve the prediction accuracy. On the other hand, the pre-trained feature extraction neural network model is used to simplify the training process and improve the training efficiency. At the same time, it makes up for the disadvantage of poor generalization of traditional algorithms in the field of gas-liquid two-phase flow bubble segmentation, can quickly and accurately segment bubbles under different working conditions, improves the accuracy in calculating bubble size parameters, meets the need for processing a large amount of data, provides a reliable technical basis for realizing the automatic detection of the size and number distribution of bubbles in two-phase flow, and also provides auxiliary support for determining two-phase flow pattern recognition or the void fraction distribution and velocity of bubbles as well as two-phase flow flow rate measurement.
[0041] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and do not limit the present disclosure.
[0042] According to the following detailed description of exemplary embodiments with reference to the accompanying drawings, other features and aspects of the present disclosure will become clear. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] The accompanying drawings herein are incorporated into the specification and constitute a part of this specification. These drawings show embodiments consistent with the present disclosure and, together with the specification, are used to explain the technical solutions of the present disclosure.
[0044] Figure 1 is a flowchart of an independent bubble segmentation method for gas-liquid two-phase flow under a specific embodiment of the present disclosure;
[0045] Figure 2 is a data acquisition experimental device under a specific embodiment of the present disclosure;
[0046] Figure 3 is the original gas-liquid two-phase flow image collected under a specific embodiment of the present disclosure;
[0047] Figure 4 is the manually processed and marked gas-liquid two-phase flow image under a specific embodiment of the present disclosure;
[0048] Figure 5 is a schematic structural diagram of the VGG19 model under a specific embodiment of the present disclosure;
[0049] Figure 6 is a schematic framework diagram of the Pretrain-VGG19-Unet model under a specific embodiment of the present disclosure;
[0050] Figure 7 is a flowchart of the feature extraction (downsampling) and image restoration (upsampling) calculations under a specific embodiment of the present disclosure;
[0051] Figure 8 It is a table of Kappa value level distribution information under a specific embodiment of the present disclosure;
[0052] Figure 9 It is a training flow chart of the Pretrain-VGG19-Unet model under a specific embodiment of the present disclosure;
[0053] Figure 10 It is a diagram of the output segmentation result under a specific embodiment of the present disclosure.
[0054] In the figure, 1-water tank, 2-centrifugal pump, 3-valve, 4-turbine flowmeter, 5-air compressor, 6-air buffer tank, 7-needle valve, 8-mass flow controller, 9-check valve, 10-gas-liquid mixer, 11-development pipe section, 12-measurement pipe section, 13-extension pipe section, 14-gas-liquid separator, 15-high-speed camera, 16-computer. Detailed implementation manners
[0055] Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the drawings denote elements having the same or similar functions. Although various aspects of the embodiments are shown in the drawings, the drawings do not have to be drawn to scale unless otherwise specified.
[0056] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following detailed implementation manners. Those skilled in the art should understand that the present disclosure can also be implemented without some specific details. In some instances, methods, means, elements and circuits well known to those skilled in the art are not described in detail so as to highlight the gist of the present disclosure. A specific embodiment is given below, intending to further describe in detail the technical solutions given by the present disclosure in combination with the drawings and the embodiments. It should be noted that the following embodiments are intended to facilitate the understanding of the present disclosure and do not limit it in any way.
[0057] The gas-liquid two-phase flow independent bubble image segmentation method includes:
[0058] Step S1, building a gas-liquid two-phase flow experimental device that can change the gas-liquid ratio;
[0059] Step S2, using a high-speed camera to obtain gas-liquid two-phase flow images in a vertical pipe under different flow states;
[0060] Step S3, obtaining training data, where the training data includes gas-liquid two-phase flow bubble images with multiple sizes and different distribution states (i.e., under different flow states) and the labeled images corresponding to each of the gas-liquid two-phase flow bubble images,
[0061] Step S4: Obtain a pre-trained feature extraction neural network model, and construct an initial gas-liquid two-phase flow independent bubble segmentation model based on the feature extraction neural network model;
[0062] Step S5: Train the initial gas-liquid two-phase flow independent bubble segmentation model based on the training data;
[0063] Step S6: Based on the trained gas-liquid two-phase flow independent bubble segmentation model, obtain the bubble labeled image in the gas-liquid two-phase flow to be segmented, and obtain the gas-liquid two-phase flow bubble image segmentation result.
[0064] Optionally, the feature extraction neural network model is a VGG19 model, and the gas-liquid two-phase flow independent bubble segmentation model is a Pretrain-VGG19-Unet model;
[0065] Optionally, the feature extraction neural network VGG19 model includes an input layer, m feature extraction convolutional structures, p fully connected structures, and an output layer, where m and p are both positive integers. Each feature extraction convolutional structure includes at least two convolutional layers and a pooling layer, and the fully connected structure includes multiple fully connected layers;
[0066] Optionally, the Pretrain-VGG19-Unet model;
[0067] Feature extraction part, the feature extraction part includes the input layer of the feature extraction neural network VGG19 model and the first n feature extraction convolutional structures, where n is a positive integer less than or equal to m;
[0068] Image restoration part, the image restoration part includes n image restoration convolutional structures and an output structure. Each image restoration convolutional structure includes at least two convolutional layers and an upsampling layer, and the output structure includes at least two convolutional layers and an output layer;
[0069] Optionally, the upsampling layer performs upsampling calculation on the image output by the previous convolutional layer;
[0070] Optionally, the upsampling calculation includes the following steps;
[0071] Step S21: Upsampling. Based on the bilinear interpolation method, confirm a coordinate point of the new image from 4 coordinate points in the image output by the previous convolutional layer of the upsampling layer, and perform image magnification;
[0072] Step S22: Perform feature splicing and perform operations using 2 3×3 convolutional layers and the ReLU activation function;
[0073] Step S23: Repeat steps S21 and S22 a total of 4 times;
[0074] Step S24: Finally, a 1×1 convolution is performed for dimensionality reduction, that is, the number of channels is reduced to a specific number, and the segmentation map is output.
[0075] Optionally, the pooling layer adopts the maximum pooling method, and the sampling window is 2×2; the upsampling layer adopts the bilinear interpolation method.
[0076] Optionally, the feature extraction convolution structure further includes an activation layer.
[0077] Optionally, the image restoration convolution structure further includes an activation layer.
[0078] Optionally, the obtaining of the pre-trained feature extraction neural network VGG19 model includes:
[0079] Training the feature extraction neural network VGG19 model based on the training data; or
[0080] Extracting the weights of the feature extraction neural network VGG19 model that has been trained in a large public dataset (ImageNet dataset).
[0081] Optionally, the training of the initial Pretrain-VGG19-Unet model based on the training data includes:
[0082] Step S31: Based on the feature extraction neural network VGG19 model, randomly initialize the parameters of the feature extraction part of the Pretrain-VGG19-Unet model.
[0083] Step S32: Through the Pretrain-VGG19-Unet model, determine the output feature map of the gas-liquid two-phase flow bubble image in the training data.
[0084] Step S33: Introduce the evaluation metrics mean intersection over union (MIou) and Kappa coefficient to measure the segmentation accuracy.
[0085] Step S34: Calculate the MIou and Kappa values based on the number of correctly predicted pixels and the sample accuracy rate.
[0086] Step S35: According to the segmentation accuracy metrics, update the parameters of the image restoration part in the Pretrain-VGG19-Unet model. Based on the Pretrain-VGG19-Unet model with the updated parameters, repeat steps S32, S33, and S34 until the segmentation accuracy reaches the preset value, and obtain the trained Pretrain-VGG19-Unet model.
[0087] The following provides a more detailed implementation process in conjunction with the accompanying drawings:
[0088] As Figure 1 shown, the gas-liquid two-phase flow independent bubble segmentation method includes:
[0089] Step S1, build a gas-liquid two-phase flow experimental device that can change the gas-liquid ratio
[0090] The gas-liquid two-phase flow experimental device is as Figure 2 shown: A set of gas-liquid two-phase flow experimental system is constructed to obtain gas-liquid two-phase flow images with different bubble states in a vertical circular tube, and different bubble distribution states are shaped by adjusting the gas-liquid ratio. This system can be divided into two parts: one part is the fluid control system, and the other part is the high-speed camera image acquisition system.
[0091] Among them, the fluid control system mainly consists of a water pump, an air compressor, a gas-liquid mixer, a turbine flowmeter, a gas flowmeter, and a water tank, etc. The experimental principle is as follows: Air is provided by the air compressor, and the gas flow rate can be measured through the gas flowmeter. The water in the water tank is pumped into the experimental system by the water pump under pressure, and the liquid flow rate in the system can be measured through the turbine flowmeter. The gas and liquid in the experimental system pass through the mixer and enter the experimental pipe section from the bottom of the transparent pipe, and then return to the water tank.
[0092] Among them, the high-speed camera image acquisition system mainly consists of a transparent vertical circular tube, a high-speed camera, sulfuric acid paper, a fill light, and a computer. The vertical transparent pipe section of this device is the image acquisition area. The fill light is used for fill light, and the flow pattern image is obtained by the backlight shooting method and displayed and stored in a laptop computer.
[0093] Step S2, use a high-speed camera to obtain gas-liquid two-phase flow images under different flow states in the vertical pipe, as Figure 3 shown;
[0094] Step S3, obtain training data, where the training data includes gas-liquid two-phase flow bubble images with different sizes and different distribution states (i.e., under different flow states) and the labeled images corresponding to each gas-liquid two-phase flow bubble image, as Figure 4 shown;
[0095] Among them, the gas-liquid two-phase flow bubble labeled image refers to the image obtained by segmenting the bubbles in the gas-liquid two-phase flow image in the training data and marking the bubble segmentation result. The gas-liquid two-phase flow bubble labeled image marks the bubble size, boundary, distribution position, etc.
[0096] Step S4, obtain a pre-trained feature extraction neural network model, and build an initial gas-liquid two-phase flow independent bubble segmentation model based on the feature extraction neural network model;
[0097] In an embodiment of the present disclosure, the feature extraction neural network model is a VGG19 model, and the gas-liquid two-phase flow independent bubble segmentation model is a Pretrain-VGG19-Unet model. Next, taking the feature extraction neural network model as the VGG19 model and the gas-liquid two-phase flow independent bubble segmentation model as the Pretrain-VGG19-Unet model as examples, the present disclosure will be further explained and illustrated.
[0098] In an embodiment of the present disclosure, the feature extraction neural network VGG19 model includes an input layer, m feature extraction convolutional structures, p fully connected structures, and an output layer, where both m and p are positive integers. Each feature extraction convolutional structure includes at least two convolutional layers and one pooling layer, and each fully connected structure includes multiple fully connected layers.
[0099] Figure 5 It is a schematic structural diagram of the feature extraction neural network VGG19 model according to an embodiment of the present disclosure. As Figure 5 shown, in an embodiment of the present disclosure, the feature extraction neural network VGG19 model includes an input layer, 5 feature extraction convolutional structures, 1 fully connected structure, and an output layer. Each feature extraction convolutional structure includes 2 or 4 convolutional layers and 1 pooling layer, and the fully connected structure includes multiple fully connected layers. For example, the first two feature extraction convolutional structures of the feature extraction neural network VGG19 model include 2 convolutional layers and 1 pooling layer, and the last three feature extraction structures include 4 convolutional layers and 1 pooling layer. The fully connected structure includes 3 fully connected layers, that is, the feature extraction network VGG19 model is a 19-layer convolutional neural network including 16 convolutional layers and 3 fully connected layers.
[0100] In an embodiment of the present disclosure, in the same feature extraction convolutional structure, the number of convolutional kernels in each convolutional layer is the same. In a convolutional layer, one convolutional kernel corresponds to generating one channel of the feature image. Therefore, in the same feature extraction convolutional structure, the number of channels of the feature images determined by each convolutional layer is the same.
[0101] In an embodiment of the present disclosure, the convolutional kernel in the convolutional layer of the feature extraction neural network VGG19 model is a 3×3 matrix, which is used to extract features from the gas-liquid two-phase flow bubble image. The pooling layer of the feature extraction neural network VGG19 model adopts the maximum pooling method with a pooling window size of 2×2, that is, the maximum value in the window with a size of 2×2 is recorded each time, which is used to reduce the dimension of the convolutional matrix, thereby avoiding dimensional explosion.
[0102] In this embodiment, the feature extraction neural network VGG19 model is an artificial neural network based on a convolutional neural network structure, and the parameter configuration of the feature extraction neural network VGG19 model is publicly available and has been used as a benchmark feature extractor in many other applications. Therefore, in an embodiment of the present disclosure, the pre-trained feature extraction neural network VGG19 model can be obtained by training the feature extraction neural network VGG19 model based on the training data, or by extracting the weights of the feature extraction neural network VGG19 model that has been trained in a large public dataset (ImageNet dataset), thereby improving the efficiency of model training.
[0103] After obtaining the pre-trained feature extraction neural network VGG19 model, an initial Pretrain-VGG19-Unet model is constructed based on the pre-trained feature extraction neural network VGG19 model.
[0104] According to an embodiment of the present disclosure, the initial Pretrain-VGG19-Unet model includes a feature extraction part and an image restoration part.
[0105] The feature extraction part includes the input layer of the feature extraction neural network VGG19 model and the first n feature extraction convolutional structures, where n is a positive integer less than or equal to m. The feature extraction part is used to capture the context information in the image during multiple convolution and pooling processes, thereby obtaining image features.
[0106] The image restoration part includes n image restoration convolutional structures and an output structure. Each image restoration part includes at least two convolutional layers and an upsampling layer. The output structure includes at least two convolutional layers and an output layer, and is used to extract image features according to the context information captured by the feature extraction part to achieve precise positioning.
[0107] Figure 6 It is a schematic structural diagram of the Pretrain-VGG19-Unet model according to an embodiment of the present disclosure, as Figure 6As shown in the figure, in an embodiment of the present disclosure, the feature extraction part of the initial Pretrain-VGG19-Unet model may include the input layer of the pre-trained feature extraction neural network VGG19 model and 5 encoding convolutional structures. That is, the feature extraction part of the Pretrain-VGG19-Unet model is the first 17 layers of the pre-trained feature extraction neural network VGG19 model including the input layer. The image restoration part of the initial Pretrain-VGG19-Unet model includes 4 image restoration convolutional structures and an output structure. Each image restoration convolutional structure includes 2 convolutional layers and 1 upsampling layer, and the output structure includes 1 convolutional layer and 1 output layer.
[0108] In an embodiment of the present disclosure, except that the convolution kernel of the last convolutional layer in the output structure is a 1×1 matrix, the convolution kernels of the remaining convolutional layers are all 3×3 matrices; in the image restoration convolutional structure, the number of convolution kernels of each convolutional layer is the same, so that the number of channels of the feature images determined by each convolutional layer is the same.
[0109] In an embodiment of the present disclosure, the pooling layer uses the maximum pooling method, and the sampling window is 2×2, that is, the maximum value in the window of size 2×2 is recorded each time, which is used to reduce the dimension of the convolutional matrix, thereby avoiding dimensional explosion and facilitating the acquisition of image features; the upsampling layer uses the bilinear interpolation method to expand the pixels by calculating other pixels using the existing pixel points. In short, it is to enlarge the image, which is beneficial to reducing the number of channels and achieving precise positioning.
[0110] In an embodiment of the present disclosure, the upsampling layer performs upsampling calculation on the image output by the previous convolutional layer. Figure 7 is a flowchart of the upsampling calculation according to an embodiment of the present disclosure. As Figure 7 shown, the upsampling calculation includes the following steps:
[0111] Step S21, upsampling. Based on the bilinear interpolation method, one coordinate point of the new image is confirmed from 4 coordinate points in the image output by the previous convolutional layer of the upsampling layer to enlarge the image;
[0112] Step S22, perform feature splicing and perform operations using 2 3×3 convolutional layers and the ReLU activation function;
[0113] Step S23, repeat steps S21 and S22 a total of 4 times;
[0114] Step S24, finally connect a 1×1 convolution to perform dimensionality reduction processing, that is, reduce the number of channels to a specific number and output the segmentation map.
[0115] Among them, bilinear interpolation is a pixel-based interpolation method used for image scaling or upsampling. In bilinear interpolation, the value of the target pixel is estimated based on the values of the surrounding four neighboring pixels.
[0116] For example, to upsample an MxN image to 2Mx2N, where (x, y) is a pixel on the original image, and (2x, 2y), (2x + 1, 2y), (2x, 2y + 1), and (2x + 1, 2y + 1) are the four neighboring pixels on the target image. Then the value of the target pixel can be calculated by the following formula:
[0117] f(2x, 2y) = f(x, y) f(2x + 1, 2y) = (f(x, y) + f(x + 1, y)) / 2 f(2x, 2y + 1) = (f(x, y) + f(x, y + 1)) / 2 f(2x + 1, 2y + 1) = (f(x, y) + f(x + 1, y) + f(x, y + 1) + f(x + 1, y + 1)) / 4
[0118] where f(x, y) represents the pixel value on the original image.
[0119] In an embodiment of the present disclosure, the decoding part combines the context information in the encoding part with the corresponding decoding part through image merging to complete the fusion of deep abstract features (features obtained in the decoding part) and shallow features (features obtained in the encoding part), and adds the context information of the original image in the decoding part, which is beneficial to complementing the lost boundary information and improving the accuracy of edge information prediction. In this way, through the combination method of convolutional learning of semantic information and position information, more features are obtained, the effect of small target segmentation is improved, and the result predicted by the model is more accurate.
[0120] In an embodiment of the present disclosure, the activation layer uses the rectified linear unit (ReLU), and the ReLU is a commonly used activation function in artificial neural networks, usually referring to non-linear functions represented by the ramp function and its variants.
[0121] Step S5: Train the initial gas-liquid two-phase flow independent bubble segmentation model based on the training data;
[0122] In an embodiment of the present disclosure, the evaluation metrics mean intersection over union (MIoU) and Kappa coefficient are introduced to measure the segmentation accuracy, so as to adjust the training parameters and optimize the model.
[0123] The mean intersection over union (MIoU) is a standard metric for image segmentation. It calculates the ratio of the intersection and union of the true value and the predicted value and then takes the average as shown in the following formula:
[0124]
[0125] Among them, k represents that there are k + 1 categories (including one background), and P ij represents the number of pixels that originally belong to class i but are predicted as class j, and P ii is the number of correctly predicted pixels.
[0126] The Kappa coefficient is used for consistency testing and can also be used to measure classification accuracy. Usually, the Kappa coefficient falls between [0, 1]. The calculation formula is:
[0127]
[0128] Among them, P o is the accuracy rate, that is, the sum of the number of correctly classified samples in each class divided by the total number of samples. Among them, a i is the number of true samples in each class, and b i is the number of samples predicted for each class. The Kappa value can be divided into 5 groups to represent different levels of consistency, as Figure 8 shown.
[0129] Figure 9 is the training flowchart of the Pretrain-VGG19-Unet model according to an embodiment of the present disclosure. As Figure 9 shown, based on the training data, the steps of training the initial Pretrain-VGG19-Unet model include:
[0130] Step S31, based on the feature extraction neural network VGG19 model, randomly initialize the parameters of the feature extraction part of the Pretrain-VGG19-Unet model;
[0131] Step S32, through the Pretrain-VGG19-Unet model, determine the output feature map of the gas-liquid two-phase flow bubble image in the training data;
[0132] Step S33, introduce the evaluation indicators mean intersection over union (MIou) and Kappa coefficient to measure the segmentation accuracy;
[0133] Step S34, calculate the MIou and Kappa values according to the number of correctly predicted pixels and the sample accuracy rate.
[0134] Step S35: Update the parameters of the image restoration part in the Pretrain-VGG19-Unet model according to the segmentation accuracy index. Based on the Pretrain-VGG19-Unet model with updated parameters, repeatedly execute Step S32, Step S33, and Step S34 until the segmentation accuracy reaches the preset value, and obtain the trained Pretrain-VGG19-Unet model.
[0135] In an embodiment of the present disclosure, updating the parameters of the feature extraction part in the Pretrain-VGG19-Unet model includes updating the parameters in the Pretrain-VGG19-Unet model based on the SGD (Stochastic Gradient Descent) optimization algorithm. The SGD optimization algorithm is an algorithm that optimizes the Pretrain-VGG19-Unet model through stochastic gradient descent. That is, when the SGD optimization algorithm updates the variable parameters, it selects the gradient value of a sample to update the parameters. SGD only uses one sample data to participate in the gradient calculation, so the process of summation and averaging is omitted, reducing the computational complexity and thus improving the computational speed.
[0136] Step S6: Based on the trained gas-liquid two-phase flow independent bubble segmentation model, obtain the bubble marked image in the gas-liquid two-phase flow to be segmented, and obtain the gas-liquid two-phase flow bubble image segmentation result.
[0137] Among them, the gas-liquid two-phase flow bubble image segmentation result is as Figure 10 shown.
[0138] In an embodiment of the present disclosure, the parameters of the feature extraction part of the Pretrain-VGG19-Unet model can be initialized through transfer learning, so that during the training process, only some parameters need to be fine-tuned, rather than retraining all parameters. On the one hand, this can deepen the model depth and is beneficial to improving the model accuracy. On the other hand, during the training process, based on transfer learning, the parameters of the pre-trained feature extraction neural network VGG19 model are used to initialize the model. Only the parameters of the feature extraction part need to be fine-tuned, and the parameters of the image restoration part are initialized and retrained, which improves the convergence speed and generalization ability of the model and saves training time.
[0139] The embodiments of the present disclosure described above are exemplary, not exhaustive, and are also not limited to the disclosed embodiments. Many modifications and variations are obvious to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The choice of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to technologies in the market, or to enable other ordinary skill in the art to understand the embodiments disclosed herein.
Claims
1. An image segmentation method for independent bubbles in gas-liquid two-phase flow, characterized in that, Including: Step S1, building a gas-liquid two-phase flow experimental device capable of changing the gas-liquid ratio; Step S2, using a high-speed camera to obtain gas-liquid two-phase flow images under different flow states in a vertical pipe; Step S3, obtaining training data, where the training data includes gas-liquid two-phase flow bubble images with different sizes and distribution states and the corresponding labeled images for each gas-liquid two-phase flow bubble image; Step S4, obtaining a pre-trained feature extraction neural network model and constructing an initial gas-liquid two-phase flow independent bubble segmentation model based on the feature extraction neural network model; The feature extraction neural network model is the VGG19 model in the Visual Geometry Group model; the initial gas-liquid two-phase flow independent bubble segmentation model is the Pretrain-VGG19-Unet model; The feature extraction neural network VGG19 model includes an input layer, m feature extraction convolutional structures, p fully connected structures, and an output layer, where m and p are both positive integers. Each feature extraction convolutional structure includes at least two convolutional layers and a pooling layer, and the fully connected structure includes multiple fully connected layers; The Pretrain-VGG19-Unet model includes: A feature extraction part, where the feature extraction part includes the input layer and the first n feature extraction convolutional structures of the feature extraction neural network VGG19 model, where n is a positive integer less than or equal to m; An image restoration part, where the image restoration part includes n image restoration convolutional structures and an output structure. Each image restoration convolutional structure includes at least two convolutional layers and an upsampling layer, and the output structure includes at least two convolutional layers and an output layer; Step S5, training the initial gas-liquid two-phase flow independent bubble segmentation model based on the training data; Step S6, based on the trained gas-liquid two-phase flow independent bubble segmentation model, obtaining the labeled image of the bubbles in the gas-liquid two-phase flow to be segmented, and obtaining the segmentation result of the gas-liquid two-phase flow bubble image.
2. The method for segmenting independent bubbles in a gas-liquid two-phase flow according to claim 1, wherein: In step S2, to obtain the gas-liquid two-phase flow image, the image signal of the gas-liquid two-phase flow bubble distribution under different working conditions is collected. In an experimental device composed of a vertical pipeline, a high-speed camera, and a computer, by collecting the image signals of different bubble distributions on the vertical pipeline, the gas and liquid flow rates are fixed and changed respectively to obtain the bubble distribution states under different gas-liquid flow rates, and the images thereof are collected.
3. The method for segmenting independent bubbles in a gas-liquid two-phase flow according to claim 2, wherein: The upsampling layer performs upsampling calculation on the image output by the previous convolutional layer.
4. The method for segmenting independent bubbles in a gas-liquid two-phase flow according to claim 3, wherein: The upsampling calculation includes the following steps: Step S21, upsampling. Based on the bilinear interpolation method, four coordinate points in the image output by the previous convolutional layer of the upsampling layer are used to confirm one coordinate point in the new image for image magnification; Step S22: Perform feature splicing and conduct operations using two 3×3 convolutional layers and the ReLU activation function; Step S23: Repeat Steps S21 and S22 four times; Step S24: Finally, connect a 1×1 convolutional layer for dimensionality reduction, that is, reduce the number of channels to a specific number, and output the segmentation map.
5. A method for segmenting independent bubble images of gas-liquid two-phase flow according to claim 4, characterized in that: The pooling layer adopts the max pooling method, and the sampling window is 2×2; the upsampling layer adopts the bilinear interpolation method.
6. An electronic device, characterized in that, It includes: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to call the instructions stored in the memory to execute the method according to any one of claims 1 to 5.
7. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, the method according to any one of claims 1 to 5 is implemented.