## 3 Experiment Results
### Building and Verifying the Deep Learning Model Architecture
Through a grid search, the hidden layers \(y^{(1)}\), \(y^{(2)}\), and \(y^{(3)}\) are set to possible maximum neuron quantities of 64, 32, and 16, respectively, ensuring that the neural network can accurately classify inputs. This setup facilitates the study in handling varying quantities of input vectors. Simultaneously, for a dropout rate vector denoted as \(r\), for each neuron \(j\) within each layer \(l\), a probability \(p\) is stochastically generated using a Bernoulli distribution, which is expressed as follows,  
\[r_{j}^{(l)}\sim Bernoulli(p), \tag{9}\]  
The Bernoulli distribution is a random process to create the dropout mask (the binary mask applied to the input units), where each unit has a certain probability \(p\) of being \"dropped out\" (set to zero). The network with the dropout mechanism can be redefined as follows,  
\[ \begin{split}\overset{\cdot}{y}^{(l)}&=r^{(l)}*y^{ (l)},\\ z_{i}^{(l+1)}&=w_{i}^{(l+1)}\overset{\cdot}{y}^{(l)} _{i}+b_{i}^{(l+1)},\\ z_{i}^{(l+1)}&=f^{(l)}\left(z_{i}^{(l+1)}\right), \end{split}  \tag{10}\] \begin{table}
\begin{tabular}{c c c c c} \hline
**No. of Neurons** & **No. of Hidden Layers** & **Batch Sizes** & **Epochs** & **Dropout Rates** \\ \hline
16, 32, 64 & 2, 3 & 16, 32, 64 & 500, 1000 & 0.2, 0.3 \\ \hline \end{tabular}
\end{table} 
Table 1: Hyperparameter grid. where \(l\) denotes the layer number, \(y^{(l)}\) represents the output of layer \(l\), \(y^{(0)}\) is the input vector, \(w\) and \(b\) are the weight and bias values, \(i\) is the neuron index within the hidden layer, and \(f^{(l)}()\) represents the activation function of layer \(l\). As the dropout mechanism can selectively deactivate the activation function of neurons during the prediction process, it supports the network to prevent overfitting. Further fine tuning was conducted to determine the number of intervals for data segmentation based on the coffee granule size distribution and the choice of activation function. The granule size distributions obtained from the same image, divided into four different intervals: 16, 21, 31, and 61, are given in Figure 15.  
As shown in Figure 15, when the interval length is 61, the coverage range is denser, and its characteristics have obvious fluctuations; when the interval length is 16, the coverage range is wider, and the fluctuations of its characteristics are relatively gentle. Therefore, the number of intervals affects the characteristics of the model input data. In order to find the appropriate number of intervals, we must conduct experimental comparisons of different numbers of intervals. The initial activation function ReLU can be regarded as an equal function of positive input, and it always maintains a gradient of one, so it can improve the vanishing gradient problem of deep learning models. However, for negative input values, the output of ReLU and its gradient are always zero, which causes the weights to not be updated when the input value is negative. In order to know whether ReLU is still a good choice for the hidden layers of this deep learning model, the experiment also used tanh in (5) as another activation function to compare with ReLU in detail. In order to improve the detectability of the training results, the training and test sets were redistributed five times, resulting in a total of five sets of training results for comparison. Such a method can reduce the impact of accidental factors on training results and increase the stability and reliability of the model. When the trained deep learning model used ReLU as the activation function, the training results of four different intervals used as the input number are given in Table 2, and the test results are given in Table 3. It is observed from these results that no matter which interval is used, the accuracy of training as well as testing reached more than 95%. From Tables 1 and 2, it is observed that the training accuracy of 61 intervals is higher than that of 31 intervals, while the test accuracy of 61 intervals is lower than that of 31 intervals.