0% found this document useful (0 votes)
22 views9 pages

roast level coffee

This study presents a classification system for coffee bean roasting levels using a Convolutional Neural Network (CNN) with MobileNet architecture, implemented on an Android application. The system achieved high accuracy rates of 98-88% during model training and 93.55% during application testing, demonstrating its effectiveness in accurately classifying roasting levels. The research highlights the potential of integrating advanced computer vision technology to enhance the efficiency and accuracy of coffee classification processes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views9 pages

roast level coffee

This study presents a classification system for coffee bean roasting levels using a Convolutional Neural Network (CNN) with MobileNet architecture, implemented on an Android application. The system achieved high accuracy rates of 98-88% during model training and 93.55% during application testing, demonstrating its effectiveness in accurately classifying roasting levels. The research highlights the potential of integrating advanced computer vision technology to enhance the efficiency and accuracy of coffee classification processes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Vol. 13, No. 3 (2024): 924 - 932 http://dx.doi.org/10.23960/jtep-l.v13i3.

924-932

Classification of Roasting Level of Coffee Beans Using Convolutional Neural


Network with MobileNet Architecture for Android Implementation
Isran Mohamad Pakaya1, Radi Radi1,, Bambang Purwantana1
1
Department of Agricultural Engineering, Faculty of Agricultural Technology, Universitas Gajah Mada, Yogyakarta, INDONESIA.

Article History: ABSTRACT


Received : 27 September 2023
Revised : 30 October 2023 The roasting process has a significant impact on the aroma profile and taste of coffee
Accepted : 23 December 2023 making it an essential stage in the coffee processing. Currently, the classification of
coffee bean roasting levels still relies on subjective human visual assessment, which
Keywords: can lead to errors due to fatigue or negligence. To overcome this problem, a
Coffee, classification system was developed using computer vision technology with a deep
Roasting, learning approach. The present study designed a coffee bean roasting level
Convolutional Neural Network, classification system based on image analysis integrated within an Android
MobileNet, application. The Convolutional Neural Network (CNN) model with the MobileNet
Android. architecture was used to identify and classify coffee beans based on their roasting
level. Two CNN models, namely CNN Alpha and CNN Beta were used in this study.
The dataset included 1.600 coffee bean images, with 1.200 images used to train the
model and 400 images used to test the accuracy. In this experiment, the input image
had an optimal size of 70x70 pixels, a learning rate of 0.0001, and 100 epochs for
both models. The model training and testing results in the highest accuracy of 98-
88% in 6.40-0.0012 minutes.The application test results obtained 93.55% accuracy,
97.06% precision, and 96.67% recall. These results indicate that this model and
application function optimally in classifying coffee bean roasting levels accurately.
Corresponding Author: Overall, this study reveals the potential of integrating CNN with the MobileNet
[email protected]
(Radi Radi)
architecture into an Android-based application to change the way of roasting level
classification, as well as to improve efficiency and accuracy.

1. INTRODUCTION
Coffee is a plantation commodity that has a large share in the Indonesian economy, in addition to oil and gas
(Marhaenanto et al., 2015). Indonesia occupies the fourth position as the largest coffee producer in the world, after
Brazil, Vietnam, and Colombia. About 67% of the total domestic coffee production is exported, while the remaining
33% is used to meet domestic needs. Indonesian coffee exports cover five continents with the main share in the
European market. In 2021, the total volume of exported coffee reached 387 thousand tons. Apart from the product
market opportunities that are increasingly open, the local coffee market is also very large (BPS, 2022).
One of the important stages in coffee processing is the roasting process. The taste of coffee can be changed
accordingly, depending on how the roasting process is done (Batubara et al.,, 2019). Roasting is one of the stages of
processing food or agricultural products through heat treatment without oil applied to the material for a certain period
of time (Radi et al., 2020). Coffee is an agricultural product, which is usually served as an aromatic beverage (Rivai et
al., 2020). Roasting is the process of forming the taste and aroma of coffee beans. The maturity level in the roasting

924
Pakaya et al.: Classification of Roasting Level of Coffee Beans…..

