CLASSIFICATION OF GREEN COFFEE BEANS DEFECTS BASED ON COLOR AND SHAPE USING IMAGE PROCESSING AND CONVOLUTIONAL NEURAL NETWORK (CNN) - Fajar Apriyanto, Ignatius
Green coffee beans is a product from post-harvest process of coffee which is done by peeling its fruit pulp and hull from the coffee fruit and then drying it at a certain moisture content value. Green coffee bean can then be processed for roasting or it can be sold directly. But before that, coffee bean must be sorted first based on size, defect, and the presence of dirt or foreign object in the coffee bean batch. The sorting process is carried out to meet the quality standard of coffee beans. In global market trade, there are requirements for the quality of coffee beans that can be trade. Based on that, Indonesia applies SNI 01-2907-2008 for the quality standards of coffee beans. With these standards, it is hoped that the quality of Indonesian coffee beans can be better so that it can compete with worldwide coffee beans. Until now, the sorting process still done manually by the women of the farmer group in farmer cooperative or groups, or seasonal workers in coffee factories. That process requires a lot of worker and time. Therefore, many researchs about classification of green bean quality have been developed to simplify and speed up the process. One of the researchs conducted was by Carlito Pinto, et al in 2017 with the title Classification of Green Coffee Bean Images Based on Defect Types Using Convolutional Neural Network (CNN). Their research used an image sample of existing coffee beans, then classified using the Deep CNN methode with an accuracy of 67% for the broken class, 72% for the fade class, and above 90% for the black and sour class. Then in 2019, Mauricio Garcia, et al also conducted a research entitled Quality and Defect Inspection of Green Coffee Beans Using a Computer Vision System. They used 444 coffee bean sample with the HSV and LUV color spaces for segmentation methode and KNN algorithm for classification methode. The classification is based on quality and defects, and the result have an accuracy of 92-98%. From the background and researchs that has been done, a study of the quality classification system of coffee beans was carried out with the parameters of color and defect. This study has a purpose to create a classification system that can sort the image of coffee beans into 6 class based on color and defects, namely good beans (green and whole), foreign matter (twig, stone, or hull), old bean (black), chaffed bean (coffee bean still covered with chaff), broken bean or coffee fragment, and young or pale bean (white or yellow pale color). This class is not entirely specified from the SNI, but takes a few of the defects type from SNI, such as foreign matter class whose types of defect in SNI are coffee pulp, hull, and twig/soil/stone, black class is from black bean defect, white class is from young bean defect, and broken class is from broken bean defect. As for the good class, it was chosen to show a good and intact coffee bean, and chaffed class was chosen, because the result of natural process in coffee processing still contained many beans with chaff. There are 5274 sample of coffee beans that been used, and all of them is from natural processing. Data were collected by taking pictures per group of coffee beans that had been spread in a box using a camera. Then the pictures were processed into images per unit of coffee beans using the hsv color space for segmentation method, by way of seeing the differences of hsv color value from the coffee bean image. Furthermore, a convolutional neural network (CNN) model is created using tensorflow and training it using the previously obtained images. From the results of the model training, the validation accuracy is 89%, so it can be said that this model is good enough, and can be used for the testing or classification process. The testing process was carried out on 5 different regions of local coffee, namely Garut coffee, Gayo coffee, Lampung coffee, Malang coffee, and Temanggung coffee. There are three stages in testing process. The first one was done based on each class, the samples in each area were tested in the same class, the results of an average value of accuracy was 83% for a good class, 96.38% for black class, 99.75% for chaffed class, 69.25 % for broken class, and 85.50% for white class. The second stage was done based on each region, samples in each region was tested, and the average value of the accuracy was 83.06% for Garut coffee, 82.05% for Gayo coffee, 91.33% for Lampung coffee, 67.22% for Malang coffee, and 69.44% for Temanggung coffee. On the third stage, samples from each class and area was tested and got a result of accuracy value 77.60%.