Identification of the Structure of Liquid–Gas Flow in a Horizontal Pipeline Using the Gamma-Ray Absorption and a Convolutional Neural Network

: Knowledge of the liquid–gas flow regime is important for the proper control of many industrial processes (e.g., in the mining, nuclear, petrochemical, and environmental industries). The latest publications in this field concern the use of computational intelligence methods for flow structure recognition, which include, for example, expert systems and artificial neural networks. Generally, machine learning methods exploit various characteristics of sensors signals in the value, time, frequency, and time–frequency domain. In this work, the convolutional neural network (CNN) VGG-16 is applied for analysis of histogram images of signals obtained for water–air flow by using gamma-ray absorption. The experiments were carried out on the laboratory hydraulic installation fitted with a radiometric measurement system. The essential part of the hydraulic installation is a horizontal pipeline made of metalplex, 4.5 m long, with an internal diameter of 30 mm. The radiometric measurement set used in the investigation consists of a linear Am-241 radiation source with an energy of 59.5 keV and a scintillation detector with a NaI(Tl) crystal. In this work, four types of water–air flow regimes (plug, slug, bubble, and transitional plug–bubble) were studied. MATLAB 2022a software was used to analyze the measurement signal obtained from the detector. It was found that the CNN network correctly recognizes the flow regime in more than 90% of the cases.