process is generally divided into three parts: light, medium, and dark (Tyas, 2022). A controlled roasting process is one
way to maintain the taste and aroma properties of coffee drinks. Some parameters that can be set in the roasting
process include time, temperature, and the color level of the coffee beans when they are roasted (Hernández et al.,
2008).
Currently, coffee bean classification is still deemed mostly done visually and depends on human subjective
judgment. However, this method has a subjective nature, so it has the potential to cause human error due to fatigue or
negligence (Radi et al., 2016). Finally, the classification of coffee roasting levels cannot work properly without the
help of modern technological innovations. An alternative approach using technology is expected to increase the
effectiveness of the classification of roasted coffee beans to be much better and more efficient (Winjaya, 2017). One of
the technologies developed to determine the roasting level of coffee is computer vision (Radi et al., 2016).
Computer vision is a technology that enables machines to have the ability to see, identify, and extract information
from an object to complete certain tasks (Hendriyana & Maulana, 2021). Computer vision software includes
algorithms of image processing and machine learning for identification or interpretation (Radi et al., 2020). The work
function of computer vision is similar to that of the human eye, where images or pictures of objects are introduced into
the system to extract information and classify them based on their type. In the field of computer vision technology,
there are various approaches that can be used, one of which is a methodology that utilizes Artificial Neural Networks,
which are inspired by the workings of the human brain and then develop further in the Deep Learning method (Lecun
et al., 2015). The Deep Learning method that has achieved significant results so far is the Convolutional Neural
Network (CNN) (Azizah et al., 2018). Research on application of computer vision applied on coffee bean have been
conducted and provided good result (Radi et al., 2015a; 2015b).
Convolutional Neural Network (CNN) is a Deep Learning method that can see and distinguish objects in
computerized images (Muresan & Oltean, 2018). This achievement was largely due to advances in more powerful
computing, the use of large datasets, and strategies to practice deeper networks. CNN is considered one of the best
methods related to object identification and recognition. However, like other Deep Learning methods, CNN also has
drawbacks in the training process which requires quite a long time (Santoso & Ariyanto, 2018). To speed up the
training process, you must use the right architecture, and one of the architectures that has been proven to have optimal
execution is MobileNet (Howard et al., 2019). MobileNet is centered on creating a light and optimal network in terms
of speed (Hendriyana & Maulana, 2021).
There have been many studies on the classification of coffee roasting levels using digital image processing.
Nugraha & Wiguna (2018), for the first time, developed a system for identifying the roasted level of coffee using an
artificial neural network resulting in an accuracy of 76.7%. In addition, Putra et al., (2020) also developed a system
for determining the roasting level of coffee based on roasting results using the RGB detection method and minimum
distance classification, with the resulting accuracy of 89.63%. Then Prastyaningsih & Kusrini's (2021) research about
the identification of coffee bean roasting levels using color feature extraction with an image retrieval system produces
an accuracy of 97.67%. However, the fundamental weakness of these models is that the computation is quite heavy,
and errors in detecting objects (Raysyah et al., 2021).
Michael et al., (2020) succeeded in applying the Convolutional Neural Network (CNN) method with a
combination of architectures between LeNet5, AlexNet, and MiniVGGNet for the classification of coffee roasted
levels based on Android, resulting in an accuracy of 98%. This model has advantages in terms of speed of detection,
relatively easy to modify, and fast computation time. However, the resulting model output is considered large and
quite heavy to use in the applications.
Based on the potential of computer vision technology and the CNN method, this research was conducted to
develop a coffee bean roasting level classification method for Android implementation. The CNN model that will be
developed uses the MobileNet architecture so that the resulting model output is smaller and lighter to use in the
applications. This research was expected to present a new concept in the classification of coffee bean roasting levels,
namely by utilizing an Android-based classification system so that it can be used anytime and anywhere. This
mechanism is expected to simplify and speed up the coffee classification process, thereby increasing its overall
efficiency and accuracy.

925
Jurnal Teknik Pertanian Lampung Vol. 13, No. 3 (2024): 924 – 932

2. RESEARCH METHOD AND MATERIAL

2.1. Classification System


