## 4 Materials and Methods
### Machine Learning Segmentation Process
#### 4.3.3 Training and Testing the Model  
An artificial neural network was utilized to perform the plant image segmentation, using a typical MLP architecture. MLP is a supervised neural network that maps a set of input features to a set of output in a feedforward propagation manner [41]. It is made of a set of processing elements (neurons) that forms different layers [42]. It has three main layers: input layer, one or more hidden layers, and output layer. The input layer takes in the values of the input data, while the output layer has one unit for each value of the MLP's output. (It has a single unit for regression or binary classification and M units for M-class classification.) The hidden layers are fixed between these two layers and are fully connected, transmitting information to the output layer. The neurons in the different layers are interconnected to each other through weights whose values are updated after a learning process [43]. The weights define the importance of the interactions between the neurons in order to control the errors in the output layer [44]. Inputs from the last hidden layer converge to a single value in the output layer [45]. The MLP is trained with a dataset X number of inputs: X = (x\({}_{1}\), x\({}_{2}\), x\({}_{3}\), x\({}_{4}\)\(\ldots\)\(\ldots\)\(\ldots\)\(x_{n}\)) and gives y number of outputs Y = (y\({}_{1}\), y\({}_{2}\), y\({}_{3}\)\(\ldots\)\(\ldots\)\(\ldots\)\(y_{n}\)), using a linear or nonlinear function f(. ): R\({}^{\mathrm{x}}\)\(\rightarrow\) R\({}^{\mathrm{y}}\)[46] to solve classification and regression problems. The success of an MLP network is dependent on parameters such as the activation function and loss error, which can be expressed mathematically as a linear combination, as shown in Equation (1) [47]:  
\[\mathrm{P}=\alpha_{0}[\sum_{j=1}^{n}\left(\mathrm{Wk_{j}\alpha_{h}}\sum_{j=1}^{ m}\left(\mathrm{Wj}X_{i}+\mathrm{Wj_{p}}\right)\right)+\mathrm{Wk_{b}}] \tag{1}\]  
where P is the predicted output; n is the number of output neurons; Wk\({}_{j}\) is the weight for the connecting neuron of hidden and output layers; \(\alpha_{h}\) is the hidden neuron's activation function; and m is the number of hidden neurons; Wj is the weight for the connectingneuron of input and hidden layers; \(X_{i}\) is the input variable; \(W_{jb}\) is the bias for the hidden neuron; \(Wk_{b}\) is the bias for the output neuron [48]; and \(\alpha_{h}\) and \(\alpha_{0}\) are the activation functions for the hidden neuron and the output neuron, respectively. The activation function is a key part of a neural network. It is a mathematical expression that defines how the weighted sum is transformed from one layer to another. Basically, it tells whether a node should be activated or not. It is calculated from the product of the weight and input and adding a bias. Commonly used activation functions include linear, sigmoid, rectified linear unit (ReLU), etc. The activation function is usually linear for regression problems and sigmoid or rectified linear unit for classification problems [47]. The default activation function for the hidden layers is ReLU. In this study, we employed a modified version of the MLP network used by [PERSON] and [PERSON] [49]. This network was trained on the principle of back propagation algorithm [50]. This algorithm involves the forward propagation of data to calculate the loss between the target and predicted value, followed by the backward propagation through weight adjustment to reduce the loss [51]. The weights are updated after each iteration based on the expression in Equation (2):  
\[W_{u}*=W_{o}-a\;(\frac{\partial Error}{\partial Wo}) \tag{2}\]  
where \(W_{u}*\) is the updated weight, \(W_{o}\) is the old weight, \(a\) is learning rate, and \(\partial Error\) is the derivative of error with respect to the weight. A preliminary study was conducted to select the number of hidden layers with the 12 input features per pixel.