Introduction
In many industrial and engineering processes, we deal with multiphase flows in pipelines and open channels.Liquid-gas flows manifest themselves in chemical and petrochemical plants, nuclear energy installations, condensers, power generation facilities, steam boilers, chemical reactors, food processing, and thermal engineering systems.For the precise design and operation of facilities that handle two-phase gas-liquid flows, knowledge of the flow parameters of individual phases, their mixing, and the flow structure is essential.In production systems, early identification of undesired flow regimes in the conduit is necessary.This is a challenging issue in mathematical description, which is why experimental and simulation techniques are often used, coupled with artificial intelligence methods, to address this purpose [1].
Diverse sensor techniques are also used in the study of liquid-gas flows.In the works [2][3][4], ultrasonic techniques were used in combination with artificial neural networks (ANNs) to identify and predict the structure of the two-phase flow.Differential pressure sensor applications are presented in publications [5][6][7].The authors of these works describe the use of ANN and adaptive neuro-fuzzy inference system to identify flow regime.The articles [8][9][10] present applications of capacitance and conductance sensors in the analysis of liquid-gas flows.In [9], wavelet variance data, principal component analysis, linear discriminant analyses, and the fuzzy c-means clustering algorithm were used to classify the type of flow.Optical techniques used in the study of two-phase flows are described in [11][12][13].In [11], a machine learning methodology based on support vector analysis was used to identify the flow regime using the map developed in this work.The article [13] describes the use of three types of convolutional neural networks to analyze oil-water flow images obtained with a camera.Other sensor techniques used in the analysis of two-phase flows include industrial tomography: electrical, optical [14][15][16][17], radiography: using X-rays and neutrons [18][19][20][21], accelerometers [22,23], impedance meter [24], wire-mesh sensor [25,26].An important method that has been used for many years in the study of two-phase flows is gamma radiation techniques, in particular the gamma-absorption method.A number of applications based on gamma-ray attenuation and scattering, combined with artificial intelligence methods for recognizing the flow structure and determining the void fraction, are described in the literature, e.g., [27][28][29][30][31][32].Diverse methods of computational intelligence have been applied for flow type classification in combination with nuclear technique, e.g., expert systems and ANNs: MLP, RBF, PNN, SVM, GMDH, CNN, RNN [28][29][30][31][32][33][34][35][36].
Generally, machine learning techniques use various features of signals from scintillation detectors extracted in the value, time, frequency, or time-frequency domain [27,30,[36][37][38].The probability density function (PDF) and the cumulative probability density function (CPDF) are characteristics of signals in the value domain and can be applied as input parameters for recognizing the flow structure using machine learning methods.This has been described in works using various sensor techniques: high-speed camera [39,40], differential pressure system [41], capacitance sensor [42], impedance meter [43], single-wire resistivity probe [44].
In this work, a convolutional neural network VGG-16 (Visual Geometry Group) was applied to analyze histogram images of signals obtained in water-air flow measurements using the gamma radiation absorption method.No descriptions of such an approach in the case of radioisotope measurements were found in the available literature.Measurement data were recorded in a laboratory stand to test two-phase flows in a horizontal pipeline built at the AGH University of Kraków.The stand allows for the implementation of various liquid-gas flow structures, such as slug, plug, plug-bubble, and bubble flow.MATLAB 2022a software was used to analyze the measurement signals.
This paper is organized as follows.Section 2 describes the principle of application of the gamma absorption method in two-phase flow measurements.The test station and the signals obtained are presented in the third section.Section 4 provides basic information on the convolutional neural network used.Section 5 describes the results obtained, and Section 6 presents a summary and conclusions of the research conducted.

Gamma Radiation Absorption Method in Liquid-Gas Flow Measurements
The technique of using gamma radiation absorption in measurements is based on the exponential attenuation of the γ radiation beam as a function of the geometric (thickness), physical (mass, density), and chemical (elemental composition) quantities of the absorbent [45].This is described by the Beer-Lambert law: where I 0 is the inlet to absorbent radiation intensity, I is the outlet intensity of the exit, d represent the thickness of the absorbing material, and η and µ are the density and mass absorption coefficient of this material, respectively.If the basic Equation ( 1) is applied to an air-water mixture, then the final equation is as follows: where the indices G, L, and P for η, µ, and d denote the gas, the liquid, and the pipe, respectively.
Changes in radiation intensity caused by flow of gas and liquid are recorded by scintillation probes and converted into electrical impulses.A typical measurement setup to test the two-phase flow by using the gamma absorption method is presented in Figure 1.
where the indices G, L, and P for η, µ, and d denote the gas, the liquid, and the pipe, respectively.
Changes in radiation intensity caused by flow of gas and liquid are recorded by scintillation probes and converted into electrical impulses.A typical measurement setup to test the two-phase flow by using the gamma absorption method is presented in Figure 1.A radioactive source, placed on one side of the pipe emits a beam of γ radiation (4) shaped by the collimator (1).Gamma photons penetrate the pipe (5) with the flowing liquid-gas mixture and are partially absorbed.The scintillation detector (2) with the collimator (3) are placed opposite the source on the opposite side of the pipeline.At the detector output, electrical impulses Ix(t) are obtained, shaped by the front-end system of the probe, and then recorded by an external data acquisition system.In the studies described in this article, a radiometric measurement system consisting of a linear Am-241 radiation source with an energy of 59.5 keV and a detector with a NaI(Tl) scintillation crystal was used.

Laboratory Station
The absorption measurement set described above was used at a laboratory station for testing two-phase flows using radioisotope methods, built at the AGH University of Kraków (Poland).A detailed description of the stand is presented in the works [33,38].The essential part of the hydraulic installation is a horizontal pipeline made of metalplex, 4.5 m long and with an internal diameter of 30 mm.A general view of the installation measurement section is presented in Figure 2. A radioactive source, placed on one side of the pipe emits a beam of γ radiation (4) shaped by the collimator (1).Gamma photons penetrate the pipe (5) with the flowing liquidgas mixture and are partially absorbed.The scintillation detector (2) with the collimator (3) are placed opposite the source on the opposite side of the pipeline.At the detector output, electrical impulses I x (t) are obtained, shaped by the front-end system of the probe, and then recorded by an external data acquisition system.In the studies described in this article, a radiometric measurement system consisting of a linear Am-241 radiation source with an energy of 59.5 keV and a detector with a NaI(Tl) scintillation crystal was used.

Laboratory Station
The absorption measurement set described above was used at a laboratory station for testing two-phase flows using radioisotope methods, built at the AGH University of Kraków (Poland).A detailed description of the stand is presented in the works [33,38].The essential part of the hydraulic installation is a horizontal pipeline made of metalplex, 4.5 m long and with an internal diameter of 30 mm.A general view of the installation measurement section is presented in Figure 2.
Figure 3, in turn, shows photos of exemplary structures of the flows analyzed obtained at the station: slug (3a), plug (3b), plug-bubble (3c), and bubble (3d).The water flow velocity (υ w ) and the air flow velocity (υ a ) are given in the caption of the figure.

Convolutional Neural Network
A convolutional neural network (CNN) is a structure that uses convolution operations [46][47][48][49][50].Most often, this type of network is used for image recognition.In the case of signal classification, the most popular is the use of a spectrogram at the network input (predictor).In this work, to classify the type of flow using a CNN, histogram images of signals obtained from scintillation detectors can be used as predictors.Histograms were determined for low-pass filtered signals (cut-off frequency 50 Hz established experimentally) from 20,000 sample segments.Histograms were made using a standard MATLAB procedure, which gives the number of classes (bins) on the horizontal axis and the number of elements in a given class on the vertical axis.

Convolutional Neural Network
A convolutional neural network (CNN) is a structure that uses convolution operations [46][47][48][49][50].Most often, this type of network is used for image recognition.In the case of signal classification, the most popular is the use of a spectrogram at the network input (predictor).In this work, to classify the type of flow using a CNN, histogram images of signals obtained from scintillation detectors can be used as predictors.Histograms were determined for low-pass filtered signals (cut-off frequency 50 Hz established experimentally) from 20,000 sample segments.Histograms were made using a standard MATLAB procedure, which gives the number of classes (bins) on the horizontal axis and the number of elements in a given class on the vertical axis.

Results
As already mentioned, the calculations were performed in the MATLAB environment.On the basis of the experiments performed, the following network options were used: network optimization algorithm: SGDM (stochastic gradient descent with momentum); learning coefficient value: 0.001; maximum number of epochs: 60; number of data analyzed by the network at a given moment (batch size): 4. The network was trained for histogram images with different numbers of classes: 28, 56, 112, and 224.The numbers of classes used are divisors of 224.On the basis of the test set, the trained network was tested and confusion matrices were plotted.These matrices for the abovementioned number of classes are shown in Figure 6.A set of 112 elements was used for training, 96 for testing, and 16 for validation.A plot of the loss function versus epochs for testing and validation is shown in Figure 7.The number of epochs was set to 60.The training process continued until the validation loss stopped fluctuating.The visible slight increase in the validation loss function (overfitting) does not reduce the accuracy of the test data.

Results
As already mentioned, the calculations were performed in the MATLAB environment.On the basis of the experiments performed, the following network options were used: network optimization algorithm: SGDM (stochastic gradient descent with momentum); learning coefficient value: 0.001; maximum number of epochs: 60; number of data analyzed by the network at a given moment (batch size): 4. The network was trained for histogram images with different numbers of classes: 28, 56, 112, and 224.The numbers of classes used are divisors of 224.On the basis of the test set, the trained network was tested and confusion matrices were plotted.These matrices for the abovementioned number of classes are shown in Figure 6   The following indicators were then calculated: accuracy (Acc), sensitivity (Sen), specificity (Spe), and precision (Prec) of the relationship [52,53]: The following indicators were then calculated: accuracy (Acc), sensitivity (Sen), specificity (Spe), and precision (Prec) of the relationship [52,53]:  The results obtained are presented in Tables 1-4.The results obtained are presented in Tables 1-4.The indicator values in Tables 1-3 indicate good recognition results.Precision (Table 4) indicates how much trust the model obtained when it predicts that the recognition result will be positive.On the basis of the precision and sensitivity indicators, the values of the F1 coefficient were calculated (Table 5), which is their harmonic mean and is described by the relationship [53]: The values of the F1 indicator are in the interval [0, 1], where the minimum is achieved for TP = 0, i.e., when all positive samples are misclassified, and the maximum for FN = FP = 0, i.e., for error-free classification.Two main features distinguish F1 from accuracy: F1 is independent of TN and is not symmetric in the case of class swapping [53].The obtained values of the F1 indicator are good in all cases, i.e., the coefficient is greater than 0.8.The best results were obtained for the slug flow.

Conclusions
This article presents the possibility of using CNN to identify the structure of liquidgas flow in a horizontal pipeline based on the analysis of signals from a radiometric measurement system.The tests were performed for four types of flows: slug, plug, plugbubble, and bubble.At the input of the VGG-16 network, available in the MATLAB environment, histogram images with a size of 224 × 224 pixels, built for signals from the scintillation detector, were used as predictors.To compare the results, histograms were made for different numbers of classes: 28, 56, 112, and 224.For all four types of flows and all numbers of classes, good recognition results were obtained, which is confirmed by the calculated indices (values above 0.8).The best recognition (values of all indicators equal to 1) was obtained for the slug flow.
The classification results obtained may be useful in radiometric measurements of two-phase liquid-gas flows in pipelines, in which the velocities (or flow rates) and the

Figure 3 ,
Figure 3, in turn, shows photos of exemplary structures of the flows analyzed obtained at the station: slug (3a), plug (3b), plug-bubble (3c), and bubble (3d).The water flow velocity (υw) and the air flow velocity (υa) are given in the caption of the figure.

Figure 3 .
Figure 3. Examples of water-air flow regimes in a horizontal pipeline: (a) slug, υw = 0.94 m/s, υa = 1.25 m/s; (b) plug, υw = 1.09 m/s, υa = 1.60 m/s; (c) plug-bubble, υw = 1.18 m/s, υa = 2.15 m/s; (d) bubble, υw = 1.48 m/s, υa = 3.19 m/s.The data acquisition system includes a dedicated counter card connected to a PC via USB.Voltage pulses Ix(t) were recorded at a sampling frequency of 1 kHz for 3 min, allowing the obtainment of signals x(t).The signals for the types of flows analyzed, after the centering operation, are presented in Figure 4.

Figure 3 ,
Figure 3, in turn, shows photos of exemplary structures of the flows analyzed obtained at the station: slug (3a), plug (3b), plug-bubble (3c), and bubble (3d).The water flow velocity (υw) and the air flow velocity (υa) are given in the caption of the figure.

Figure 3 .
Figure 3. Examples of water-air flow regimes in a horizontal pipeline: (a) slug, υw = 0.94 m/s, υa = 1.25 m/s; (b) plug, υw = 1.09 m/s, υa = 1.60 m/s; (c) plug-bubble, υw = 1.18 m/s, υa = 2.15 m/s; (d) bubble, υw = 1.48 m/s, υa = 3.19 m/s.The data acquisition system includes a dedicated counter card connected to a PC via USB.Voltage pulses Ix(t) were recorded at a sampling frequency of 1 kHz for 3 min, allowing the obtainment of signals x(t).The signals for the types of flows analyzed, after the centering operation, are presented in Figure 4.

Figure 3 .
Figure 3. Examples of water-air flow regimes in a horizontal pipeline: (a) slug, υ w = 0.94 m/s, υ a = 1.25 m/s; (b) plug, υ w = 1.09 m/s, υ a = 1.60 m/s; (c) plug-bubble, υ w = 1.18 m/s, υ a = 2.15 m/s; (d) bubble, υ w = 1.48 m/s, υ a = 3.19 m/s.The data acquisition system includes a dedicated counter card connected to a PC via USB.Voltage pulses I x (t) were recorded at a sampling frequency of 1 kHz for 3 min, allowing the obtainment of signals x(t).The signals for the types of flows analyzed, after the centering operation, are presented in Figure 4.
Figure 5 shows sample histogram images (number of 112 classes) for the flow types analyzed.Images are stripped of titles, legends, and axis descriptions so that such data do not negatively impact the training process.The network used for training is a modified VGG-16 network available in the MATLAB 2022a environment [51].This network was originally created for training, on the basis of the ImageNet database.For the purposes of calculations, layer 14 (changed the classifier input to "auto", forced by the smaller size of the training set) and layer 16 (changed the classifier output from 1000 to 4) were changed.Histogram images with a size of 224 × 224 pixels were fed into the network input.
Figure 5 shows sample histogram images (number of 112 classes) for the flow types analyzed.Images are stripped of titles, legends, and axis descriptions so that such data do not negatively impact the training process.The network used for training is a modified VGG-16 network available in the MATLAB 2022a environment [51].This network was originally created for training, on the basis of the ImageNet database.For the purposes of calculations, layer 14 (changed the classifier input to "auto", forced by the smaller size of the training set) and layer 16 (changed the classifier output from 1000 to 4) were changed.Histogram images with a size of 224 × 224 pixels were fed into the network input.
. A set of 112 elements was used for training, 96 for testing, and 16 for validation.A plot of the loss function versus epochs for testing and validation is shown in Figure 7.The number of epochs was set to 60.The training process continued until the validation loss stopped fluctuating.The visible slight increase in the validation loss function (overfitting) does not reduce the accuracy of the test data.
TP positive) are the elements that have been labeled as positive by the model and they are actually positive, FP (false positive) are the elements that have been labeled as positive by the model but they are actually negative, TN (true negative) are the elements that have been labeled as negative by the model and they are actually negative, and FN (false negative) are the elements that have been labeled as negative by the model but they are actually positive.TP (true positive) are the elements that have been labeled as positive by the mo and they are actually positive, FP (false positive) are the elements that have been labe as positive by the model but they are actually negative, TN (true negative) are the ments that have been labeled as negative by the model and they are actually negat and FN (false negative) are the elements that have been labeled as negative by the mo but they are actually positive.

Figure 7 .
Figure 7. Plot of loss function versus epochs for testing and validation.

Figure 7 .
Figure 7. Plot of loss function versus epochs for testing and validation.

Table 1 .
Values of the "accuracy" indicator.

Table 2 .
Values of the " sensitivity" indicator.

Table 1 .
Values of the "accuracy" indicator.

Table 2 .
Values of the " sensitivity" indicator.

Table 3 .
Values of the "specificity" indicator.

Table 4 .
Values of the "precision" indicator.