1181-Article Text-3627-1-10-20240603
1181-Article Text-3627-1-10-20240603
E-mail: [email protected]
Abstract
The current research about the classification of coffee fruit ripeness based on multispectral images has
been developed using the Convolutional Neural Network (CNN) method to extract patterns from high-
dimensional multispectral images. The high complexity of CNN allows the model to capture complex
features but requires more time and computational resources for model training and testing. Therefore,
in this study, classification is performed using a more straightforward method such as Naïve Bayes
because its complexity only depends on the number of features and samples. The method only considers
each feature independently, so it has high speed and does not require a lot of computational resources.
Naïve Bayes is applied to color and texture features extracted from multispectral images of coffee fruit.
There are 300 features consisting of 60 color features and 240 texture features. Experiments were
conducted based on the comparison of training and testing data and the use of each feature. The
combination of color and texture features showed better performance than color or texture features
alone, with the highest accuracy reaching 91.01%. In conclusion, using Naïve Bayes is still reasonably
good in classifying the ripeness of coffee fruit based on multispectral images.
121
122 Jurnal Ilmu Komputer dan Informasi (Journal of Computer Science and Information), volume 17,
issue 2, June 2024
Fig. 2. Special multispectral image camera Fig. 3. The classification of coffee fruit maturity method
640 images with a size of 224x224 pixels each. The segmentation stages can be seen in Fig. 4.
multispectral image of coffee fruit has 15 color
channels with different wavelengths, as shown in
Table 1.
The maturity level of coffee fruit is grouped
into five: immature, semimature, mature, overripe,
(a) original (b) blur (c) Sobel (d) erosion
and dry. The number for each maturity level can be
seen in Table 2.
𝐸𝑛𝑒𝑟𝑔𝑦 = ∑
𝑙𝑒𝑣𝑒𝑙𝑠−1
2
√𝑃𝑖,𝑗 (6) Matrix. Confusion Matrix is a table that describes
𝑖,𝑗=0 the performance of a particular algorithm. Each
𝑙𝑒𝑣𝑒𝑙𝑠−1 𝑃𝑖,𝑗
𝐻𝑜𝑚𝑜𝑔𝑒𝑛𝑒𝑖𝑡𝑦 = ∑ (7) row in the table represents actual data, and each
1 + (𝑖 − 𝑗)2
𝑖,𝑗=0
column represents predicted data [11]. The
𝑙𝑒𝑣𝑒𝑙𝑠−1 (𝑖 − 𝜇𝑖 )(𝑖 − 𝜇𝑗 ) Confusion Matrix shown in Table 3. All of the
𝐶𝑜𝑟𝑟𝑒𝑙𝑎𝑡𝑖𝑜𝑛 = ∑ 𝑃𝑖,𝑗 (8)
𝑖,𝑗=0 parameters is averaging using macro average.
√(𝜎𝑖2 )(𝜎𝑗2 )
[ ] Macro average is summing the parameters then
divide by the parameter number. The parameters
Color feature extraction is done in each color obtained from the Confusion Matrix table
channel, so color feature extraction produces 60 calculation include the following:
features. The extraction of texture features is done
in each color channel with four angles, namely 0°, 𝑇𝑃 (11)
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 =
45°, 90°, and 135°, so the extraction of texture 𝐹𝑃 + 𝑇𝑃
features results in 240 features. If these features are
combined, the total features amount to 300
features. 𝑇𝑃 (12)
𝑅𝑒𝑐𝑎𝑙𝑙 =
𝐹𝑁 + 𝑇𝑃
3.4. Gaussian Naïve Bayes
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 × 𝑅𝑒𝑐𝑎𝑙𝑙 (13)
Naïve Bayes is an algorithm that applies simple 𝐹1 𝑆𝑐𝑜𝑟𝑒 = 2 ×
𝑃𝑟𝑒𝑐𝑖𝑠𝑖𝑜𝑛 + 𝑅𝑒𝑐𝑎𝑙𝑙
probability calculations by summing frequencies
and combinations of values in a data set [10]. Table 3 Confusion Matrix
However, the use of Naïve Bayes is adjusted to the Actual Values
Positive Negative
nature of the data in the dataset. Color and texture
features extracted from multispectral images of
Predicted Class
images. Therefore, the red-orange color channel is in each color channel, resulting in 60 color features
used as a reference for cropping other color and 240 texture features. If these features are
channels. combined, the total features amount to 300
Next, the multispectral image of coffee fruit is features. The extraction results of each feature can
extracted to obtain the color and texture features be seen in Fig. 5 and Fig. 6.
described in the previous point. Extraction is done