**1. Introduction**

Froth flotation is a physical and chemical process that occurs at the three-phase interface of solids, liquids, and gases, and is used to separate valuable minerals from gangue. Froth flotation is an industrial process of processing minerals. The flotation process is affected by a variety of operating variables, such as slurry level, pH value, and reagent dosage [1]. Of all operating variables, the reagent dosage is the most critical [2]. The zinc flotation process is a typical complex industrial system, and it is difficult to recognize a clear mechanism to establish a first principle model [3]. At present, the method of controlling the reagent dosage in the actual flotation process is mainly achieved by the operator observing the surface characteristics of the froth image, such as bubble size, texture, and gray value [4].

With the development of advanced technologies such as industrial automation, cloud computing, and artificial intelligence, the modeling, monitoring, and control of complex industrial systems have new technical support [5]. In reference [6], deep reinforcement learning is applied to the boost control of diesel engines. The results show that the performance is better than the traditional proportion integral derivative (PID) controller. In the reference [7], the intelligent algorithm is applied to the optimal sitting and sizing of a distributed generation system, which improves the economic benefits and safety of the distributed generation system.

In recent years, many scholars have studied the method of controlling the reagent dosage in the flotation process [8–10]. In reference [11], a control strategy based on the sensitive features of froth images is proposed. The strategy proposed to adjust the reagent dosage based on the feed grade, and established a model of feed grade estimation based on the sensitive features of the froth image. Then, based on the operation mode method, the reagent dosage is preset according to the feed grade. However, it only analyzes the froth image of a single moment, and it is difficult to avoid the noise effect of single frame image. In reference [12], the authors analyzed the effect of reagent dosage on performance indicators, and then proposed a collaborative optimization method for reagent dosage based on key feature changes and case-based reasoning. The proposed method achieved a certain effect on the antimony flotation process, but it was difficult for the method to overcome the time lag problem on the flotation process. In reference [13], the case-based reasoning method was used to optimize the control of the reagent dosage in the magnetite flotation process, the results show that the method reduces the fluctuation of tailings grade, but it was difficult to deal with the disturbance in the flotation process.

In reference [14], it is pointed out that the visual features of the froth image play an important role in the flotation process. In reference [15], the Wasserstein Distance-Based CycleGAN method was used to measure the color features of the froth image, and the color features were applied to guide the flotation process of bauxite. In reference [16], the author introduced the biologically inspired Gabor wavelet transform to extract the texture features of froth images, and applied the texture features to the online state recognition of the flotation process.

Among all visual features of the froth image, the bubble size is the most critical [17]. In reference [18], the authors modeled the relationship between flotation process performance and bubble size of froth through neural networks. The results prove that the average bubble size of the froth image is very important to guide the stability of the flotation process. In reference [19], a control strategy is proposed to optimize the recovery of valuable minerals by tracking the expected bubble size distribution. In reference [20], a control strategy based on bubble size distribution is proposed to control the reagent dosage by minimizing the difference between the output bubble size distribution and the optimal bubble size distribution. In reference [21], the feedback controller maintains the probability density function of bubble size at the setpoint through the reagent dosage. In reference [22], the method used the bubble size probability density function to characterize the froth state. The reagent dosage is optimally controlled by minimizing the difference between the current bubble size probability density function and the optimal bubble size probability density function.

The features of the froth image in the zinc flotation process can reflect the working conditions of the flotation process, and the bubble size is the most obvious among all the features. In this paper, the bubble size cumulative distribution function (CDF) is used as a new feature of the froth image, and the estimation method of bubble size CDF is proposed. Because the change of reagent dosage will cause the froth image features to change continuously with time, this paper analyzes the relationship between the time series of bubble size CDF and the reagent dosage. Compared with the single-frame bubble image feature at a single moment, the time series froth image feature can reduce the influence of noise. The proposed method does not require manual participation, avoids the disadvantages of unstable performance indicators, and large reagent consumption due to differences in manual experience in the zinc flotation process, which is conducive to improving the economic benefits of the flotation plant.

The rest of the paper is structured as follows. A description of the process is presented in Section 2. The method for the estimation of bubble size CDF is shown in Section 3. The reagent dosage intelligent setting based on time series of bubble size CDF is discussed in Section 4. The industrial experiment and discussion are contained in Section 5. Section 6 draws the conclusions of this article.

### **2. Process Description**

