0% found this document useful (0 votes)
18 views8 pages

Peaberry Coffee Bean Sorting System

d

Uploaded by

diana21ti
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)
18 views8 pages

Peaberry Coffee Bean Sorting System

d

Uploaded by

diana21ti
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

World Academy of Science, Engineering and Technology

International Journal of Computer and Information Engineering


Vol:14, No:6, 2020

Normal and Peaberry Coffee Beans Classification


from Green Coffee Bean Images Using Convolutional
Neural Networks and Support Vector Machine
Hira Lal Gope, Hidekazu Fukai

 the green coffee beans quality is an important issue for


Abstract—The aim of this study is to develop a system which can competitive market price, general consumer acceptance and
identify and sort peaberries automatically at low cost for coffee storage stability for the developing countries [4].
producers in developing countries. In this paper, the focus is on the The peaberry is a round bean bearing one bean instead of
classification of peaberries and normal coffee beans using image
the usual flat-sided bean pair (shown in Fig. 1 (b)) [28]. The
Open Science Index, Computer and Information Engineering Vol:14, No:6, 2020 [Link]/10011255/pdf

processing and machine learning techniques. The peaberry is not bad


and not a normal bean. The peaberry is born in an only single seed, peaberries visible features would be the size and shape as
relatively round seed from a coffee cherry instead of the usual flat- compared to normal coffee beans [7]. The peaberry coffee is
sided pair of beans. It has another value and flavor. To make the taste very limited, with only around 7% of any given coffee crop
of the coffee better, it is necessary to separate the peaberry and being peaberries [6], [11]. The peaberries are not specific to
normal bean before green coffee beans roasting. Otherwise, the taste any particular region and can grow anywhere [12]. Out of the
of total beans will be mixed, and it will be bad. In roaster procedure
total production, the peaberry is often hand-selected by
time, all the beans shape, size, and weight must be unique; otherwise,
the larger bean will take more time for roasting inside. The peaberry farmers and the defect beans are also removed by hand [5].
has a different size and different shape even though they have the Picking up the peaberry is more complicated and time-
same weight as normal beans. The peaberry roasts slower than other consuming than defect beans. The higher price for the
normal beans. Therefore, neither technique provides a good option to peaberry beans arises from their reportedly higher
select the peaberries. Defect beans, e.g., sour, broken, black, and fade concentrated flavor compared to normal beans [6], [11].
bean, are easy to check and pick up manually by hand. On the other
The peaberry coffee is one of the expensive coffee
hand, the peaberry pick up is very difficult even for trained specialists
because the shape and color of the peaberry are similar to normal specialties in the world. The peaberry (also called ‘kopi
beans. In this study, we use image processing and machine learning lanang’ in Indonesian and caracol or snail in Spanish) is a
techniques to discriminate the normal and peaberry bean as a part of natural coffee bean mutation within the coffee cherry [6], [11].
the sorting system. As the first step, we applied Deep Convolutional To meet the consumer’s quality requirements, peaberry
Neural Networks (CNN) and Support Vector Machine (SVM) as specialty coffee authentication is also one of the major
machine learning techniques to discriminate the peaberry and normal
challenges that have become increasingly important in the
bean. As a result, better performance was obtained with CNN than
with SVM for the discrimination of the peaberry. The trained coffee trade as a result of the significant increase in the price
artificial neural network with high performance CPU and GPU in this gap between the peaberry and normal coffee in recent years
work will be simply installed into the inexpensive and low in [11]. On coffee beans roast, besides size uniformity, the
calculation Raspberry Pi system. We assume that this system will be uniformity of shape is also preferred for roast uniformity; thus,
used in under developed countries. The study evaluates and compares the peaberry should be separated [9]. Peaberries are
the feasibility of the methods in terms of accuracy of classification
considered an anomaly and often separated from the green
and processing speed.
coffee bean, commanding a higher value in most instances [8].
Keywords—Convolutional neural networks, coffee bean,
Image classification technology is a rapidly growing area of
peaberry, sorting, support vector machine. informatics. In the world, there are various algorithms used for
classification. In the image processing field, incidentally, the
I. INTRODUCTION presence of the technique of deep CNN has been especially