This research was conducted to develop a coffee bean roasting level classification system which is then the
development of this system is largely based on the Convolutional Neural Network model with MobileNet architecture.
The results of the system classification were then used as a model in making Android-based applications.
Figure 1 shows a system scheme for developing a coffee bean roasting level classification system using a
Convolutional Neural Network with MobileNet architecture. Google Colaboratory was used to make the design of
executable models that are free and high on computational resources. In addition, image datasets were then collected
using smartphones. The image dataset was used to train and validate the model. Finally, the model was ready to
classify the roasting level of coffee beans, then it was implemented into an application built using Android Studio to
determine the predicted results of the coffee bean roasting level.

2.2. Research Stage


Figure 2 shows the flow of research stages. The coffee images used in the model training process are roasted coffee
from 'Cap Kadal Roaster' home roasting and have been labeled by experts into three classifications: light, medium,
and dark. The collection of these photographed images is then divided into three parts: training dataset, validation
dataset, and testing dataset. The image dataset to be used in this study was 1000x1000 pixels in JPG image format.
The dataset contained 1,600 coffee bean images, which were divided into four categories representing their respective
different roasting levels. Out of the image number, 1,200 images were used to train the model, while 400 images were
used to test the accuracy of the model. In evaluating application performance, 120 new images were used from
different data.
The coffee bean roasting level classification system using Convolutional Neural Network (CNN) with MobileNet
architecture would be tested using several training scenarios and using training data that had been divided into training
data and validation data to identify and classify the roasting level. Furthermore, an evaluation of the accuracy of the
training was carried out to ensure the success of the training process. The model with the best training scenario would

Figure 1. Scheme for the development of a coffee bean roasting level classification system

926
Pakaya et al.: Classification of Roasting Level of Coffee Beans…..

Figure 2. Research flow diagram

be tested using training data to assess model performance and identify the level of classification accuracy. Further, an
analysis of the results of the CNN model training and application testing was carried out to evaluate the suitability and
efficiency of the developed classification system. After obtaining the model with the best testing accuracy, the model
would be implemented into an Android application to make it easier to assess the roasting level of coffee beans
accurately. Application performance would be tested using a new image that was not used during the training and
testing process. After that, it would be assessed whether the integration of CNN with the MobileNet architecture into
an Android-based application was successful or not. It was expected that the designed system and application would
change the method of classifying coffee bean roasting levels.

2.3. System Performance


The performance results of the designed system would be evaluated based on the extent to which the performance was
as expected. In addition, the advantages and disadvantages of the designed system would be measured using accuracy,
precision, and recall parameters. Accuracy is characterized as the degree of truth in a study, which indicates how
precise the results are. Precision describes the speed at which data is achieved by comparing the number of correct

927
Jurnal Teknik Pertanian Lampung Vol. 13, No. 3 (2024): 924 – 932

predictions compared to the total amount of data. Recall measures how many actual positives were correctly identified
(Ibrahim et al., 2022). Here is the mathematical equation to calculate accuracy, precision, and recall:
𝑇𝑃
Precision (%) = x 100% (1)
𝑇𝑃 + 𝐹𝑃

𝑇𝑃
Recall (%) = x 100% (2)
𝑇𝑃 + 𝐹𝑁

𝑇𝑃 𝑎𝑙𝑙
Accuracy (%) = x 100% (3)
𝑇𝑃+𝑇𝑁+𝐹𝑃+𝐹𝑁

where TP (true positive) is data that is actually classified by the system as a positive (true) value; TN (true negative) is
true data is classified by the system as a negative (true) value; FP (false positive) is incorrect (negative) data but
classified by the system as true (positive) data; and FN (false negative) is the data is correct (positive) but is classified
by the system as incorrect (negative) data.

3. RESULTS AND DISCUSSION


The system that had been designed was used to classify the roasting level of coffee beans from the coffee image
dataset which was divided into four categories, namely green, light, medium, and dark. The CNN architecture used in
this study had 2 models with CNN Alpha having 3 convolution layers and 2 hidden layers, while CNN Beta having a
total of 4 convolution layers and 2 hidden layers.
The success rate of the model was measured by the accuracy parameter. Model accuracy could be determined
through testing using data testing. The outline of the block diagram of this research can be seen in Figure 3, which
consists of three parts: input, the process is in the form of processing and training, and the output is in the form of a
model. The data testing was used to test the accuracy of the model. Figure 3 illustrates the three parts of the research
block diagram, which shows the overall research outline, namely: input, process through processing, and training, and
the result is a model.