In the actual production process, the zinc flotation process is often accompanied by lead flotation, and this work focuses on the zinc flotation process. The simplified process of zinc flotation process is shown in Figure 1.

**Figure 1.** Flow diagram of the zinc flotation process.

The purpose of the zinc flotation process is to extract zinc elements from sphalerite. The zinc element in the slurry mainly exists in the form of zinc sulfide (ZnS). After the chemical reaction between the slurry and the reagent, the froth layer and underflow are formed in the flotation bank. In the zinc flotation process, the reagent is made up of foaming reagent (ROH), activating reagent (CuSO4), capture reagent (C4H9OCSSNa) and PH adjustment reagent (H2SO4 and Ca(OH)2), according to a certain proportion.

The capacity of the flotation bank is about 2.8 m3, with a flow rate of 1.5 m3/min–3 m3/min. The zinc flotation process includes the following stages: first zinc rougher, zinc rougher I, zinc rougher II, zinc cleaner I and zinc cleaner II, zinc cleaner III, and zinc scavenger. The slurry and reagent react chemically in the agitated tank, and a large amount of bubbles are generated under the action of the foaming agent. The zinc minerals adhere to the bubble surface to form mineralized bubbles, overflow from the first zinc rougher bank, and enter the zinc cleaner I. At the same time, the water-soluble material forms an underflow in the first zinc rougher bank and flows into the zinc rougher I. The same principle is followed in the subsequent flotation process. Finally, the zinc concentrate product is obtained from the zinc cleaner III bank, and the underflow in the zinc scavenger bank forms tailings.

The reagent acting in the first zinc rougher bank has an important influence on the final performance index (concentrate grade, tailing grade) in the zinc flotation process. The zinc flotation process has a long flow, severe time lag, many operating variables, and strong coupling, resulting in a very complicated zinc flotation process mechanism, making it difficult to establish an accurate dynamic model. Currently, the flotation plant controls the dosage of reagent manually. The method for controlling the reagent dosage in the zinc flotation process is as follows: the operator repeatedly inspects the froth state in the flotation process, and judges the reagent dosage according to production experience. In the process, the operator's experience becomes extremely important. However, the experience level of different operators is very different, and it is difficult to ensure that the operating variables of the complex flotation process remain stable. A zinc flotation process monitoring system was established by installing a camera at the first zinc rougher bank [23]. Collecting and analyzing froth images through a monitoring system to reduce manual participation is a prerequisite for achieving automatic reagent control.

#### **3. Estimation Method of Bubble Size CDF**

In this paper, bubble size CDF is used to characterize the bubble size distribution. When determining a series of random variables *x*, if there is an integrable probability density function *p*(*x*) on the real axis, the CDF is expressed as:

$$c(\mathbf{x}) = \int\_{-\infty}^{\mathbf{x}} p(t)dt\tag{1}$$

In the Equation (1), *x* represents the bubble size, and *p*(*x*) is the probability density function of the bubble size. We use the flotation process monitoring system to obtain 2-D froth images under different working conditions in the zinc flotation process, as shown in Figure 2. Class 1 appears in the case of under-dosing, class 2 appears in the case of normal dosing, and class 3 appears in the case of over-dosing.

**Figure 2.** The typical froth images in zinc flotation process.

The resolution of the froth image captured by the camera in the flotation monitoring system is 692 × 518. With the original watershed algorithm it is difficult to accurately segment images such as the froth image without background, and this paper uses an improved watershed algorithm to segment the froth image to get the number of pixels contained in a single bubble [24]. The bubble size CDF of the different classes of the froth image is shown in Figure 3.

**Figure 3.** Bubble size cumulative distribution function (CDF) of different class froth image.

The standard sigmoid function expression:

$$s(\mathbf{x}) = \frac{1}{1 + e^{-\mathbf{x}}} \tag{2}$$

The shape of the sigmoid function in the first quadrant of the coordinate system is highly similar to the shape of the bubble size CDF, so it will be feasible to estimate the bubble size CDF with the sigmoid kernel function. Here, we use a sigmoid kernel function to estimate the CDF of bubble size. Expressed as:

$$\mathfrak{cl}(\mathfrak{x}) \approx \mathfrak{c}(\mathfrak{x}) = \frac{a}{1 + e^{-b\mathfrak{x} + \mathfrak{c}}} - d \tag{3}$$