I
increased because of their powerful performances and
N the world markets, every day more than two billion cups
availabilities for wide applications. Deep neural networks
of coffee are consumed, which makes coffee one of the
allow computational models that are composed of multiple
most popular beverages and over the years, coffee
processing layers to learn representations of data with multiple
consumption and the demand for high-quality coffee beans
levels of abstraction [15]. These methods have significantly
have been increasing [1], [2]. The coffee grows in the tropics
improved the performance of speech recognition, object
and is one of the most important crops to earn foreign
detection, visual object recognition and many other domains,
currency for several under developing countries. Evaluating
including drug discovery and genomics [34].
H.L.G. is with the Faculty of Engineering, Gifu University, Japan and
In general, the main inspiration behind the application of
Faculty of Agricultural Engineering and Technology, Sylhet Agricultural image analysis or computer vision systems to agricultural
University, Bangladesh (corresponding author, e-mail: hlgope@[Link]). products is due to the drawbacks of manual classification and
H.F. is with the Faculty of Engineering, Gifu University, Japan (e-mail:
fukai@[Link]).
grading systems such as subjectivity, tediousness, labor

International Scholarly and Scientific Research & Innovation 14(6) 2020 189 ISNI:0000000091950263
World Academy of Science, Engineering and Technology
International Journal of Computer and Information Engineering
Vol:14, No:6, 2020

requirements, cost, and inconsistency, as many researchers 3. When we applied classification algorithms on normal and
have reported [16]-[27]. The peaberry beans of special type peaberry coffee bean image datasets, the accuracy of the
roast more slowly than other normal beans. Coffee beans were individual algorithm emerged.
detected and selected using various techniques [6]. Therefore,
neither technique provides a good option to select the
peaberries, meaning a more modern approach is needed [4].
The identification and selection of the peaberries need a robust
and easy process.
The novelty of this study is to develop an automatic normal
and peaberry coffee bean identification and selection system, (a)
which can estimate the accuracy of normal and peaberry
coffee beans using deep CNN, a state-of-art technique of the
image processing field [10]. We developed a computer
program as the first step, whose input is a color image of a
green coffee bean and the output is the probability of each
bean category. (b)
Open Science Index, Computer and Information Engineering Vol:14, No:6, 2020 [Link]/10011255/pdf

In this research, we also applied the conventional SVM with Fig. 1 Coffee bean types: (a) normal and (b) peaberry
a linear kernel for the classification and compared the
performances of CNN and SVM in terms of classification
accuracy [9]. We will install Raspberry Pi on desktop PC with
a tiny affordable single-board computing module. On
Raspberry Pi, we will be implementing the coffee bean
classifier for training the CNN models. Python (a programing
language), Chainer (an open source library of neural networks
for deep learning), and OpenCV (an open source library for
computer vision) will be installed on Raspberry Pi. We will Fig. 2 Block diagram of coffee bean image processing
develop a python program that uses a camera module to take a
photo of a green coffee bean, converts the photo image with C. Image Acquisition
OpenCV to fit the image as a CNN input, and then classify the The neural network inputs were digital images of green
coffee bean images using CNN with network pre-trained coffee beans. The coffee bean samples were from Timor-
parameters. We will estimate the classifier’s performance on Leste. The green coffee beans were placed onto white paper
two types of normal and the peaberry binary classification before taking photographs using a Nikon digital camera. The
from green coffee bean images [9]. camera was set with F/16 f-number, exposure time 1/60 s, ISO
200, exposure compensation 1.3, and autofocus mode set to
II. MATERIALS AND METHODS automatic mode. The camera was placed at 1 m above from
the bean’s surface. Both the front and back sides of the beans
A. Normal and the Peaberry Coffee
were photographed. To ensure the brightness around the
1. Normal Coffee Bean: Normal coffee beans have no subject was uniform, three lighting devices were placed
defects, and it is not a defect type. From a coffee cherry, around the beans [9]. The shooting environment is shown in
this type of bean contains two beans with their flat sides Figs. 3 and 4. Image preprocessing techniques were applied to
together like the two halves of a peanut (Fig. 1 (a)) [6], the photographs to isolate each bean (Fig. 5). About 3,338
[11]. samples of the normal and the peaberry were prepared. The
2. Peaberry Coffee Bean: The special type of the peaberry size of each image was set to 32×32 pixels, 64×64 pixels,
coffee seed is born in only one of the two seeds, a 128×128 pixels and 256×256 pixels. The images were
relatively round seed from a coffee cherry instead of the manually labeled as normal and peaberry. Note that one image
normal flat-sided seed pair (Fig. 1 (b)). may have multiple labels [9], [10].
B. Process of Normal and the Peaberry Coffee Bean Images To apply the machine learning techniques, all the sample
images were divided into three groups: training data,
The important features in the selection process are physical
validation data and test data. The training data were used for
appearance including color, morphology, shape, and size [3].
training the machine learning models. The validation data
Fig. 2 shows the sequence of coffee bean image classification
were used to confirm the transition of classification
and its analysis. The research aim is to develop an automatic
performance during the neural networks training phase. The
sorting system with good accuracy. The procedure of our
test data were used to evaluate the ability of the trained models
image classification algorithms is:
to sort with final parameters. The number of images for each
1. Digital image finding from image dataset.
group is shown in Table I.
2. Principle Component Analysis (PCA) for feature
extraction.