Figure 3. The research block diagram on the CNN model uses the MobileNet architecture

3.1. Test Design Results


For model training, implementation tests were carried out including testing image sizes with sizes 50x50, 70x70, and
150x150 with the specified parameters. Then, testing the learning rate for Adam Optimizer was conducted with values
0.0001, 0.001, and 0.01 using a predetermined image size. In addition, varying the number of epochs with values of
10, 100, and 1000 with a predetermined image size and learning rate. The results of this test are shown in Table 1.

928
Pakaya et al.: Classification of Roasting Level of Coffee Beans…..

Table 1. Test accuracy results


Testing Accuracy
Model Input Citra Learning Rate Epoch
50x50 70x70 150x150 0.01 0.001 0.0001 10 100 1000
CNN Alpha 0.97 0.95 0.97 0.97 0.95 0.97 0.88 0.97 0.97
CNN Beta 0.97 0.98 0.94 0.97 0.98 0.98 0.86 0.98 0.96
Average 0.97 0.97 0.96 0.97 0.97 0.98 0.87 0.98 0.97

Based on the test results, it was found that the optimal image input to be used was 70x70, the learning rate value was
0.0001 and the epoch value was 100 for both models, then model prediction test was carried out.

3.2. CNN Model Training and Testing Results


In this test, an epoch value of 100 was used with the same learning rate parameter, namely 0.0001 and the input image
used was 70x70 pixels. The dataset comprises 1.600 images of coffee beans. Out of this total, 1.200 images are
utilized for training the model, while 400 images are reserved for testing the accuracy of the model. The results of this
test are shown in Table 2.

Table 2. Training and testing results


Training Testing
Model
Accuracy Time (minute) Accuracy Time (minute)
CNN Alpha 0.97 6.41 0.73 0.0013
CNN Beta 0.98 6.40 0.88 0.0012

Based on the test results, For model training, CNN Alpha achieved an accuracy of 97% with a training time of 6.41
minutes, while CNN Beta achieved an accuracy of 98% with a training time of 6.40 minutes. For model testing, CNN
Alpha achieved an accuracy of 73% with a training time of 0.0013 minutes, while CNN Beta achieved an accuracy of
88% with a training time of 0.0012 minutes. Based on the training and testing outcomes, the model selected for
implementation into the Android platform is CNN Beta due to its higher accuracy in testing data and faster training
time compared to CNN Alpha.

3.3. Testing Results Using the Application


After the best model was implemented into the Android application. Then the testing process was conducted aimed to
test whether the model that was integrated into the Android application system was successful in making predictions
or not and seeing the performance of the application. Figure 4 is a testing process, where the input used was a photo
image directly using a smartphone or available image data. After that the input image would be resized to a size of
70x70, to match the size of the image during training. The images would then be classified based on the model
resulting from the training process (see Figure 3). The result of this testing or classification process is the form of the
name of the roasting level and its percentage of accuracy.

Figure 4. Application Testing Process

929
Jurnal Teknik Pertanian Lampung Vol. 13, No. 3 (2024): 924 – 932

The testing process was carried out using a smartphone that had been installed with a coffee bean roast-level
classification application. Figure 5 demonstrates the application interface for the classification of coffee bean roasting
levels.

Figure 5. Application interface to identify coffee roasting level

(a) (b)
Figure 6. a. Open directory, b. The results of the classification and prediction of coffee beans

930
Pakaya et al.: Classification of Roasting Level of Coffee Beans…..

Figure 6 shows the results of the classification process for the roasting level of coffee beans with the output being
the name of the coffee roasted level and the percentage of accuracy. The coffee image data used was limited to 120 test
data images from different datasets, where each roasting level had 30 images. The results of these tests can be seen in
Table 3.

Table 3. The results of the test data classification