The parameters *a*, *b*, *c*, *d* determine the shape of the CDF. The parameters *a*, *b*, *c*, *d* were obtained using the least-squares algorithm [25].

$$\min\_{a,b,c,d} \sum\_{j=1}^{N} \left( c(x\_j) - \varepsilon(x\_j) \right)^2 \tag{4}$$

where *N* is the estimated sample size, *c xj* is the CDF value when the bubble size is *xj*, and *c*ˆ(·) is the sigmoid kernel estimated value.

Figure 4 shows the experimental results of estimating the bubble size CDF using the sigmoid kernel function.

**Figure 4.** The estimation of bubble size CDF for different froth images: (**a**) class 1, (**b**) class 2, (**c**) class 3.

#### **4. Reagent Dosage Intelligent Setting Based on Time Series of Bubble Size CDF**

During the zinc flotation process, the bubble size CDF has an important influence on the grade of concentrate and tailing. The bubble size CDF under different working conditions shows different shapes. In this paper, the structure diagram of the intelligent setting of the reagent dosage based on time series froth image is shown in Figure 5.

**Figure 5.** The structure diagram of the reagent dosage intelligent setting based on time series froth image.

Froth images of the first zinc rougher were captured by the camera. After the bubble image was segmented, the sigmoid kernel function was used to estimate the bubble size CDF, and the sigmoid kernel function parameters were used to characterize the CDF shape of bubble size. In the reagent dosage setting method, ELMo was used to process the time series features to obtain dynamic feature vectors, and XGBoost was used to establish the nonlinear relationship model between the dynamic feature vectors and the reagent dosage. In this way, the intelligent setting of the reagent dosage was realized.

#### *4.1. Time Series Processing by Elmo*

The ELMo model was proposed by Peter for natural language processing in 2018 [26]. Due to its efficient performance, ELMo has always been regarded as one of the excellent word embedding models. ELMo can recognize polysemy after training, that is, different word expresses a different meaning in different sentences. In the zinc flotation process, the current froth image is affected by the previous froth image, the time-series froth image after ELMo processing can express a deeper meaning.

ELMo model training is mainly divided into two steps. The first step is to build a bidirectional language model (biLM) based on LSTM, and adjust the model parameters through large-scale corpus training. The second step is to input the text into the ELMo model, and the weighted combination biLM multilayer output state is output as a dynamic feature vector. Its model structure is shown in Figure 6.

**Figure 6.** The framework of ELMo.

It is assumed that a continuous sequence *t*1, *t*2, ... , *tN* containing *N* tokens is given. The forward expression and backward expression are used to represent the relationship between the current token and the time series tokens before and after it.

The forward expression is:

$$p(t\_1, t\_2, \dots, t\_N) = \prod\_{k=1}^{N} p(t\_k | t\_1, t\_2, \dots, t\_{k-1}) \tag{5}$$

The backward expression is:

$$p(t\_1, t\_2, \dots, t\_N) = \prod\_{k=1}^{N} p(t\_k | t\_{k+1}, t\_{k+2}, \dots, t\_N) \tag{6}$$

The forward expression means predicting the current token through the previous *N* − 1 tokens, and the backward expression means predicting the current token through the following *N* − 1 tokens.

The objective function combines forward expression and backward expression. The meaning of the current token in the time series is determined by maximizing the likelihood probability of the objective function. This expression is shown in Equation (7).

$$\sum\_{K=1}^{N} \left( \log p(t\_k | t\_1, t\_2, \dots, t\_{k-1}, \Theta\_{\mathbf{x}\_\prime} \overrightarrow{\Theta}\_{\mathrm{LSTM}} \Theta\_\mathbf{s}) + \log p(t\_k | t\_{k+1}, t\_{k+2}, \dots, t\_{\mathcal{N}\_\prime} \overrightarrow{\Theta}\_{\mathbf{x}\_\prime} \overleftarrow{\Theta}\_{\mathrm{LSTM}} \Theta\_\mathbf{s}) \right) \tag{7}$$

Among them, Θ*<sup>x</sup>* represents the initial word embedding vector of the input biLM model, <sup>Θ</sup>*<sup>s</sup>* represents the output of the LSTM layer input to softmax, <sup>→</sup> <sup>Θ</sup>*LSTM* represent the forward LSTM layer, <sup>←</sup> Θ*LSTM* represent the backward LSTM layer.

The dynamic feature vector is equal to the weighted combination of the output vectors of each LSTM layer, as shown in Equation (8).