International Scholarly and Scientific Research & Innovation 14(6) 2020 190 ISNI:0000000091950263
World Academy of Science, Engineering and Technology
International Journal of Computer and Information Engineering
Vol:14, No:6, 2020

Fig. 3 Photographic environment depicted from above


Fig. 4 Photographic environment from the side
Open Science Index, Computer and Information Engineering Vol:14, No:6, 2020 [Link]/10011255/pdf

Fig. 5 Coffee bean images (1:1) obtained by applying image pre-processing technique [9], [10]

TABLE I The output shape changes depending on the filter stride. For
THE NUMBER OF IMAGES FOR EACH TASK
instance, if the stride value s is 2, the output of the width and
Task Training Validation Test
height will be half of the input. A convolution schematics
Normal 1140 570 190
diagram is shown in Fig. 7 [9].
Peaberry 863 431 144
Usually, the pooling layer is positioned just after the
D. CNN convolution layer. The role of the pooling layer is to decrease
The CNN is a form of artificial neural network that is the sensitivity of the feature to the position, which extracted
mainly applied for the recognition of images [14]. CNNs by the convolution layer, so even if the position of the target
apply to image processing, natural language processing, and feature in the image shifts slightly, the output of the pooling
other cognitive tasks. ConvNet also is known as a CNN [29]. layer does not differ. There are several types of methods for
CNN is consisting of three types of layers (Fig. 6). The pooling. In this study, max pooling is used. Max pooling is a
convolution layer has the purpose of extracting features of an method that sets the maximum value contained in 𝑃 as an
image using spatial filters. Assume that, input from 𝑙 1 output value 𝑢 , described as (3) [9].
layer proceeds with a convolutional connection to the 𝑙
max 𝑧
layer. Let the input take the form of 𝑊 𝑊 𝐾 and the layer 𝑢 𝑝, 𝑞 ∈ 𝑃 𝑝𝑞𝑘 (3)
of convolution has M spatial filter types in the form of 𝐻
𝐻 𝐾. Then, calculate the output 𝑢 by convolving this For every channel k, the max pooling is applied
spatial filter on the input as in (1) [9]. independently. The size of output depends on the stride as
same as the convolution layer.
𝑢 ∑ ∑ ∑ 𝑧 , , 𝑝𝑞𝑘𝑚 𝑏 (1) The fully connected layer has a role of converging features
that are obtained by repeating convolution and pooling to the
Here, the 𝑏 parameter is a bias of the layer. The number of classes we want to classify. This same type of
activation function f (ꞏ) is then applied to the 𝑢 as in (2) architecture was used in classical artificial neural networks.
and thus, we get 𝑧 as the output of the convolution layer The fully connected output layer 𝑧 is given by (4) and (5) [9].
[9].
𝑢 ∑ 𝑤 𝑥 𝑏 (4)
𝑧 𝑓 𝑢 (2)

International Scholarly and Scientific Research & Innovation 14(6) 2020 191 ISNI:0000000091950263
World Academy of Science, Engineering and Technology
International Journal of Computer and Information Engineering
Vol:14, No:6, 2020

Here, the activation function is f (ꞏ). 𝑥 𝑥 0