Classification Table Success Failed
Category
Dark Green Light Medium Count Percentage Count Percentage
Dark 30 0 0 0 27 100% 0 0%
Green 0 30 0 0 30 100% 0 0%
Light 0 0 30 0 26 100% 0 0%
Medium 0 0 4 26 26 87% 4 13%

Table 4. The results of the test data analysis

Category TP TN FP FN Precision Recall Accuracy


Dark 30 0 0 3 100.00% 100.00%
Green 30 0 6 0 100.00% 100.00%
Light 30 0 4 0 88.24% 100.00% 93.55%
Medium 26 0 0 4 100.00% 86.67%
Average 97.06% 96.67% 93.55%

Table 3 is a table of classification results for test data. The system successfully classified all images with dark,
green, and light roasted levels. Meanwhile, for the medium image, 26 images were successfully classified and 4 were
identified incorrectly. There was an incorrect prediction in the medium image because the color at the medium
maturity level was almost similar to light so some were predicted to be light as shown in Table 3. While those in Table
4 are the results of system performance obtained by calculating accuracy, precision, and recall. Based on the testing,
the accuracy value obtained was 93.55% and the precision, and recall values were 97.06% and 96.67% respectively.

4. CONCLUSIONS
The coffee bean roasting level classification system developed using CNN with the MobileNet architecture can be
used to predict the maturity level of coffee. The model training and testing results in the highest accuracy of 98-88% in
6.40-0.0012 minutes. While the application performance test shows the best accuracy of 93.55% and the value of
precision, recall is 97.06% and 96.67% respectively. These results indicate that the coffee bean roasting level
classification system using the Convolutional Neural Network method with the MobileNet architecture can be
considered to work well. For better results, model evaluation and optimization can be done by increasing the number
of iterations and evaluating the amount of training data.

ACKNOWLEDGMENT
The researcher would like to express his gratitude to the Agri-CR Research Group and all parties who have given
valuable assistance in completing this research.

REFERENCES
Azizah, L.M., Umayah, S.F., & Fajar, F. (2018). Deteksi kecacatan permukaan buah manggis menggunakan metode deep learning
dengan konvolusi multilayer. Semesta Teknika, 21(2), 230–36. https://doi.org/10.18196/st.212229.
BPS (Badan Pusat Statistik). (2022). Statistik Kopi Indonesia 2021. Badan Pusat Statistik. Jakarta.
Batubara, A., Yusuf, A., & Widyasanti, A. (2019). Uji kinerja dan analisis ekonomi mesin roasting kopi (Studi kasus di Taman
Teknologi Pertanian Cikajang-Garut). Teknoktan Journal, 13(1), 1–7. https://doi.org/10.24198/jt.vol13n1.1.

931
Jurnal Teknik Pertanian Lampung Vol. 13, No. 3 (2024): 924 – 932

