Abstract
Basil varieties were classified using a convolutional neural network (CNN) with VGG16 architecture. The developed system in this study identified and classified the variety of basil images. The system applied the contrast-limited adaptive histogram equalization (CLAHE) algorithm to the basil image in the architecture VGG16 to extract features and classify the images. The system was tested using 50 images, and the confusion matrix showed an 82.00% accuracy. An inaccurate output was caused by the wrong positions or the size of the leaf. Of the 50 basil images, 41 were correctly classified. Two models were created in the study for epochs of eight and 10. The best model study was chosen based on accuracy. The best model showed an accuracy of 97% in training for 10 epochs.
1. Introduction
Ocimum basilicum, commonly known as basil or “balanoy” in the Philippines, is cultivated for condiment and culinary use. Basil belongs to the Lamiaceae family and is an important herb widely used globally [1]. It is known for its versatile flavor and is used in a variety of dishes. Basil comes in a variety of forms, each having its own flavor, scent, and therapeutic qualities. The accurate identification of basil is essential for culinary applications, medicinal uses, and conservation initiatives [2,3].
Holy basil and Red Holy basil leaves have varying textures, with thicker and more robust edges than others [4]. Lemon basil leaves show soft and malleable texture comparable to sweet basil in tenderness [5]. Queenette Thai basil and Thai basil are distinct varieties with larger leaves, purple stems, and flowers, and slightly narrower leaves and serrated edges while sweet basil has glossy, oval, slightly trimmed leaves, and smooth or serrated edges and is frequently used in cooking [6]. Conventional techniques such as visual inspection are used to identify the many types of basil. Using algorithms that combine image processing and machine learning [7,8,9], we developed a system on a Raspberry Pi to classify basil types. Contrast-limited adaptive histogram equalization (CLAHE), VGG16 architecture, and machine learning were applied to the developed image-based process systems in this study [10,11,12].
Studies involving the characteristics of leaves have been conducted by using color-based image processing techniques and deep learning with CNNs. An automated method for detecting diseases in basil leaves was developed in Refs. [13,14]. The method with CNN was highly accurate in identifying basil leaves with 97% accuracy. Various deep-learning techniques were used for transfer learning. A CNN and support vector machine (SVM) were implemented to identify and classify illnesses in the leaves of the betel vine [15,16,17]. A variety of image processing methods was adopted for image processing [18,19,20] such as clustering, thresholding, and edge detection. Such methods were accurate but took a long time to extract features from images.
Studies on the basil leaf were limited in exploring diseases and nutrient deficiencies. In addition, the feature extraction and classification of basil varieties are lacking, and CNN with the VGG16 architecture has not been applied yet. Raspberry Pi with CLAHE also has not been tested for basil leaf images. Therefore, we developed a system with those elements to classify Ocimum basilicum species accurately. Sweet basil, Thai basil, Holy basil, Lemon basil, Queenette Thai basil, and Red Holy basil were experimented on with the developed system. The system was developed to classify different types of basil species using feature extraction as a classifier.
In this study, we designed a system capable of capturing images of basil varieties and implemented CLAHE to enhance training and testing for basil images. Feature extraction and classification were used to assess the system’s reliability with a confusion matrix. By combining hardware and advanced neural network techniques, an efficient and accurate basil classification system was successfully developed. The system reliably and effectively identified basil leaves. The results of this study will offer valuable assistance to individuals who are engaged in gardening, planting, or farming as well as in the culinary area. Despite the similar physical qualities shared by many basil types, visually differentiating between them can be difficult. Utilizing a convolutional neural network, our prototype simplifies the task of distinguishing various basil types. By shifting from a reliance on the naked eye, this innovative model employs image processing techniques, specifically focusing on basil leaves, to accurately identify their specific classifications. This approach streamlines and enhances the recognition process, promising to be a valuable tool for those involved in basil cultivation.
2. Methodology
2.1. Conceptual Framework
We identified specific basil types: Sweet basil, Thai basil, Holy basil, Lemon basil, Queenette Thai basil, and Red Holy basil. The health conditions, diseases, or rusts associated with basil were not identified. We employed a Raspberry Pi 4 and camera module for image processing and capturing the basil types. We collected 400 images for each basil variety, totaling 2400 images. The chosen architecture for the CNN was VGG16 since it is a well-trained CNN. The architecture was used for feature extraction to identify basil varieties (Figure 1).
Figure 1.
Conceptual framework.
An image was captured from the camera module and processed to be enhanced using CLAHE. The features of the enhanced image were extracted and classified by using the CNN. As the network was trained, different information was extracted to identify patterns or features. The network learned the hierarchical representations of the input images for classification. The output shows the variety of the basil leaves.
2.2. Prototype Block Diagram
The system’s block diagram is displayed in Figure 2. Basil leaf images were captured under LED lights. The general-purpose input/output (GPIO) and high-definition multimedia interface (HDMI) were used for display. Troubleshooting was performed to restore the system’s functionality if there were hardware or software-related problems.
Figure 2.
System’s block diagram.
2.3. System Flowchart
Figure 3 displays the system operation flow chart. The model was loaded into the system; then, the Raspberry Pi 4 camera module captured basil leaf images. Next, the CLAHE module enhanced the image. After enhancing the image, the CNN module extracted features to classify the input image. Finally, the output was displayed on the LCD.
Figure 3.
System operation flowchart.
Figure 4 illustrates the process of image enhancement using CLAHE, where the camera module acquires a basil image and the CLAHE algorithm improves it. The image is optimized for classification to ensure the operation of the CNN architecture. The textures and hues of basil leaves vary significantly. Therefore, CLAHE enhanced the contrast of the captured images by dispersing intensity, facilitating CNN extraction, and enabling adaptive contrast adjustment. The CNN improved classification accuracy in basil leaf images by enhancing contrast and illumination normalization of the texture and color differences (Figure 5).
Figure 4.
Image enhancement using CLAHE.
Figure 5.
Training process of CNN.
2.4. Dataset
The dataset used consisted of 2400 basil images, each containing 400 images. The varieties were identified and predicted. The dataset was enhanced using CLAHE and then sorted for training, testing, and validation. A total of 70% of the VGG16 model dataset was used for training, 15% for testing, and 15% for validation, with 1680 images for training, 360 images for testing, and 360 images for validation. After the validation of the model, the classification accuracy was estimated. The VGG16 model provided 1000 outputs, with the CNN producing 6 outputs based on the basil type.
Figure 6 and Table 1 show samples used in testing the system and included in the training data set. The Raspberry Pi camera module captured images at a variety of angles to accurately identify leaf orientations and identify basil varieties.
Figure 6.
Basil leaves used in this study.
Table 1.
Ocimum basilicum Classification.
2.5. System Hardware
The system is presented in Figure 7.
Figure 7.
System developed in this study.
3. Results and Discussion
The training performance of the model is depicted in Figure 8. The model improved its accuracy over time. Two models with different epochs were tested to determine the better model. For 10 epochs, the accuracy was 97% while for eight epochs, the accuracy was 96%.
Figure 8.
Accuracy for indifferent epochs.
The confusion matrix was used to evaluate the system’s performance (Table 2). Five actual samples of basil leaves were included in the total of 30 samples to evaluate the system (Figure 9). Computing the accuracy of the system involves dividing the total number of samples by the number of correct classifications, (1), and then multiplying the result by 100. Out of 50 basil leaves, 41 were correctly identified with an accuracy of 82.00%.
Table 2.
Confusion matrix.
Figure 9.
Actual sample of basil leaves.
4. Conclusions
Using a CNN with an architecture of VGG16, we developed a system for classifying basil leaves. The system recognized the variety of the input basil image successfully. The VGG16 was used to extract the features of the basil images while CLAHE was implemented to predict basil leaves. The clip limit of seven was used for CLAHE since it effectively enhanced basil leaves, prevented noise amplification, and boosted image contrast. The confusion matrix presented 97% accuracy for 10 epochs of training. Out of the 50 basil leaves, 41 were correctly identified, showing an accuracy of 82.00%. The positions and size of basil leaves impacted capturing images and identification accuracy. Leaves that were not matured or did not have a decent size were classified as different leaves. Therefore, precisely placing a leaf under the camera is important to prevent the misclassification of CNN. Increasing the dataset with diverse basil lead images and fine-tuning the CNN with a high-quality camera improve the results.
Author Contributions
Conceptualization, M.A.N.P., J.I.B.S. and J.F.V.; methodology, M.A.N.P. and J.I.B.S.; software, J.I.B.S.; validation, M.A.N.P.; writing—original draft preparation, J.I.B.S.; writing—review and editing, M.A.N.P., J.I.B.S. and J.F.V.; supervision, J.F.V. All authors have read and agreed to the published version of the manuscript.
Funding
The research received no external funding.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The data are contained within the article.
Conflicts of Interest
The authors declared no conflict of interest.
References
- Chávez-González, M.L.; Rodríguez-Herrera, R.; Aguilar, C.N. Essential Oils: A Natural Alternative to Combat Antibiotics Resistance. A Natural Alternative to Combat Antibiotics Resistance. In Antibiotic Resistance: Mechanisms and New Antimicrobial Approaches; Elsevier Inc.: Amsterdam, The Netherlands, 2016; pp. 227–237. [Google Scholar] [CrossRef]
- Vijayashree, T.; Gopal, A. Comparison procedure for the authentication of Basil (Ocimum tenuiflorum) leaf using image processing technique. In Proceedings of the 2015 International Conference on Communication and Signal Processing, ICCSP 2015, Melmaruvathur, India, 2–4 April 2015. [Google Scholar] [CrossRef]
- Ramos, R.A.; Villaverde, J.F. Dried Water Lily Stem Validation for Weaving Fiber Production using K-Nearest Neighbors (K-NN) Classification Algorithm. In Proceedings of the 2024 7th International Conference on Information and Computer Technologies (ICICT), Honolulu, HI, USA, 15–17 March 2024; pp. 211–215. [Google Scholar] [CrossRef]
- Priya, G.L.; Baskar, C.; Deshmane, S.S.; Adithya, C.; Das, S. Revolutionizing Holy-Basil Cultivation with AI-Enabled Hydroponics System. IEEE Access 2023, 11, 82624–82639. [Google Scholar] [CrossRef]
- Cohen, M.M. Tulsi-Ocimum sanctum: A herb for all reasons. J. Ayurveda Integr. Med. 2014, 5, 251. [Google Scholar] [CrossRef] [PubMed]
- Mettripun, N. Thai Herb Leaves Classification Based on Properties of Image Regions. In Proceedings of the 2020 59th Annual Conference of the Society of Instrument and Control Engineers of Japan, SICE 2020, Chiang Mai, Thailand, 23–26 September 2020. [Google Scholar] [CrossRef]
- Buonopane, G.J.; Antonacci, C.; Lopez, J.L. Effect Of Cold Plasma Processing On Sweet Basil And The Biochemistry of Its Essential Oils. In Proceedings of the 2017 IEEE International Conference on Plasma Science (ICOPS), Atlantic City, NJ, USA, 21–25 May 2017. [Google Scholar] [CrossRef]
- Hortinela, C.C.; Balbin, J.R.; Fausto, J.C.; Divina, P.D.C.; Felices, J.P.T. Identification of Abnormal Red Blood Cells and Diagnosing Specific Types of Anemia Using Image Processing and Support Vector Machine. In Proceedings of the 2019 IEEE 11th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM), Laoag, Philippines, 29 November–1 December 2019; pp. 1–6. [Google Scholar] [CrossRef]
- Abalos, M.R.; Villaverde, J.F. Fresh Fish Classification Using HOG Feature Extraction and SVM. In Proceedings of the 2022 IEEE 14th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM), Boracay Island, Philippines, 1–4 December 2022; pp. 1–5. [Google Scholar] [CrossRef]
- Villaverde, J.F.; Ferrer, M.D.; Macabeo, J.A.T.; Manuel, J.T.M. Classification of Cotton Fabric, Pineapple Fabric and Cotton Pineapple Blend Fabric with VGG16 using Keras. In Proceedings of the 2023 IEEE 15th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM), Coron, Palawan, Philippines, 19–23 November 2023; pp. 1–6. [Google Scholar] [CrossRef]
- Cadorna, J.F.G.; Cervantes, J.P.M.; IV, C.C.H.; Fausto, J.C. Identification of Salt Applying Image Processing and Machine Learning Techniques. In Proceedings of the 2023 IEEE 15th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM), Coron, Palawan, Philippines, 19–23 November 2023; pp. 1–6. [Google Scholar] [CrossRef]
- Kavitha, R.; Kavitha, M.; Srinivasan, R.; Rajalakshmi, N.R.; Dhayanidhi, R. Basil Leaf Diseases Detection using Deep Learning architectures. In Proceedings of the INDICON 2022—2022 IEEE 19th India Council International Conference (INDICON), Kochi, India, 24–26 November 2022. [Google Scholar] [CrossRef]
- Muhali, A.; Linsangan, N. A Comparison of Keras Application Models with Pre-Trained Weights in Predicting the Disease of Lanzones Leaf. In Proceedings of the 2022 IEEE 14th International Conference on Humanoid, Nanotechnology, Information Technology, Communication and Control, Environment, and Management (HNICEM), Boracay Island, Philippines, 1–4 December 2022; pp. 1–6. [Google Scholar] [CrossRef]
- Manlises, C.O.; Santos, J.B.; Adviento, P.A.; Padilla, D.A. Expiry Date Character Recognition on Canned Goods Using Convolutional Neural Network VGG16 Architecture. In Proceedings of the 2023 15th International Conference on Computer and Automation Engineering (ICCAE), Sydney, Australia, 3–5 March 2023; pp. 394–399. [Google Scholar] [CrossRef]
- Malek, M.A.; Basak, S.; Reya, S.S. An Approach to Identify Diseases in Betel Leaf Using Deep Learning Techniques. In Proceedings of the 2022 4th International Conference on Sustainable Technologies for Industry 4.0, STI 2022, Dhaka, Bangladesh, 17–18 December 2022. [Google Scholar] [CrossRef]
- Desiderio, A.J.M.H.; Tenorio, A.J.F.; Manlises, C.O. Health Classification System of Romaine Lettuce Plants in Hydroponic Setup Using Convolutional Neural Networks (CNN). In Proceedings of the 2022 IEEE International Conference on Artificial Intelligence in Engineering and Technology (IICAIET), Kota Kinabalu, Malaysia, 13–15 September 2022; pp. 1–6. [Google Scholar] [CrossRef]
- Antolin, A.M.N.; Padilla, D.A.; Reyes, J.M.D. Tooth Condition Classification for Dental Charting Using Convolutional Neural Network and Image Processing. In Proceedings of the 2021 6th International Conference on Image, Vision and Computing (ICIVC), Qingdao, China, 23–25 July 2021; pp. 174–180. [Google Scholar] [CrossRef]
- Mhaski, R.R.; Chopade, P.B.; Dale, M.P. Determination of ripeness and grading of tomato using image analysis on Raspberry Pi. In Proceedings of the International Conference Communication, Control and Intelligent Systems, CCIS 2015, Mathura, India, 7–8 November 2015. [Google Scholar] [CrossRef]
- Yadav, H.; Bansal, P.; Kumarsunkaria, R. Color dependent K-means clustering for color image segmentation of colored medical images. In Proceedings of the 2015 1st International Conference on Next Generation Computing Technologies, NGCT 2015, Dehradun, India, 4–5 September 2015. [Google Scholar] [CrossRef]
- Dumaliang, D.M.; Rigor, J.M.Q.; Garcia, R.G.; Villaverde, J.F.; Cuñado, J.R. Coin Identification and Conversion System using Image Processing. 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; pp. 1–6. [Google Scholar] [CrossRef]
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. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).