𝑓 𝑥 (6)
0 𝑥 0
𝑧 𝑓 𝑢 (5)
The sigmoid function is used in the final layer. Generally,
In this paper, the rectified linear unit (ReLU) function is the sigmoid function is used to get each unit’s output value as
used for the activation function for the layers of convolution the probabilities that the input belongs to each class and the
and the fully connected layers. The function ReLU is sigmoid function is described as (7) [9].
described as (6) [9].
𝑓 𝑥 (7)
Open Science Index, Computer and Information Engineering Vol:14, No:6, 2020 [Link]/10011255/pdf

Fig. 6 The basic structure of a CNN [9], [10]

Fig. 7 Schematic diagram of the convolution [9], [10]

E. SVM it is not easy to linearly separate some problems in the original


SVM uses the kernel function to convert data from input input space. However, it can easily transform the original
space into a high dimensional feature space in which it input space into a nonlinear high dimensional feature space,
searches for a separating hyperplane [30]. SVM is originally a where an optimal linear separating hyperplane is trivial to find
binary classifier that works by identifying the optimal [13]. In this paper, the SVM used here is a conventional linear
hyperplane and dividing the data points correctly into two SVM, the training set of features is used as the input to train a
classes. There will be an infinite number of hyperplane and conventional linear SVM and the testing set of features is used
SVM will select the hyperplane with maximum margin. to obtain image labels for the frame test predict. The accuracy
Although SVM can classify only with small areas of training, of the classification refers to the ratio of items to be classified
a medium of large training areas is used in this study. This is as positive when classified as positive, and items to be
because such areas of training appear to produce high classified as negative were classified as negative and are
accuracy classification. Classification is performed by expressed by (8):
conventional linear SVM with its legend and percentage area
for each class [33]. Different function types such as linear, 𝐴𝑐𝑐𝑢𝑟𝑎𝑐𝑦 (8)
polynomial, RBF and other functions of the kernel are widely
used to transform input space into desired function space. It where, TP and TN are the numbers of true positive and true
uses linear hyperplane separation to construct a classifier, yet negative predictions, on the other hand, FP and FN are the

International Scholarly and Scientific Research & Innovation 14(6) 2020 192 ISNI:0000000091950263
World Academy of Science, Engineering and Technology
International Journal of Computer and Information Engineering
Vol:14, No:6, 2020

numbers of the false positive and false negative for the classification indicates that the SVM classification is good.
considered class. The overall 97% accuracy of the coffee bean

TABLE II
PARAMETERS OF THE CNN FOR FOUR KINDS OF THE IMAGE DATASET
A. 32×32 IMAGE SIZE
Layer Name Filter shape 𝑯 𝑯 𝑲 Stride 𝒔 Output map shape 𝑾 𝑾 𝑴 𝐀𝐜𝐭𝐢𝐯𝐚𝐭𝐢𝐧 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧 𝒇 ∙
Input 32 32 3
Convolution1 3 3 3 1 30 30 32 𝑅𝑒𝐿𝑈
Pooling1 2 2 32 2 15 15 32
Convolution2 3 3 32 1 15 15 64 𝑅𝑒𝐿𝑈
Pooling2 2 2 64 2 7 7 64
Convolution3 3 3 64 1 7 7 128 𝑅𝑒𝐿𝑈
Pooling3 2 2 128 2 3 3 128
Convolution4 3 3 128 1 3 3 256 𝑅𝑒𝐿𝑈
Pooling4 2 2 256 2 1 1 256
FullConnected1 512 𝑅𝑒𝐿𝑈
Open Science Index, Computer and Information Engineering Vol:14, No:6, 2020 [Link]/10011255/pdf

FullConnected2 1 𝑆𝑖𝑔𝑚𝑜𝑖𝑑

B. 64×64 IMAGE SIZE


Layer Name Filter shape 𝑯 𝑯 𝑲 Stride 𝒔 Output map shape 𝑾 𝑾 𝑴 𝐀𝐜𝐭𝐢𝐯𝐚𝐭𝐢𝐧 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧 𝒇 ∙
Input 64 64 3
Convolution1 3 3 3 1 62 62 32 𝑅𝑒𝐿𝑈
Pooling1 2 2 32 2 31 31 32
Convolution2 3 3 32 1 31 31 64 𝑅𝑒𝐿𝑈
Pooling2 2 2 64 2 15 15 64
Convolution3 3 3 64 1 15 15 128 𝑅𝑒𝐿𝑈
Pooling3 2 2 128 2 7 7 128
Convolution4 3 3 128 1 7 7 256 𝑅𝑒𝐿𝑈
Pooling4 2 2 256 2 3 3 256
FullConnected1 512 𝑅𝑒𝐿𝑈
FullConnected2 1 𝑆𝑖𝑔𝑚𝑜𝑖𝑑