$$ELMo = \gamma \sum\_{j=0}^{2} \alpha\_j J\_{k,j}^{LM} \tag{8}$$

where α*<sup>j</sup>* is the weight of word embeddings in different layers, and it is a scalar parameter. *hLM <sup>k</sup>*,*<sup>j</sup>* is the vector output from the *jth* layer LSTM.

The dynamic feature vector of the froth image features obtained by ELMo can characterize the state of the froth image over a period of time. In this paper, the time series bubble size CDF *c*(*t*1), *c*(*t*2), ... , *c*(*tn*) used to train ELMo. The output of the top LSTM in biLM is selected as the dynamic feature vector of ELMo.

#### *4.2. Nonlinear Relationship Modeling by Xgboost*

Chen et al. proposed the XGBoost algorithm in 2016 [27]. XGBoost is an efficient integrated learning method, and a few other integrated learning methods can be better than the configured XGBoost. XGBoost algorithm performs a second-order Taylor expansion of the loss function, and uses the complexity of the tree structure as a regular term, which can effectively avoid overfitting. In addition, XGBoost supports multi-threaded and can make full use of the machine's CPU core, thereby improving the speed and performance of the algorithm.

When there are *n* samples in a given dataset *D* = (*Xi*, *yi*) (|*D*| = *n*, *Xi* ∈ R*<sup>m</sup>* , *yi* ∈ R), each sample contains m-dimensional features. XGBoost is used as a regression model to determine the estimated value *y*ˆ*<sup>i</sup>* through the input feature *Xi*. XGBoost is trained through dataset *D*, and *K* trees are constructed. The accumulated value of these *K* trees is the output value. Expressed as:

$$\mathfrak{H}\_i = \phi(X\_i) = \sum\_{k=1}^{K} f\_k(X\_i)\_{\prime \prime} f\_k \in F \tag{9}$$

where *<sup>F</sup>* = *f*(*x*) = ω*q*(*x*) *q* : R*<sup>m</sup>* → *T*, ωR*<sup>T</sup>* is the feature space of decision trees. T is the number of leaves in a tree. XGBoost is trained by minimizing the objective function. The objective function is shown in Equation (10).

$$L = \sum\_{i} l(\hat{g}\_{i\prime} y\_i) + \sum\_{k} \Omega(f\_k) \tag{10}$$

where Ω(*fk*) = γ*T* + <sup>1</sup> <sup>2</sup>λ||ω||<sup>2</sup> represents the penalty term, which can reduce the risk of overfitting. γ represents the regularization parameter, λ means L2 regularization. *l* is a differentiable convex loss function. The second-order Taylor expansion of the loss function in the objective function is shown in Equation (11).

$$\widetilde{L}^{(t)} \simeq \sum\_{i=1}^{n} \left[ \mathbf{g}\_i f\_t(\mathbf{x}\_i) + \frac{1}{2} h\_i f\_t^2(\mathbf{x}\_i) \right] + \Omega(f\_t) \tag{11}$$

where *gi* = ∂*y*ˆ(*t*−1)*l*(*y*ˆ (*t*−1) *<sup>i</sup>* , *yi*) and *hi* <sup>=</sup> <sup>∂</sup><sup>2</sup> *y*ˆ(*t*−1)*l*(*y*<sup>ˆ</sup> (*t*−1) *<sup>i</sup>* , *yi*) are the first and the second order gradient statistic on the loss function.

By training XGBoost, a nonlinear relationship model of bubble size CDF time series and reagent dosage is established. The input is the dynamic feature vector generated by ELMo processing of the bubble size CDF time series, and the output is the reagent dosage.

#### **5. Experiment and Discussion**

The purpose of this work is to make a reasonable set value of the reagent dosage by analyzing the time series of the froth image of the first zinc rougher bank.

After the reagent works, the froth image of the first zinc rougher bank will respond first, and the froth of the first zinc rougher bank will affect the concentrate grade and tailing grade. When the dosage of the reagent is set low, the bubble size in the froth image is larger, indicating that there are fewer minerals attached to the surface of the bubble, which ultimately leads to a lower concentrate grade and a higher tailing grade. When the dosage of reagent is set higher, the result is the opposite. Figure 7 shows the different concentrate grades and tailing grades corresponding to different froth images.

**Figure 7.** Typical froth image corresponds to concentrate grade and tailing grade.

