## 1 Introduction
For example, custom-built image-capturing platforms [13; 14; 15], microscopes with acquisition software [16; 17; 18; 19], and high-resolution digital CCD industrial cameras with acquisition software [20] have brightness controls and known calibrated pixel to length ratios. In our case, for user convenience, by using a flash light, the coffee granule images are able to be taken by mobile phones at a distance roughly between 15 and 25 cm without precise pixel to length calibration. In our design, a simple and cost-free solution to overcome the scale calibration problem is to take photos of coffee granules and a reference coin with a known size [21] together under a flash light. Therefore, the coins and coffee granules in an image will be image processed together. At the end of the image processing, by measuring the coin of known size in the images, the real dimensions of other coffee granules can be calculated in the images because every coffee granule size can be estimated by multiplying the ratio of the pixel number of the coffee granule region to the pixel number of the reference coin by the actual size of the reference coin region. The second technical issue is how to apply proper image processing techniques to separate the coffee granules from the background and estimate their sizes to obtain the coffee granule size distribution. In previous studies related to granule or particle segmentation, morphological watershed transform [8; 22] processing has been successfully applied in the segmentation of solar photosphere particles [23; 24], diagnostic systems to identify acute myeloid leukemia [16], granule segmentation in electron microscopy (EM) images [17], segmentation of biological membranes in electron tomography [25], fast imaging of yolk granules to quantify intraembryonic movement [18], evaluation of the particle size distributions of gravel [15] and on-site rockfill [26], DNA scalograms segmentation [27], and feature extraction of wear debris of planetary gearboxes [28]. Therefore, with so many successful results, the morphological watershed transform has also been selected for coffee granule segmentation in this paper. As a watershed transform is sensitive to noise, other case-dependent image processing operations should be properly performed to reduce noise before applying the watershed transform. The image pre-processing that needs to be performed before using a watershed transform generally includes image smoothing, background extraction [17], histogram equalization to enhance contrast [8], thresholding [16; 17; 23; 24; 29], and morphological operations [8; 23; 24; 26; 30], such as erosion, dilation, opening, closing to reduce noise, filling gaps, and enhancing or suppressing certain features based on their shape and size, making them useful for granule or particle segmentation. The distance transform is used to measure the distance of each pixel in an image to the nearest boundary. Using the distance image obtained from the distance transform [8; 16; 31] as an input for a watershed transform can improve the accuracy and control of the segmentation process. The image processing used in this paper will be explained in the details in the next section. The third technical issue is how to build a deep learning model that can predict coffee grinder burr wear level with high accuracy. We should start with reviewing the recent progress of deep learning models. The paper in [32] provides a very comprehensive survey on image segmentation algorithms based on deep learning models. The past decade was an era of technological leap forward in the development of artificial intelligence. A representative subject is AlexNet [33], proposed by [PERSON] et al. They proposed convolutional neural network (CNN) architecture specifically designed for processing grid-like data, such as images and videos. CNNs consist of convolutional layers, pooling layers, fully connected layers, and an output layer.