C. 128×128 IMAGE SIZE


Layer Name Filter shape 𝑯 𝑯 𝑲 Stride 𝒔 Output map shape 𝑾 𝑾 𝑴 𝐀𝐜𝐭𝐢𝐯𝐚𝐭𝐢𝐧 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧 𝒇 ∙
Input 128 128 3
Convolution1 3 3 3 1 126 126 32 𝑅𝑒𝐿𝑈
Pooling1 2 2 32 2 63 63 32
Convolution2 3 3 32 1 63 63 64 𝑅𝑒𝐿𝑈
Pooling2 2 2 64 2 31 31 64
Convolution3 3 3 64 1 31 31 128 𝑅𝑒𝐿𝑈
Pooling3 2 2 128 2 15 15 128
Convolution4 3 3 128 1 15 15 256 𝑅𝑒𝐿𝑈
Pooling4 2 2 256 2 7 7 256
FullConnected1 512 𝑅𝑒𝐿𝑈
FullConnected2 1 𝑆𝑖𝑔𝑚𝑜𝑖𝑑

D. 256×256 IMAGE SIZE


Layer Name Filter shape 𝑯 𝑯 𝑲 Stride 𝒔 Output map shape 𝑾 𝑾 𝑴 𝐀𝐜𝐭𝐢𝐯𝐚𝐭𝐢𝐧 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧 𝒇 ∙
Input 256 256 3
Convolution1 3 3 3 1 254 254 32 𝑅𝑒𝐿𝑈
Pooling1 2 2 32 2 127 127 32
Convolution2 3 3 32 1 127 127 64 𝑅𝑒𝐿𝑈
Pooling2 2 2 64 2 63 63 64
Convolution3 3 3 64 1 63 63 128 𝑅𝑒𝐿𝑈
Pooling3 2 2 128 2 31 31 128
Convolution4 3 3 128 1 31 31 256 𝑅𝑒𝐿𝑈
Pooling4 2 2 256 2 15 15 256
FullConnected1 512 𝑅𝑒𝐿𝑈
FullConnected2 1 𝑆𝑖𝑔𝑚𝑜𝑖𝑑
The higher row represents the first layer [9], [10]

International Scholarly and Scientific Research & Innovation 14(6) 2020 193 ISNI:0000000091950263
World Academy of Science, Engineering and Technology
International Journal of Computer and Information Engineering
Vol:14, No:6, 2020

III. EXPERIMENT types of classification, as shown in Table III and Fig. 8. The
image size did not significantly affect the classification
A. Classification of Normal and the Peaberry Coffee Beans
Using CNN and Conventional Linear SVM accuracies for the CNN and conventional linear SVM. We
obtained high accuracies (over 97%) from CNN as the
Normal and peaberry types of coffee beans are labeled as classification of the conventional linear SVM.
green coffee beans. However, we performed two binary
classifications for each type of bean in the case of coffee TABLE III
beans. The number of coffee bean images used for each CNN AND SVM ACCURACIES FOR NORMAL AND PEABERRY COFFEE BEAN
(FOUR IMAGE SIZES)
classification task is shown in Table I. The parameters of CNN
Accuracy
are shown in Table II. The layer was added after the Image Size
CNN SVM with Linear Kernel
’FullConnected1’ layer and set a dropout rate to 0.5 [31]. The
32×32 0.9736 0.9671
deep learning library, Chainer, was used to implement the 64×64 0.9726 0.9671
CNN [32]. 128×128 0.9850 0.9671
Instead of CNN, we also applied conventional linear SVM 256×256 0.9853 0.9641
to compare the performance in classification accuracy.
Parameter C was set to 1 and parameter gamma was set to V. DISCUSSION AND CONCLUSION
Open Science Index, Computer and Information Engineering Vol:14, No:6, 2020 [Link]/10011255/pdf

‘auto’ when implementing conventional linear SVM. A scikit-


