1. Introduction
Honey has a rich history of culinary and medicinal applications and is recognized for its distinct taste and sweetness. Honey, owing to its unique physicochemical properties, serves not only as a traditional sweetener but also as a substance highly valued for its potential health benefits. Humans have long utilized honey in remedies for soothing sore throats and promoting wound healing [
1]. Its sensory attributes, particularly color, provide important insights into both floral origin and flavor intensity. Lighter-colored honey is generally associated with milder flavors, whereas darker varieties tend to exhibit more robust taste profiles [
2].
Beyond sensory qualities, color variation in honey has been consistently linked to differences in bioactive compounds. Numerous studies have demonstrated that darker honey contains higher levels of total phenolic compounds, which are strongly correlated with greater antioxidant capacity. This relationship has been repeatedly confirmed across diverse methodologies, underscoring the significance of honey color as an indicator of potential health benefits [
3,
4,
5].
Despite these findings, systematic approaches to grading honey based on its color remain limited. While humans can visually distinguish honey shades, objective and automated grading methods are underdeveloped. This gap highlights the need for technological solutions that can provide reliable, reproducible, and cost-effective honey color classification.
2. Literature Review
The growing importance of AI and deep learning in agriculture has led to exploring applications in honey classification, identification, and adulteration detection. An artificial neural network (ANN) combined with low-cost near-infrared light acquisition is used to differentiate farmed and wild honey, achieving an accuracy rate of 96% and a cross-entropy value of 1.14 [
6]. Similarly, hyperspectral imaging coupled with deep learning has been used to identify the botanical origin of honey, yielding a classification accuracy of 94.1% [
1].
The methods are expanded to detect honey adulteration. For instance, linear discriminant analysis and K-Nearest Neighbor algorithms are used to determine whether honey samples are adulterated with sugar syrup, achieving a cross-validation accuracy of 96.39% [
7]. A device employing ANN with gradient descent backpropagation is developed to distinguish authentic from counterfeit honey, reporting an accuracy rate of 87.5% [
8]. Principal component analysis has been utilized for dimensionality reduction and exploratory data analysis, followed by clustering methods such as K-means, K-medians, and Fuzzy C-Means to classify pure honey versus adulterants [
9].
Such innovative methods have extended beyond traditional classification. For example, an integrated architecture combining class embodiment autoencoders and variational autoencoders was proposed for Manuka honey classification using hyperspectral imaging. Although this method achieved only 55.4% validation accuracy on unseen honey brands, it demonstrated the potential of advanced generative models in enhancing generalization [
10].
Convolutional neural networks (CNNs) have been widely applied in agricultural product grading. CNNs are used to assess abaca fiber quality in food quality inspection [
11,
12]. In ref. [
13], the authors presented a detailed overview of the uses of computer vision in fruit classification and grading, for sortingAlphonso mangoes [
14], cashews [
15], durians [
16], pineapples [
17], bananas [
18,
19,
20], sugar apples [
21], corn [
22], beans [
23], and coffee [
24]. These systems often rely on features such as size, shape, and color, achieving accuracy rates as high as 97.9% in grading apples, bell peppers, oranges, and tomatoes [
25].
The application of computer vision and deep learning specifically for grading honey based on its color remains underexplored. To date, no device has been designed exclusively for this purpose. Therefore, it is necessary to develop a prototype system capable of grading honey into categories such as light amber, medium amber, and dark amber. While such grading may indirectly relate to health benefits, the present study focuses solely on color-based classification and does not attempt to provide comprehensive health assessments.
3. Materials and Methods
3.1. Conceptual Framework
Figure 1 shows the conceptual framework of this study. It outlines the flow from inputting JPEG images of honey to the final output of honey grade classification. The preprocessing step enhances image quality, followed by feature extraction, where relevant characteristics are identified. The classification process utilizes a Convolutional Neural Network, trained on a dataset of pre-processed images and associated grades, to classify new honey images into distinct grades. The output is the predicted classification of honey grades based on the processed image features.
3.2. Development of Hardware Component
We designed the hardware component of the device to function as an image acquisition system. We used this device in the data gathering and later on in prototype testing for classifying various classes of honey.
Figure 2 shows the drawing design of the image acquisition device. The Raspberry Pi 4 with quad-core Cortex-A72, 64-bit system on chip, with 8-gigabyte random access memory acts as the microprocessor of the device, along with a 12.3-megapixel Raspberry Pi Camera and 16 mm telephoto high-quality lens for image acquisition, and a 5-inch High-Definition Multimedia Interface Raspberry Pi monitor with a resolution of 800 × 480 for device interaction. The camera has a sensor resolution of 4056 × 3040 pixels that allows the device to capture detailed and high-resolution images.
3.3. Honey Dataset Collection
In collaboration with local honey farmers in Catanduanes, various honey samples were procured for dataset construction. High-resolution images were manually acquired using a custom-developed image acquisition device, following the experimental setup illustrated in
Figure 2. The samples were categorized into three distinct classes: light, medium, and dark amber. Each class comprised 300 images, resulting in a total dataset of 900 training images. To ensure data integrity, a rigorous cleansing process was implemented to eliminate inconsistencies and sub-optimal captures. Any images discarded during this process were replaced with additional captures to maintain the target dataset size of 900 images.
Figure 3 shows the sample images from the collected honey datasets, along with their corresponding labels. Subsequently, these datasets are used in model training.
3.4. Development of Software Component
We constructed the model using CNNs and a user-interface design (
Figure 4). The CNN model was trained to classify honey grades, while the user interface was developed to facilitate human interaction with the prototype system. The model was constructed using Google Colab, whereas the user-interface implementation was carried out directly on the Raspberry Pi 4. For model construction, we employed the MobileNetV2 CNN architecture, selected for its lightweight design and low memory requirements, which make it well-suited for deployment on resource-constrained devices such as the Raspberry Pi. MobileNetV2 performs efficiently in classification tasks, often surpassing other CNN architectures in both accuracy [
26,
27] and computational efficiency [
28].
We prepared the dataset, dividing it into training and validation subsets with a ratio of 80:20. The batch size was set to 16, and all images were resized to 300 × 300 pixels. To enhance the dataset, we applied data augmentation techniques. Preprocessing followed the MobileNetV2 protocol, scaling pixel values from 0–255 to the range −1.0 to 1.0, as required by the base model.
The architecture utilized MobileNetV2 pre-trained on the ImageNet dataset for transfer learning, serving as the feature extractor. We loaded the pre-trained weights while excluding the top layers. For initial training, we added a pooling layer to reduce feature dimensionality, a dropout layer with a rate of 0.2 to mitigate overfitting, and applied a learning rate of 0.0001 with a softmax activation function. The top layers were trained for 10 epochs, while the base layers remained frozen. As shown in
Figure 5, this stage achieved a training accuracy of 89.17% and a validation accuracy of 88.9%.
Subsequently, we fine-tuned the model by unfreezing the final layers of the base architecture. The model was retrained for an additional 10 epochs with a reduced learning rate to ensure gradual weight adjustments.
Figure 6 illustrates the results of this final training phase, which achieved 98.09% training accuracy and 96.5% validation accuracy. The final model was saved in Keras format, preserving the architecture, weights, and training configuration. This trained model was then integrated into the user-interface development process.
3.5. User Interface
The prototype’s user interface was designed to enable seamless human interaction with the system. We employed three frameworks: OpenCV for real-time image processing, TensorFlow Lite for model inference, and Flask for managing user-interface logic and system integration. To ensure compatibility with the Raspberry Pi 4, the Keras model was converted into TensorFlow Lite format.
Flask served as the primary framework, handling both front-end and back-end operations. This design allowed users to access the interface either through a network connection (online) or via local access on the Raspberry Pi.
Figure 7 presents a sample image of the developed user interface, demonstrating its functionality and usability for human operators.
3.6. Prototype Testing
We integrated the developed hardware and software components to create a fully functional prototype for honey grade classification. To evaluate the system’s performance and its practical grading capabilities, we collaborated with local honey farmers in Catanduanes to source authentic honey samples for the testing phase. As illustrated in
Figure 7, the user interface provides a real-time camera feed to assist the operator in image acquisition. To perform a test, the user positions the honey sample according to the experimental setup shown in
Figure 2 and selects the “Capture Image” button once the feed provides a clear view. The acquired image is then displayed on the left side of the interface for visual verification. If the image quality is sufficient, the user selects the “Predict Honey Grade” button, which triggers the model to process the data and display the predicted grade on the screen.
To evaluate the performance of the prototype, we tested the model using 90 independent images, consisting of 30 samples for each grade category. The prototype individually predicted the classification of each sample, and we recorded these outputs to compare them against the established ground truth. We summarized these results through a confusion matrix, which allowed for a detailed analysis of the model’s classification accuracy and potential misclassifications. Based on these testing results, we calculated the final system accuracy using Equation (1).
where
N is the total number of testing samples,
C is the total number of classes, and
TPi is the true positive count for class
i.
We also calculated the recall for each class using Equation (2) to identify which classes the model performs well and which ones underperform.
where
TPi is the true positive count for class
i, and
FNi is the false negative count for class
i.
4. Results and Discussion
The classification results were collated and are summarized in the confusion matrix presented in
Table 1. Evaluation of the 30 test images per class revealed that the prototype achieved perfect classification for both the light amber and dark amber categories. In contrast, the model encountered difficulties with the medium amber class; of the 30 test images, 22 were correctly identified, while 8 were misclassified as dark amber. Consequently, the system achieved an overall testing accuracy of 91.11%. Sample prediction results from the prototype are illustrated in
Figure 8.
As shown in the recall metrics presented in
Table 2, both the light and dark amber classes achieved a recall of 100%, indicating that the prototype successfully identified all instances within these categories. However, the medium amber honey yielded a lower recall of 73.33%, further highlighting the model’s performance limitations regarding this specific grade. Despite these challenges, the prototype demonstrated a satisfactory overall performance, suggesting its viability as an automated alternative for honey grading.
5. Conclusions
We developed and evaluated a prototype for classifying honey into Light, Medium, and Dark Amber grades. By utilizing the MobileNetV2 CNN architecture, the model achieved a 91.11% testing accuracy. While the system exhibited robust performance with 100% recall for light and dark amber categories, the medium amber grade presented a classification challenge with a 73.33% recall. This discrepancy is likely attributable to the visual similarities between the medium and dark amber samples. The integration of the model onto a Raspberry Pi using TensorFlow Lite, OpenCV, and Flask demonstrated the feasibility of deploying complex deep learning tasks on edge devices. The Flask-based user interface provided a versatile platform for both online and offline deployment, showcasing the potential for portable and efficient agricultural technology.
Despite these positive outcomes, the limitations in classifying medium amber honey suggest clear avenues for future research. It is required to expand the dataset to include more diverse samples and optimize hyperparameters to enhance model sensitivity. Additional honey characteristics also need to be added beyond color for more comprehensive grading. However, the model developed confirms the feasibility of a low-cost, Raspberry Pi-based prototype as an effective solution for automated honey grading.
Author Contributions
Conceptualization, M.U.A. and J.F.V.; methodology, M.U.A.; software, M.U.A.; validation, M.U.A. and J.F.V.; formal analysis, M.U.A.; investigation, M.U.A.; resources, M.U.A.; data curation, M.U.A.; writing—original draft preparation, M.U.A.; writing—review and editing, M.U.A.; visualization, M.U.A.; supervision, J.F.V.; project administration, M.U.A.; funding acquisition, M.U.A. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The data presented in this study are available on request from the corresponding author.
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Saputro, A.H.; Aprichilia, C. Classification System of Honey Floral Origin based on Visual Near-Infrared Imaging. In Proceedings of the 2019 International Conference on Sustainable Information Engineering and Technology (SIET), Lombok, Indonesia, 16–17 October 2019. [Google Scholar]
- Dzugan, M.; Tomczyk, M.; Sowa, P.; Grabek-Lejko, D. Antioxidant Activity as Biomarker of Honey Variety. Molecules 2018, 23, 2069. [Google Scholar] [CrossRef] [PubMed]
- Al-Mamary, M.; Al-Meeri, A.; Al-Habori, M. Antioxidant activities and total phenolics of different types of honey. Nutr. Res. 2002, 22, 1041–1047. [Google Scholar] [CrossRef]
- Aljadi, A.; Kamaruddin, M. Evaluation of the phenolic contents and antioxidant capacities of two Malaysian floral honeys. Food Chem. 2004, 85, 513–518. [Google Scholar] [CrossRef]
- Bertoncelj, J.; Dobersek, U.; Jamnik, M.; Golob, T. Evaluation of the phenolic content, antioxidant activity and colour of Slovenian honey. Food Chem. 2007, 105, 822–828. [Google Scholar] [CrossRef]
- Suarin, N.A.S.; Chia, K.S.; Kosmani, F.N. Stingless Bee Honey Classification Using Near Infrared Light Coupled with Artificial Neural Network. In Proceedings of the 2020 Zooming Innovation in Consumer Technologies Conference (ZINC), Novi Sad, Serbia, 26–27 May 2020. [Google Scholar]
- Al-Awadhi, M.A.; Deshmukh, R.R. Honey Adulteration Detection using Hyperspectral Imaging and Machine Learning. In Proceedings of the 2nd International Conference on Artificial Intelligence and Signal Processing (AISP), Vijayawada, India, 12–14 February 2022. [Google Scholar]
- Hortinela, C.C.; Balbin, J.R.; Tibayan, P.J.A.; Cabela, J.M.D.; Magwili, G.V. Classification of Honey as Genuine or Fake via Artificial Neural Network using Gradient Descent Backpropagation Algorithm. In Proceedings of the 2020 IEEE 12th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM), Manila, Philippines, 3–7 December 2020. [Google Scholar]
- Kumar, N.; Ranjan, R.; Kumar, Y.; Patel, S.S.; Krishna, V.S. Discrimination of Various pure Honey samples and its Adulterants using FTIR Spectroscopy Coupled with Chemometrics. In Proceedings of the 2021 7th International Conference on Advanced Computing and Communication Systems (ICACCS), Coimbatore, India, 19–20 March 2021. [Google Scholar]
- Mekha, P.; Teeyasuksaet, N.; Sompowloy, T.; Osathanunkul, K. Honey Bee Sound Classification Using Spectrogram Image Features. In Proceedings of the 2022 Joint International Conference on Digital Arts, Media and Technology with ECTI Northern Section Conference on Electrical, Electronics, Computer and Telecommunications Engineering (ECTI DAMT & NCON), Chiang Rai, Thailand, 26–28 January 2022. [Google Scholar]
- Hong, J.; Caya, M.V.C. Development of an Abaca Fiber Automated Grading System Using Computer Vision and Deep Convolutional Neural Network. In Proceedings of the TENCON 2021—2021 IEEE Region 10 Conference (TENCON), Auckland, New Zealand, 7–10 December 2021. [Google Scholar]
- Hong, J.; Caya, M.V.C. Development of Convolutional Neural Network Model for Abaca Fiber Stripping Quality Classification System. In Proceedings of the 2022 IEEE 14th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM), Boracay, Philippines, 1–4 December 2022. [Google Scholar]
- Patel, S.N.; Patel, B. Machine Vision based Fruit Classification and Grading—A Review. Int. J. Comput. Appl. 2017, 170, 22–29. [Google Scholar]
- Pauly, L.; Sankar, D. A new Method for Sorting and Grading of Mangos Based on Computer Vision Systems. In Proceedings of the International Conference on Computer Vision and Image Processing, Kerala, India, 16–19 December 2015. [Google Scholar]
- Sivaranjani, A.; Senthilrani, S.; Ashokumar, B.; Murugan, A.S. An Improvised Algorithm for Computer Vision Based Grading System Using Deep CNN. In 2018 IEEE International Conference on System, Computation, Automation and Networking (ICSCA); IEEE: New York, NY, USA, 2018; pp. 1–5. [Google Scholar]
- Villaverde, J.F.; Uy, J.N. A Durian Variety Identifier Using Canny Edge and CNN. In Proceedings of the IEEE 7th International Conference on Control Science and Systems Engineering (ICCSSE), Qingdao, China, 30 July–1 August 2021. [Google Scholar]
- Aguilar, E.J.L.; Borromeo, G.K.P.; Villaverde, J.F. Determination of Pineapple Ripeness Using Support Vector Machine for Philippine Standards. In Proceedings of the IEEE 7th International Conference on Control Science and Systems Engineering (ICCSSE), Qingdao, China, 30 July–1 August 2021. [Google Scholar]
- Villaverde, J.F.; Taghoy, D.M. A Fuzzy Logic Approach for the Determination of Cavendish Banana Shelf Life. In Proceedings of the TENCON 2018—2018 IEEE Region 10 Conference, Jeju, Republic of Korea, 28–31 October 2018. [Google Scholar]
- Linsangan, N.B.; Buenconsejo, L.B. Classification of Healthy and Unhealthy Abaca leaf using a Convolutional Neural Network (CNN). In Proceedings of the 2021 IEEE 13th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM), Manila, Philippines, 28–30 November 2021. [Google Scholar]
- Linsangan, N.B.; Buenconsejo, L.B. Detection and Identification of Abaca Diseases using a Convolutional Neural Network CNN. In Proceedings of the TENCON 2021—2021 IEEE Region 10 Conference (TENCON), Auckland, New Zealand, 7–10 December 2021. [Google Scholar]
- Sanchez, R.B.; Esteves, J.A.C.; Linsangan, N.B. Determination of Sugar Apple Ripeness via Image Processing Using Convolutional Neural Network. In Proceedings of the 15th International Conference on Computer and Automation Engineering (ICCAE), Sydney, Australia, 3–5 March 2023. [Google Scholar]
- Yumang, A.; Magwili, G.; Montoya, S.K.C.; Zaldarriaga, C.J.G. Determination of Shelled Corn Damages using Colored Image Edge Detection with Convolutional Neural Network. In Proceedings of the IEEE 12th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM), Manila, Philippines, 3–7 December 2020. [Google Scholar]
- Yumang, A.N.; Juana, M.C.M.S.; Diloy, R.L.C. Detection and Classification of Defective Fresh Excelsa Beans Using Mask R-CNN Algorithm. In Proceedings of the 14th International Conference on Computer and Automation Engineering (ICCAE), Brisbane, Australia, 25–27 March 2022. [Google Scholar]
- Luis, V.A.M.; Quiñones, M.V.T.; Yumang, A.N. Classification of Defects in Robusta Green Coffee Beans Using YOLO. In Proceedings of the IEEE International Conference on Artificial Intelligence in Engineering and Technology (IICAIET), Kota Kinabalu, Malaysia, 13–15 September 2022. [Google Scholar]
- Nishi, T.; Kurogi, S.; Matsuo, K. Grading Fruits and Vegetables Using RGB-D images and Convolutional Neural Network. In 2017 IEEE Symposium Series on Computational Intelligence (SSCI); IEEE: New York, NY, USA, 2017; pp. 1–6. [Google Scholar]
- Sandler, M.; Howard, A.; Zhu, M.; Zhmoginov, A.; Chen, L.C. MobileNetV2: Inverted Residuals and Linear Bottlenecks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Salt Lake City, UT, USA, 18–22 June 2018. [Google Scholar]
- Secil, G.; Karagol, S. Automated Abnormality Classification of Chest Radiographs Using MobileNetV2. In Proceedings of the 2020 Medical Technologies Congress (TIPTEKNO), Antalya, Turkey, 19–21 November 2020. [Google Scholar]
- Dong, K.; Zhou, C.; Ruan, Y.; Li, Y. MobileNetV2 Model for Image Classification. In Proceedings of the 2nd International Conference on Information Technology and Computer Application (ITCA), Guangzhou, China, 18–20 December 2020. [Google Scholar]
| Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |