# Yielding Multi-Fold Training Strategy for Image Classification of Imbalanced Weeds
## 4 Methodology
The notation of the \(n^{th}\) maximum and minimum value in \(\mathcal{Y}\) is \(\max(\mathcal{Y},n),\min(\mathcal{Y},n)\). Instead of training the DNN model \(M\) directly on \(\mathcal{D}\), we create a fold \(f\) and train the model on this fold. Folds are established by randomly collecting \(\min(\mathcal{Y})\) samples of each species and placing them in \(f\). However, if the difference \(\epsilon\) between the minimum and nth minimum value in \(\mathcal{Y}\) is small, then we collect \(\min(\mathcal{Y},n)\) samples of each species and place them into \(f\), except we take all samples from a species containing a number of samples between \(\min(\mathcal{Y},1)\) and \(\min(\mathcal{Y},n-1)\). These perceptions lead us to come up with the MCMB procedure to divide samples into folds. First, we determine Min-Class in \(\mathcal{Y}\), which is \(M\text{Cargmin}(\mathcal{Y},1)\). Then, we form a set \(S=\{n_{i}\in\mathcal{Y}:n_{i}\leq\epsilon+\mathcal{Y}[MC]\}\) containing elements in \(\mathcal{Y}\) that are close to MC and determine Max-Bound of \(S\), which is \(MB\text{max}(S)\). For all species, we take \(\min(MB,n_{i})\) samples of species \(i\) in \(\mathcal{Y}\) and place them in \(f\). In practice, \(\epsilon\) is determined by an excess ratio \(k\in[0,1]\) to \(\mathcal{Y}[MC]\), which is \(k\cdot\mathcal{Y}[MC]\). This ratio aims to guarantee that the number of samples in the \"Max-Bound\" species cannot be more than 2 times greater than \(MC\) to avoid high imbalance distribution on \(f\). Algorithm 1 shows the algorithm of the YMufT strategy. The folds division process proceeds until all samples are being divided. In this process, \(A_{\text{temp}}\) is a list containing non-divided samples, and \(\mathcal{Y}\) consists of the number of samples in \(A_{\text{temp}}\). The MCMBprocedure is only applied on \(A_{\text{temp}}\). After establishing the 1 st fold, dividable samples are removed from \(A_{\text{temp}}\). Additionally, all samples in species \(MC_{1}\) are being divided, so \(\mathcal{Y}[MC_{2}]=0\). In the subsequent division, we select \(\min(\mathcal{Y}[i],MB_{2})\) samples for each species \(i\), except species \(MC_{2}\), for which we select \(\min(B[i],MB_{2})\) samples from \(A\), where \(A\) is a list containing all samples in \(\mathcal{D}\) and \(B\) is a set containing the number of samples in species \(y_{i}\) in the original training dataset. Generally, given the \(d^{th}\) fold division process, assume the MCMB procedure returns \(M\). We randomly select \(\min(\mathcal{Y}_{d}[i],MB_{d})\) if species \(i\) has non-divided samples or \(\min(B[i],MB_{d})\) if all samples in species \(i\) have already been divided. Figure 8 illustrates the YMuft strategy with five species. With \(k=0.5\), YMuft divides this data into four folds. By applying the MCMB procedure, all samples of minority species are divided into the first few folds. We randomly re-select these samples at the next folds while choosing non-divided samples of the majority species and appending them to those folds. This action means that samples of minority species are selected more frequently, and the model may focus on learning the feature characteristics of those species, hence reducing the degree of bias toward majority species. Assume a list \(\mathcal{F}\) contains \(q\) folds. We have the following two definitions:  
Figure 8: Illustration of the YMuft strategy, with \(k=0.5\). The original dataset contains 5 species: A, B, C, D, and E.  
**Definition 2**. : _A training period is when the model trains all a folds consecutively from the first fold \(f_{1}\) to the last fold \(f_{q}\)._  
**Definition 3**. : _A training loop is a process in which the model trains a fold on a finite loop._  
In the YMufT training strategy, we argue that training a model with \(\alpha\) loops on \(P\) periods is not beneficial because the number of samples in each fold is much smaller than \(N_{train}\), leading to overfitting if \(\alpha\) is set too high.