## 2 Materials and Methods
### Introduction to Deep Learning Model  
In this research, the coffee granule sizes and their distribution are the concerned features because the coffee chain regularly relies on using sieves or meshes to separate different coffee granule sizes and determine the relation between coffee taste and coffee granule size distribution. Other than burr wear classification, they also want to know if the image processing technique can obtain similar results of coffee granule size distribution. Therefore, a two-step approach is required, i.e., applying image processing to obtain the coffee granule size distribution and then using a deep learning model for burr wear classification. The main purpose of training the deep learning model is to have high prediction accuracy. It is essential to strike a balance between model complexity and the available data, as overly complex models can lead to overfitting, while overly simple models may underfit the data. Multiple-layer deep learning models stem from neural networks. Neural networks consist of interconnected nodes called neurons, which are organized into input layers, hidden layers (zero or more), and output layers. The input layer receives the initial data, and the output layer produces the final result. Each connection between neurons has a weight associated with it. These weights determine the strength of the connection. The activation function [46] is a nonlinear function that converts input signals into output signals in neural networks. The activation function introduces nonlinearity into the network, allowing it to learn complex patterns. Neurons in each layer receive inputs, apply the activation function to the weighted sum of those inputs, and pass the result to the next layer, as shown in Figure 9.  
Neural networks learn by adjusting the weights of their connections to minimize the loss function during training iterations, allowing them to predict or classify a wide range of data. Before training a deep learning model, one has to set up hyperparameters that are not learned from the training data but instead have to be predefined. In this research, Keras [54] in an open-source machine learning framework TensorFlow [55] are used to design, build, train, and deploy the deep learning model. A sequential deep learning model where one can stack layers one after the other to form a sequential flow of data is first created. The Adam (adaptive moment estimation) optimizer [56], which combines the advantages of both stochastic gradient descent (SGD) [56] and RMSprop (root mean square  
Figure 8: Unifying the input data length. propagation) [57], is then used to compile the deep learning model. The Adam optimizer, which is often used as the default optimizer in many deep learning frameworks, including TensorFlow and Keras, has many advantages for training deep learning models such as effective default hyperparameters, adaptive learning rates, momentum-like updates, bias correction, and faster coverage speeds. Finding the optimal deep learning architecture may require some trial and error in tuning the hyperparameters. The activation functions, number of inputs, number of neurons per layer, number of hidden layers, learning rates, and dropout rate [47] are the main hyperparameters for building the deep learning model. As there are three burr wear level classifications, the problem handled in this paper is a multi-class classification problem. For a multi-class classification problem, the rectified linear unit (ReLU) in (4) and hyperbolic tangent function (tanh) in (5) are suitable candidates of activation functions of hidden layers to simulate nonlinear characteristics of this problem, while softmax in (6) is the choice for the activation functions of the output layer. \[\text{ReLu}(x)=\left\{ \begin{array}{l}0\;\;if\;x<0\\ x\;if\;x>0\end{array} \right.,\text{ and its derivative }\text{ReLu}^{\prime}(x)=\left\{ \begin{array}{l}0\;\;if\;x<0\\ 1\;\;if\;x>0\end{array}