Hendriyana, H. & Maulana, Y.H. (2021). Identifikasi jenis kayu menggunakan convolutional neural network dengan arsitektur
mobilenet. Jurnal Resti, 4(1). https://doi.org/10.29207/resti.v4i1.1445.
Hernández, J.A., Heyd, B., & G. Trystram. (2008). Prediction of brightness and surface area kinetics during coffee roasting.
Journal of Food Engineering, 89(2),156–63. https://doi.org/10.1016/j.jfoodeng.2008.04.026.
Howard, A.G., Wang, W., Sandler, M., Zhu, Y., Chu, G., Chen, L.C., Chen, B., Ruoming, P., Vasudan, V., Le, Q.V., Adam, H., &
Tan, M. (2019). Searching for mobilenetV3. Computer Vision and Pattern Recognition.
Ibrahim, N., Lestary, G.A., Hanafi, F.S., Saleh, K., Pratiwi, N.K.C., Haq, M.S., & Mastur, A.I. (2022). Klasifikasi tingkat
kematangan pucuk daun teh menggunakan metode convolutional neural network. Jurnal Teknik Energi Elektrik, 10(1), 162–
76.
Lecun, Y., Bengio, Y., & Hinton, G. (2015). Deep Learning. Nature, 521, 436–44. https://doi.org/10.1038/nature14539
Marhaenanto, B., Soedibyo, D.W., & Farid, M. (2015). Penentuan lama sangrai kopi terhadap variasi derajat sangrai menggunakan
model warna RGB pada pengolahan citra digital (digital image processing). Jurnal Agroteknologi, 09(02), 102–11.
Michael, E.H., Prilianti, K.R., & Subianto, M. (2020). Rancang bangun aplikasi klasifikasi tingkat kematangan sangrai kopi melalui
citra digital menggunakan CNN (Convolutional Neural Network) berbasis android. Jurnal Ilmiah Sainsbertek, 1(1), 1–11.
Muresan, H., & Oltean, M. (2018). Fruit recognition from images using deep learning. Sapientiae Informatica 10(1), 26–42.
https://doi.org/10.2478/ausi-2018-0002.
Nugraha, D.A., & Wiguna, A.S. (2018). Klasifikasi tingkat roasting biji kopi menggunakan jaringan syaraf tiruan backpropagation
berbasis citra digital. SMARTICS Journal, 4(1), 1–4. https://doi.org/10.21067/smartics.v4i1.2165.
Prastyaningsih, Y., & Kusrini, W. (2021). Sistem temu kembali citra pada level roasting biji kopi menggunakan ekstraksi fitur
warna. Jurnal Inovtek Polbeng, 6(2), 222–33. https://doi.org/10.35314/isi.v6i2.2086.
Putra, A.F.S.J., & Santoni, M.M. (2020). Penentuan level kematangan kopi berdasarkan hasil roasting menggunakan etode Deteksi
RGB dan klasifikasi minimum distance. Seminar Nasional Mahasiswa Ilmu Komputer dan Aplikasinya, 1(2), 481-492.
Radi, R., Rivai, M., & Purnomo, M.H. (2015a). Combination of first and second order statistical features of bulk grain image for
quality grade estimation of green coffee bean. ARPN Journal of Engineering and Applied Sciences, 10(18), 8165-8174.
Radi, R., Rivai, M., & Purnomo, M.H. (2015b). GA-SVC based search applied for optimization of image features subset in quality
estimation system of bulk green coffee bean. ARPN Journal of Engineering and Applied Sciences, 10(22), 17177-17185.
Radi, R., Rivai, M., & Purnomo, M.H. (2016). Study on electronic-nose-based quality monitoring system for coffee under roasting.
Journal of Circuits, Systems and Computers, 25(10), 16501164. https://doi.org/10.1142/S0218126616501164.
Radi, R., Saragih, E.P., Pratama, B., & Fitri, W.K. (2020). Performance analysis of fuzzy logic controller applied on portable
roaster. IOP Conference Series: Earth and Environmental Science, 757. https://doi.org/10.1088/1755-1315/757/1/012022.
Raysyah, S., Arinal, V., & Mulyana, D.I. (2021). Klasifikasi tingkat kematangan buah kopi berdasarkan deteksi warna
menggunakan metode KNN dan PCA. Jurnal Sistem Informasi, 8(2), 88–95. https://doi.org/10.30656/jsii.v8i2.3638.
Rivai, M., Radi, R., Purnomo, M.H., Purwantana, B., Purwanto, D., & Sujiati, L. (2020). Electronic nose method for classification
of coffee, in comparison with laboratory instrument and sensory test. International Agricultural Engineering Journal, 29(2),
363-375.
Santoso, A., & Ariyanto, G. (2018). Implementasi deep learning berbasis keras untuk pengenalan wajah. Jurnal Teknik Elektro
18(01), 15–21. https://doi.org/10.23917/emitor.v18i01.6235.
Tyas, S.A. (2022). Pengaruh Suhu dan Waktu Roasting Terhadap Kualitas Hasil Roasting Kopi Arabika. [Undergraduate Thesis].
Politeknik Enjinering Pertanian Indonesia, Tangerang.
Winjaya, F. (2017). Rancang Bangun Mesin Pemanggang Biji Kopi berbasis Image Processing dan Akustik. [Master Thesis].
Institut Teknologi Sepuluh Nopember, Surabaya.

932

You might also like