Statistical Machine Learning for Medicinal Plant Leaves Classification
Authors: Jayani P. Gamage, Thiyanga S. Talagala
Organizations: Centre for Crop and Disease Management (CCDM), Faculty of Science and Engineering, Curtin University, Bentley, WA, Australia · Department of Statistics, University of Sri Jayewardenepura, Nugegoda, Sri Lanka
Medicinal plants are usually identified using practitioners' experience, but reproducible, image based methods can complement this knowledge. We present MEDIPI (MEDIcinal Plant Identification), a statistical machine learning approach that classifies medicinal plant leaves from photographs. From each leaf image we extract 52 interpretable features covering shape, texture, color, and a new scagnostics category. We then classify leaves using a three level hierarchy: shape, then edge type, then species. We also release MedLEA, an open R package with 1,099 leaf images of 31 Sri Lankan medicinal plant species. On this dataset, a hierarchical Random Forest achieved the best overall accuracy (100%) in our comparison of hierarchical and non-hierarchical approaches and eight algorithms: Random Forest, XGBoost, Gradient Boosting, linear discriminant analysis, k-nearest neighbor, support vector machine, probabilistic neural network, and artificial neural network. Adding texture, color, and scagnostic features to shape features raised shape level accuracy from 90% to 97%. Linear discriminant analysis plots show how the trained model separates leaf shapes. Accuracy dropped sharply (23-50%) when training and test data came from different datasets, so generalization across datasets remains a challenge.
Figures & tables
Figure 1: Sri Lanka is in the top 15 for medicinal plant diversity among countries with published estimates. (a) Number of medicinal plant species and (b) percentage of medicinal plants relative to total flora in 15 countries; Sri Lanka is highlighted. Data: Schippmann et al. (2006) , Table 1.
Figure 2: Global trade in medicinal plants is growing, but Sri Lanka’s share is small. (a) Global export value of HS 1211 plants, 2016–2025 (2025 is provisional); (b) top 20 exporting economies of HS 1211 plants in 2024. Source: ITC Trade Map, https://www.trademap.org .
Figure 3: Workflow of the offline phase of the algorithm.
Figure 4: Methodology diagram.
Dataset
Image format
Total number of leaf images
Actual Leaf Image Dataset (MedLEA)
Color
1099
Flavia dataset
Color
1907
Swedish Leaf Image Dataset
Color
1125
Kaggle Leaf Image Dataset
Binary
1584
Table 1: Summary of datasets used in the algorithm.
Figure 5: Classification hierarchy.
Dataset
Image format
No. species
Images per species
No. leaf images
Remarks
Flavia
Color
32
50–77
1907
Scanners and digital cameras used to acquire leaf images on a plain background; isolated leaf images contain blades only, without petiole. Collected in China.
Swedish
Color
15
75
1125
Isolated leaf scans on a plain background. Collected in Sweden.
Kaggle
Binary
99
16
1584
Collected in the United Kingdom.
Table 2: Summary of secondary datasets.
Figure 6: Sample leaf images from the Flavia, Swedish, Kaggle, and MedLEA datasets.
Figure 7: Image collection process of medicinal plants in Sri Lanka.
Figure 8: Effect of flash and distance on binary conversion quality.
Figure 9: Image processing workflow.
Figure 10: Binary image before and after removing the stalk and closing holes.
Figure 11: Composition of the Ruhuna dataset sample by leaf arrangement.
Shape label
Smooth
Tooth
Lobed
Crenate
Row total (%)
Diamond
Count
167
27
22
1
217 (60.4)
Row %
77.0
12.4
10.1
0.5
Column %
66.0
44.3
55.0
20.0
Total %
46.5
7.5
6.1
0.3
Heart
Count
26
14
6
0
46 (12.8)
Row %
56.5
30.4
13.0
0.0
Table 3: Cross tabulation of shape and edge type in the Ruhuna dataset.
Figure 12: Common arrangements, shapes, and edge types.
Figure 13: General hierarchical structure types.
Figure 14: Proportion of training and test sets in Experiment 1 (a) and Experiment 2 (b).
Dataset
Algorithm
Diamond
Simple Round
Needle
Heart
Round
Overall
Actual
Random Forest
0.94
1.00
1.00
1.00
1.00
0.97
XGBoost
0.94
0.95
1.00
0.96
1.00
0.95
Gradient Boosting
0.96
0.96
1.00
1.00
1.00
0.97
Flavia
Random Forest
0.98
0.97
0.96
0.97
1.00
0.98
XGBoost
0.99
0.95
0.93
0.98
1.00
0.97
Gradient Boosting
0.98
0.96
1.00
1.00
1.00
0.98
Table 4: Shape-wise (H1) and overall classification accuracy, Experiment 1 – all feature categories (training and test sets from the same dataset).
Figure 15: Level 2 hierarchy (H2) of diamond-shaped leaves (left) and simple round-shaped leaves (right).
Diamond
Simple Round
Dataset / Algorithm
Smooth
Toothed
Crenate
Overall
Smooth
Toothed
Lobed
Crenate
Overall
Actual – Random Forest
1.00
1.00
0.40
0.97
0.94
1.00
1.00
1.00
0.97
Table 5: Edge-wise (H2) and overall classification accuracy, Experiment 1 (training and test sets from the Actual dataset).
Figure 16: Level 3 hierarchy (H3) of needle-shaped leaves (left) and heart-shaped leaves (right).
Needle
Heart Shape
Dataset / Algorithm
Belathana
Hathawariya
Iramusu
Overall
Bulath
Gammiris
Rasakida
Overall
Actual – Random Forest
1.00
1.00
1.00
1.00
1.00
1.00
1.00
1.00
Table 6: Species-wise (H3) and overall classification accuracy given shape (training and test sets from the Actual dataset).
Table 8: Shape-wise (H1) and overall classification accuracy, Experiment 1 – shape features only (training and test sets from the same datasets).
Train → Test
Algorithm
Diamond
Simple Round
Needle
Heart
Round
Overall
Flavia → Actual
Random Forest
0.70
0.28
0.23
0.04
0.10
0.41
XGBoost
0.65
0.28
0.56
0.03
0.29
0.43
Gradient Boosting
0.63
0.31
0.45
0.03
0.26
0.42
Swedish → Actual
Random Forest
0.38
0.22
0.06
0.12
0.39
0.26
XGBoost
0.40
0.23
0.18
0.04
0.23
0.25
Gradient Boosting
0.50
0.33
0.11
0.12
0.55
0.36
Table 9: Shape-wise (H1) and overall classification accuracy, Experiment 2 – all feature categories (training and test sets from different datasets).
Train → Test
Algorithm
Diamond
Simple Round
Needle
Heart
Round
Overall
Flavia → Actual
Random Forest
0.57
0.29
0.81
0.04
0.13
0.42
XGBoost
0.65
0.37
0.85
0.03
0.48
0.50
Gradient Boosting
0.55
0.36
0.95
0.05
0.58
0.49
Swedish → Actual
Random Forest
0.37
0.31
0.09
0.10
0.14
0.24
XGBoost
0.38
0.35
0.0
0.05
0.08
0.23
Gradient Boosting
0.53
0.27
0.03
0.08
0.39
0.31
Table 10: Shape-wise (H1) and overall classification accuracy, Experiment 2 – shape features only (training and test sets from different datasets).
Case
Algorithm
Overall
Macro avg.
Weighted avg.
Acc.
Rank
Acc.
Rank
Acc.
Rank
Hierarchical
Random Forest
1.00
1
0.99
1
1.00
1
XGBoost
0.99
2
0.99
1
0.99
2
Gradient Boosting
0.99
2
0.99
1
0.99
2
Non-hierarchical
Random Forest
0.99
2
0.99
1
0.99
2
XGBoost
0.98
5
0.98
5
0.98
5
Table 11: Comparison of overall classification accuracy, macro average accuracy, and weighted average accuracy, with ranks, hierarchical vs. non-hierarchical approaches.
Figure 18: Needle- and heart-shaped leaves separate cleanly on the first two LDA axes. Leaves of the Actual dataset plotted on LDA1 and LDA2: (a) actual shape labels, training set; (b) actual labels, training + test sets; (c) labels predicted by Random Forest, training set; (d) predicted labels, training + test sets.
Figure 19: On LDA1 and LDA3, only needle-shaped leaves are clearly separated. Leaves of the Actual dataset plotted on LDA1 and LDA3: (a) actual labels, training set; (b) actual labels, training + test sets; (c) predicted labels, training set; (d) predicted labels, training + test sets.
Figure 20: On LDA2 and LDA3, all shape labels overlap. Leaves of the Actual dataset plotted on LDA2 and LDA3: (a) actual labels, training set; (b) actual labels, training + test sets; (c) predicted labels, training set; (d) predicted labels, training + test sets.
Figure 21: Needle-shaped leaves separate in every view; the other shapes overlap. The three pairwise LDA views of the Actual dataset: (a) actual shape labels; (b) predicted shape labels.
Figure 22: Seven leaves are misclassified as diamond in every view. Actual labels, predicted labels, and misclassified observations of the Actual dataset on (a) LDA1 vs. LDA2, (b) LDA1 vs. LDA3, and (c) LDA2 vs. LDA3.
Figure 23: Random Forest is confident about every shape inside the training space. LDA1 vs. LDA2 colored by out of bag (OOB) probability for each shape label.
Figure 24: Each feature category separates the shape classes in a different way. LDA1 vs. LDA2 of the Actual dataset using only (a) shape, (b) texture, (c) color, or (d) scagnostic features.
Lower mean of blue, green, and red; higher standard deviation of red, green, and blue
–
Round
Higher: area convexity, compactness, correlation, perimeter, perimeter ratio diameter, perimeter ratio length and width. Lower: area ratio convexity, number of convex points, perimeter convexity, rectangularity
Higher correlation
Higher standard deviation of blue and green
Higher monotonic contour and monotonic polar
Simple round
–
Higher inverse difference moment and correlation
Higher standard deviation of blue and green
–
Diamond
–
–
–
–
Table 12: Features that help to identify each leaf shape (from Figure 24 ).
Figure 25: The Kaggle dataset lies apart from the other three datasets in LDA space. LDA1 vs. LDA2 of (a) the Actual, Flavia, and Swedish datasets using all feature categories, and (b, c) the Actual, Flavia, Swedish, and Kaggle datasets using shape features only.
Figure 26: Shape-related features are the most important for classifying leaf shape. Feature importance in shape-wise (H1) classification of the Actual dataset: (A) Random Forest, (B) XGBoost, (C) Gradient Boosting.
Figure 27: Feature importance in edge-wise (H2) classification of the Actual dataset: (A) diamond shaped leaves, (B) simple round shaped leaves.
Figure 28: Scagnostic features matter most for classifying species within diamond and simple round shaped leaves. Feature importance in species-wise (H3) classification of the Actual dataset: heart shaped leaves (top left), needle shaped leaves (top right), smooth edged diamond-shaped leaves (bottom left), and simple round shaped leaves (bottom right).
Deep learning models for crop leaf disease recognition routinely report near-perfect accuracy yet are typically trained and evaluated on a single dataset collected under controlled laboratory conditions, leaving their behavior under realistic cross-region domain shift poorly understood. We introduce MLD (Multi-crop Leaf Disease) dataset, a unified multi-region benchmark that combines six public crop-disease datasets from the USA, Asia, and Africa into a shared hierarchical taxonomy spanning 18 crops, 56 crop-disease classes (including one healthy class per crop) making 167,427 images. We define standardized single-source and pooled multi-source evaluation protocols that explicitly probe cross-region generalization. We also investigate whether exploiting the inherent crop-to-disease dependency via a hierarchical formulation (HiLeaD) that conditions disease prediction on the predicted crop improves recognition under cross-region shift. Under the HiLeaD, the model trained on PlantVillage achieves 99.07% in-domain disease F1 but collapses to 12.88% when tested on PlantDoc, exposing a severe cross-region domain gap. The model trained on the pooled MLD dataset partly recovers cross-region disease F1 from 12.88% to 39.64% on PlantDoc (HiLeaD), achieving a 26.76 percentage point improvement. The hierarchical formulation provides a consistent additional gain, ranging from 1.71 to 4.88 percentage points in disease F1 over the flat baseline under the MLD dataset indicating that progress in this area is currently limited more by data coverage and diversity than by model design.
Rosemary Nalwanga, Sebastian Bunda, Godliver Owomugisha +2
Data Management and Biometrics University of Twente Enschede, Netherlands · Department of Computer Engineering Busitema University Tororo, Uganda
Rising global food demand and growing climate pressure increase the need for sustainable, precise agricultural practices. Automated, individualized plant treatment relies on fine-grained visual analysis, yet leaf-level segmentation remains underexplored despite its value for assessing crop health, growth dynamics, yield potential and localized stress symptoms. Progress is limited by a lack of dedicated datasets, especially regarding species coverage, and by the absence of systematic evaluations of modern instance-segmentation architectures for this task. We address these gaps by surveying current data and identifying four suitable, publicly available leaf-segmentation datasets. Using them, we compare one-stage, two-stage and Transformer-based detectors and identify a YOLO26 model configuration to provide the best trade-off for real-world precision-agriculture tasks. Extensive cross-domain generalization experiments reveal substantial performance drops across plant species and recording setups, especially for models trained solely on laboratory data. To strengthen data availability, we introduce a new benchmark dataset with leaf-level masks for 23 plant species, created via semi-automatic annotation of selected CropAndWeed images. A model trained on all four existing datasets achieves a mean mAP50-95 of 83.9% across their corresponding test sets and 40.2% on our new benchmark, demonstrating improved generalization and highlighting the need for diverse leaf-segmentation datasets in robust precision agriculture.
Robert Martinko, Daniel Steininger, Julia Simon +2
1AIT Austrian Institute of Technology, Center for Vision, Automation & Control · University of Applied Sciences Technikum Wien, Computer Science & Applied Mathematics
Early detection of plant diseases is crucial to plants and for the farmers. Plant diseases reduce fruit yield and quality, and plants are more susceptible to other stresses when they are infected. The lemon leaf disease dataset contains 1354 images. The dataset has 9 classes. Among the 9 classes only one class is for healthy leaf, and the other 8 classes are leaf diseases. The dataset was split into training (70%), testing (15%) and validation (15%) sets after comprehensive preprocessing. Two pretrained models (InceptionV3 and MobileNetV2) were applied and then combined these models using an ensemble technique to boost robustness. Ensemble models showed a promising performance of 99.27% accuracy. Adversarial Training is applied to improve models' ability and ensure reliable predictions under noisy data. Grad-CAM visualization highlights the important regions of leaf images that validate the model prediction with confidence level.
Shayan Abrar, Sudeepta Mandal, Abdul Awal Yasir +4
Dept. of CSE American International University-Bangladesh Dhaka, Bangladesh · Dept. of CSE East West University Dhaka, Bangladesh · Dept. of CSE North South University Dhaka, Bangladesh