In order to verify the intelligent setting method of reagent dosage, we collected 7 consecutive days of industrial data from a zinc flotation plant in China to train the relevant models in the proposed method. During the zinc flotation process, the operator recorded operating variables, including reagent dosage, concentrate grade, and tailing grade. The flotation monitoring system collects the froth image of the first zinc rougher bank in real time. The froth images at the first zinc rougher bank are captured at a rate of 1 frame/5 min; the concentrate grade and tailings grade are obtained using X-ray analysis instruments.

The design of ELMo's biLM consists of two bidirectional LSTMs. Each LSTM network layer consists of 512 cells, followed by a softmax layer. The initialization XGBoost parameters are as follows: boost tree depth max\_depth = 5, learning rate learning\_rate = 0.1, number of iterations n\_estimators = 160. Figure 8 shows the reagent dosage obtained by simulation using the proposed method, and the real reagent dosage.

**Figure 8.** The proposed method is used to simulate the set value and real value of the reagent dosage.

To verify the feasibility of the proposed method, we applied it to a zinc flotation plant in China and recorded data in real time. According to the duty arrangement of the flotation plant, it is divided into three shifts of the morning shift, noon shift and night shift, each shift is 8 h. During each shift we recorded the relevant data and statistics. Figure 9 shows the set value of the reagent dosage for three shifts.

**Figure 9.** Using the proposed method for the dosage of reagent during the experiment.

According to further statistics, the total consumption of reagents on that day was 5620.32 L. Figures 10 and 11 show the test results of concentrate grade and tailing grade for three shifts.

**Figure 10.** Using the proposed method for the concentrate grade during the experiment.

**Figure 11.** Using the proposed method for the tailing grade during the experiment.

According to the requirements of China's zinc flotation plant, it is necessary to stabilize the concentrate grade at about 54% and the tailings grade at about 0.35%. The results show that the proposed method can meet the production requirement.

The traditional dosage of reagents in the flotation process is determined by manual experience. It is worth noting that manual experience is different due to individual differences. Because the flotation plant is divided into three shifts in the morning, middle and evening, different people work. Figures 12 and 13 show the changes of concentrate grade and tailings grade from 21 to 23 March 2020 using the proposed method and manual method.

Table 1 summarizes the performance index evaluation parameters of the proposed method and manual method, where *Mean* represents the average and σ<sup>2</sup> represents the variance.

**Table 1.** Performance index evaluation parameters of the proposed method and manual method.


The method proposed in this paper does not require manual participation, which reduces the employment cost of the plant. In addition, the experimental results show that the proposed method has a better control effect on the concentrate grade and tailings grade than the manual method.

**Figure 12.** Comparison of change in concentrate grade by proposed method and manual method.

**Figure 13.** Comparison of change in concentrate grade by proposed method and manual method.

#### **6. Conclusions**

In this work, a method for intelligently setting the reagent dosage based on the time series froth image in the zinc flotation process is proposed. In this paper, the bubble size CDF is used as a new feature of the froth image, and the estimation method of bubble size CDF is proposed. Because the change of reagent dosage will cause the froth image features to change continuously with time, this paper uses the ELMo model to process the bubble size CDF time series, and generates dynamic feature vectors based on the bubble size CDF time series. Compared with the single frame froth image feature at a single moment, the dynamic feature vector can reduce the influence of noise in the flotation process. Finally, the efficient XGBoost algorithm was used to establish the nonlinear relationship model between the dynamic feature vectors and the dosage of reagent in the flotation process. The industrial experiment results show that the proposed method can stabilize the concentrate grade and tailing grade more than the traditional manual method in the zinc flotation process. In addition, the proposed method does not require manual participation, avoids inconsistent product quality due to differences in manual experience, and improves the economic benefits of the flotation plant.

**Author Contributions:** Z.T. performed data curation and provided the funding; L.T. conceived the methodology and wrote the original draft; G.Z. performed the review; Y.X. performed the formal analysis; J.L. provided research materials. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by NSFC—Guangdong joint fund of key projects (No. U1701261), National Natural Science Foundation of China (No. 61771492).

**Acknowledgments:** The authors would like to acknowledge the research support from the NSFC—Guangdong joint fund of key projects (No. U1701261) and National Natural Science Foundation of China (No. 61771492).

**Conflicts of Interest:** The authors declare that the article will be reported without any conflict of interest.