learn machine learning library was used for implementing the As the first step, we discriminate the normal and peaberry
SVM. In the conventional linear SVM tasks, to adapt to the coffee beans using CNN of the development of the coffee
SVM, the data were reshaped into a one-dimensional vector bean sorting system. Avoiding calculation cost, we used here
form. simple CNN with few convolutional layers. We compared
both the CNN results and the conventional linear SVM results.
IV. RESULTS It is confirmed that we obtained better performance with CNN
for the discrimination of the peaberry.
The two types of binary classifications were performed on The performance could be enhanced by preparing more
desktop computers by both CNN and conventional linear coffee bean sample images for training, adding more labels for
SVM. In this research, the entire training dataset was divided the normal and the peaberry type of coffee bean, using
into training, validation and test data format. Table I shows the advance SVM kernel level, reconsidering CNN structure or
total number of 1900 samples of normal and 1438 samples of artificial data augmentation by such as random rotation, shifts,
peaberry coffee beans. We prepared four trained CNN models and flips. In future research, the trained neural network will be
for four kinds of image sizes such as 32×32 pixels, 64×64 installed simply in the Raspberry Pi system, and we will
pixels, 128×128 pixels and 256×256 pixels to compare the estimate the feasibility of the sorting system using Raspberry
CNN and conventional linear SVM classification accuracies Pi from the point of view of accuracy and data processing time
for the normal and peaberry coffee beans. Better accuracies for each image.
were obtained from CNN than conventional linear SVM in all

(a)

International Scholarly and Scientific Research & Innovation 14(6) 2020 194 ISNI:0000000091950263
World Academy of Science, Engineering and Technology
International Journal of Computer and Information Engineering
Vol:14, No:6, 2020

(b)
Fig. 8 CNN and conventional linear SVM classification accuracies for four kinds of image sizes: (a) flow chart and (b) graphical representation
Open Science Index, Computer and Information Engineering Vol:14, No:6, 2020 [Link]/10011255/pdf

of image data

REFERENCES pp.436–444, May 2015.


[16] Visen, N.S., J. Paliwal, D.S. Jayas, and N.D.G. White: Image analysis of
[1] Giacalone, D.; Degn, T.K.; Yang, N.; Liu, C.; Fisk, I.; Münchow, M. bulk grain samples using neural networks. Canadian Biosystems
Common roasting defects in coffee: Aroma composition, sensory Engineering 46:711-715, 2004.
characterization and consumer perception. Food Qual. Prefer. 2019, 71, [17] Liu, Zhao-yan, Cheng Fang, Ying Yi-bin and Rao Xiu-qin:
463–474. (CrossRef). Identification of Rice Varieties Using Nueral Networks. Journal of
[2] Bhumiratana, N.; Adhikari, K.; Chambers, E. Evolution of sensory Zhejiang University Science, 6B (11):1095-1100, 2005.
aroma attributes from coffee beans to brewed coffee. LWT Food Sci. [18] Visen, N.S., J. Paliwal, D.S. Jayas, and N.D.G. White: Specialist Neural
Technol. 2011, 44, 2185–2192. (CrossRef). Networks for Cereal Grain Classi10fication, Bio systems Engineering 82
[3] Vithu, P.; Moses, J.A. Machine vision system for food grain quality (2): 151–159, 2002.
evaluation: A review. Trends Food Sci. Technol. 2016, 56, 13–20. [19] Raji, A. O. and A. O. Alamutu: Prospects of Computer Vision
(CrossRef). Automated Sorting Systems in Agricultural Process Operations in
[4] García, M., Candelo-Becerra, J. E., & Hoyos, F. E. (2019). Quality and Nigeria. Agricultural Engineering International: The CIGR Journal of
Defect Inspection of Green Coffee Beans Using a Computer Vision Scientific Research and Development Vol. VII. Invited Overview, 2005.
System. Applied Sciences, 9(19), 4195. [20] Deshmukh, K.S. and G. N. Shinde: An Adaptive Color Image
[5] Peaberry coffee information Available at: Segmentation, Electronic Letters on Computer Vision and Image
[Link] Analysis 5(4):12-23, 2005.
Accessed 18th November 2019 [21] Jayas, D. S., J. Paliwal and N. S. Visen: Multi-layer Neural Networks for
[6] Diding Suhandy & Meinilwita Yulia (2017) Peaberry coffee Image Analysis of Agricultural Products, Journal of Agricultural
discrimination using UV-visible spectroscopy combined with SIMCA Engineering Research. 77(2):119-128, 2000.
and PLS-DA, International Journal of Food Properties, 20:sup1, S331- [22] Junlong Fang, Shuwen Wang and Changli Zhang: Genetic Algorithm
S339, DOI: 10.1080/10942912.2017.1296861 Trained Artificial Neural Network, Nature and Science, 2005.
[7] Peaberry features information Available at [23] Ding, K. and S. Gunasekaran: Shape feature extraction and
[Link] Accessed 20th November 2019 Classification of food Material Using Computer Vision, Food and
[8] Peaberry abnormality information Available from: Process Engineering Inst. of ASAE, 1994.
[Link] Accessed 18th November [24] [Link] Accessed 10th November 2019
2019 [25] António L. Amaral, Orlando Rocha1, Cristina Gonçalves, António
[9] H. Fukai, J. Furukawa, Hiroki Katsuragawa, C. Pinto, Carmelita Afonso, Augusto Ferreira and Eugénio C. Ferreira: Development of Image
Dili, Timor-Leste. "Classification of Green Coffee Beans by Analysis Methods to Evaluate 93 Barley/ Malt Grain Size, 1999.
Convolutional Neural Network and its Implementation on Raspberry Pi [26] Yang, C.C., S.O. Prasher, J.A. Landry, H.S Ramaswamy and A.
and Camera Module". Ditommaso: Application of artificial neural networks in image
[10] C. Pinto, J. Furukawa, H. Fukai, and S. Tamura, “Classification of Green recognition and classification of crop and weeds, 2000.
Coffee Bean Images Based on Defect Types Using Convolutional [27] Kavdir, I. and D. E. Guyer: Apple Grading Using Fuzzy Logic, Journal
Neural Network (CNN)”, Advanced Informatics, Concepts, Theory, and of Agricultural Engineering Research. 27:375-382, 2003.
Applications (ICAICTA), 2017 International Conference on. IEEE, [28] Coffee information Available from
pp.1– 5. 2017. [Link] Accessed 12th
[11] Suhandy, Diding and Yulia, Meinilwita and Kusumiyati, “Chemometric December 2019
quantification of peaberry coffee in blends using UV–visible [29] CNN information Available at
spectroscopy and partial least squares regression”. AIP Conference [Link]
Proceedings 2021, 060010 (2018) URL: network-cnn, Accessed 10th December 2019
[Link] [30] M. Bak, “Support Vector Classifier with Linguistic Interpretation of the
[12] Peaberry coffee bean information Available at [Link] Kernel Matrix in Speaker Verification”, Man-Machine Interactions,
[Link]/coffee-beans-review/peaberry-coffee/, Accessed 10th Krzysztof A. Cyran, Stanislaw Kozielski, James F. Peters (eds.), ISSN
December 2019 1867-5662, Springer, 2009, pp 399-406.
[13] Mezghani, D. Ben Ayed, S. Zribi Boujelbene, and N. Ellouze. [31] N. Srivastava, G. E. Hinton, A. Krizhevsky, I. Sutskever, and R.
"Evaluation of SVM kernels and conventional machine learning Salakhutdinov. Dropout: a simple way to prevent neural networks from
algorithms for speaker identification." International journal of Hybrid overfitting. JMLR, 2014.
information technology 3.3 (2010): 23-34. [32] Chainer information Available from [Link] Accessed 10th
[14] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner, “Gradient-based December 2019
learning applied to document recognition,” Proceedings of the IEEE, [33] Bahari, Nurul Iman Saiful, Asmala Ahmad, and Burhanuddin Mohd
vol. 86, no. 11, pp.2278–2324, 1998. Aboobaider. "Application of support vector machine for classification of
[15] Y. LeCun, Y. Bengio, and G. Hinton, “Deep Learning,” Nature, vol.521, multispectral data." IOP Conference Series: Earth and Environmental

International Scholarly and Scientific Research & Innovation 14(6) 2020 195 ISNI:0000000091950263
World Academy of Science, Engineering and Technology
International Journal of Computer and Information Engineering
Vol:14, No:6, 2020

Science. Vol. 20. No. 1. IOP Publishing, 2014.


[34] Deep Learning information Available at:
[Link] Accessed 18th
November 2019

Hira Lal Gope received the [Link]. (Honors) and M.S. Engineering (Thesis) in
Computer Science and Engineering from the University of Chittagong,
Chittagong-4331, Bangladesh in 2012 and 2017 respectively. He started his
carrier in the teaching and research profession as a faculty member at the
Sylhet Agricultural University, Bangladesh since 01 January 2013. His main
area of research interest is neural networks, machine learning, deep learning,
and image processing. Mr. Gope is an associate member of the Bangladesh
Computer Society (BCS).
Open Science Index, Computer and Information Engineering Vol:14, No:6, 2020 [Link]/10011255/pdf

International Scholarly and Scientific Research & Innovation 14(6) 2020 196 ISNI:0000000091950263

Common questions

Powered by AI

The use of Raspberry Pi enhances the classification system for coffee beans by providing a low-cost, accessible computing platform ideal for developing countries. It supports the installation of CNN models using Python and tools like Chainer and OpenCV. This setup allows for the real-time processing of coffee bean images captured by a camera module and classification with minimal hardware requirements, facilitating wider adoption .

Deep learning libraries like Chainer play a crucial role in developing the coffee bean sorting system by providing pre-built tools for designing and training CNN models. Chainer allows easy experimentation with network architectures, supports implementation of real-time image processing, and simplifies the computation required for classification tasks. It aids in establishing a robust system that can efficiently distinguish peaberry from normal beans .

The classification accuracy of CNN is preferred over SVM for sorting coffee beans due to CNN's ability to handle complex image recognition tasks by capturing spatial hierarchies in data through convolutional layers. CNNs achieved higher accuracies (>97%) across different image sizes compared to SVM, which had slightly lower accuracy scores. This makes CNN better suited for discriminating the subtle differences between peaberry and normal beans .

Separating peaberry beans before roasting is important because their round shape causes them to roast differently than the flat-sided normal beans, leading to inconsistencies in overall coffee quality. Peaberries have different roasting times, which means they could be over or under-roasted if mixed with other beans, affecting the final taste profile. This separation ensures uniform roasting and better flavor preservation .

Image processing and machine learning techniques, specifically Deep Convolutional Neural Networks (CNN) and Support Vector Machine (SVM), are used for discriminating between peaberry and normal coffee beans by analyzing color, morphology, shape, and size. These techniques automate classification that would otherwise require manual effort. CNNs have shown better performance in classification accuracy compared with SVM, allowing for effective automatic sorting systems .

Conventional SVM and deep CNN differ in their approach to image classification primarily through their handling of data and feature extraction. SVM uses a linear or non-linear kernel to classify data transformed into a high-dimensional feature space, typically requiring pre-defined features and often less effective with large-scale visual data. In contrast, CNN automatically extracts hierarchical features from raw image data through its convolutional layers, reducing the need for manual feature engineering and improving accuracy for complex image tasks such as differentiating coffee beans .

The developed coffee bean sorting technology has potential applications in agricultural processing beyond coffee beans, such as sorting other types of seeds and grains based on size, shape, color, or defect characteristics. The integration of image processing and machine learning offers prospects for enhanced quality control, automation of sorting processes, and reduced reliance on manual labor, which can improve efficiency and consistency across various agricultural products .

Sorting peaberry coffee beans is challenging because they have a similar shape and color to normal beans, making manual selection difficult even for trained specialists. Peaberries, being born as a single round seed in a coffee cherry, have a different shape from the usual flat-sided pair of beans, which affects roasting time. To prevent the taste from being mixed, it is essential to separate them from normal beans before roasting .

Artificial data augmentation can enhance the training of CNN models for coffee bean classification by creating a larger, more varied dataset without the need for additional authentic samples. Techniques such as random rotation, shifts, and flips introduce variability that helps the model become more robust to different orientations and scales of the beans, improving generalization and accuracy in real-world scenarios .

To improve classification performance, proposed solutions include increasing the number of samples to enhance model training, utilizing advanced SVM kernels for finer classification, restructuring CNN frameworks, and implementing data augmentation techniques such as random rotation and shifts to create more diverse training datasets. These solutions aim to enhance both the precision and robustness of the sorting system .

You might also like