Medicinal Leaf Classification: What 100% Accuracy Really Covers
The 100% figure holds only for controlled, self-collected images; the reusable contribution is the 52 interpretable features and the three-level hierarchy, not the perfect score.
On this page
You have 1,099 leaf photographs spanning 31 Sri Lankan medicinal species, but should your team ship the 100% accurate classifier to field collectors next month? Most people assume a headline accuracy number settles that question. It does not. The paper behind this model reports a hierarchical Random Forest at 100% overall accuracy on the authors' own MedLEA dataset, compared against seven other algorithms and against a non-hierarchical setup. The same abstract also reports that accuracy drops 23–50% when training and test images come from different datasets. Same photographs, different source, and the score collapses. That gap is the decision you actually face: not whether the model can separate leaves it has already seen, but whether it holds up on leaves your collectors bring back from a backyard in Anuradhapura [1].
What MEDIPI Does: Clean the Image, Extract 52 Features, Decide in Three Levels
MEDIPI stands for MEDIcinal Plant Identification and runs in two phases. The offline phase trains a model on labelled leaf photographs; the online phase hands that trained model to ordinary users, who take one photo and get an answer. In between sits a fixed seven-step image pipeline: convert BGR to RGB, grayscale, Gaussian smoothing, binary thresholding, remove the stalk, close holes, and resize. Stalk removal applies only to leaves that have one, hole closing only to damaged leaves, and the Kaggle set is already binary, so only resizing applies there [1].
From each processed image the authors extract 52 features in four families: shape, texture, colour, and scagnostics. Scagnostics is a set of statistics describing the shape of a two-dimensional point cloud, normally used to explore relationships between two variables; here it is applied to the leaf contour in Cartesian and polar coordinates. The paper adds further geometric quantities, including the correlation of the Cartesian contour, the x and y coordinates of the contour, counts of local minima and maxima, and the number of convex points. The stated reason for avoiding convolutional networks is that pre-computed features are interpretable, generalise well, and cost little compute.
Classification runs through three levels. Level one looks only at shape and sorts leaves into diamond, simple round, round, needle, or heart. Level two looks at the margin and sorts into smooth, toothed, lobed, or crenate. Level three assigns the species. The authors' justification is concrete: skipping straight to 31 species would create too many labels and severe class imbalance. The hierarchy labels were not invented; they came from the Ayurvedic Medicinal Plants of Sri Lanka repository maintained by Barberyn Ayurveda Resort and the University of Ruhuna, where the authors examined 471 leaves described by 22 variables, 18 of which record appearance such as arrangement, shape, margin, apex, and base.
Where the Data Comes From: 1,099 Self-Collected Images Plus Three Public Sets
The primary dataset, MedLEA, was collected by the authors: 1,099 colour leaf photographs covering 31 Sri Lankan medicinal species, with 29 to 45 images per species. It ships as an open R package on CRAN, so anyone can download and reproduce the work. The capture protocol is described in unusual detail: pick a fresh leaf in the morning with scissors and no petiole, clean off water bubbles and soil with a small brush or tissue, press curled leaves for roughly one to two days, centre the leaf on white paper, avoid flash, and shoot the closest view with a Huawei Nova 3i. Centring keeps the binary conversion accurate; no flash avoids shadows that would corrupt the contour.
| Dataset | Image format | Species | Leaf images |
|---|---|---|---|
| MedLEA (primary) | Colour | 31 | 1,099 |
| Flavia | Colour | 32 | 1,907 |
| Swedish | Colour | 15 | 1,125 |
| Kaggle | Binary | 99 | 1,584 |
The other three are public secondary sets. Flavia has 1,907 colour images across 32 species, collected in China with scanners and digital cameras on plain backgrounds and containing blades only, no petioles. Swedish has 1,125 scans across 15 species collected in Sweden. Kaggle has 1,584 binary images across 99 species collected in the United Kingdom. Each dataset is split 80% training and 20% test on its own, with no mixing between sets [1].
Eight Algorithms Compared, and the Hierarchical Random Forest Wins at 100%
- Random Forest, an ensemble of decision trees that vote on the label
- XGBoost
- Gradient Boosting
- Linear discriminant analysis (LDA)
- k-nearest neighbour (kNN)
- Support vector machine (SVM)
- Probabilistic neural network (PNN)
- Artificial neural network (ANN)
The authors ran both hierarchical and non-hierarchical routes across these eight algorithms. The hierarchical Random Forest came out best overall at 100% accuracy, which is the headline number of the paper. Two caveats matter for a buyer. First, that 100% is measured on MedLEA's own train and test split, not across datasets. Second, the excerpt does not report per-algorithm accuracy for the other seven methods, only that the hierarchical Random Forest was best. So the honest reading of 100% is: on this controlled, self-collected data, this feature set plus this hierarchy is fully separable. It is not a claim that the method never misidentifies a medicinal plant.
Shape Alone Reaches 90%; Texture, Colour and Scagnostics Lift It to 97%
The authors ran an ablation-style comparison. With shape features only, accuracy at the first (shape) level is 90%. Adding texture, colour, and scagnostic features raises shape-level accuracy to 97%. That result deserves its own heading, because a large body of earlier leaf-identification work concentrated on shape, and these numbers say shape alone is not enough.
The paper also uses linear discriminant analysis (LDA, a method that projects high-dimensional features into a low-dimensional space where classes separate as much as possible) to plot how the trained model divides leaf shapes on a plane. For a buyer, such plots are often more informative than a single score, because they show which directions the model is actually using.
The paper further reports the joint distribution of shape and margin in the Ruhuna repository, restricted to 359 simple leaves, meaning a single blade never divided into leaflets:
| Shape | smooth | toothed | lobed | crenate | Row total (share) |
|---|---|---|---|---|---|
| diamond | 167 | 27 | 22 | 1 | 217 (60.4%) |
| heart | 26 | 14 | 6 | 0 | 46 (12.8%) |
| needle | 21 | 0 | 0 | 0 | 21 (5.8%) |
| round | 5 | 3 | 1 | 1 | 10 (2.8%) |
| simple round | 31 | 14 | 11 | 3 | 59 (16.4%) |
| scale-like | 3 | 3 | 0 | 0 | 6 (1.7%) |
| Column total | 253 (70.5%) | 61 (17.0%) | 40 (11.1%) | 5 (1.4%) | 359 |
The table explains two things. First, diamond alone accounts for 60.4% of the sample, which is exactly why the authors built a hierarchy instead of classifying species directly. Second, all 21 needle-shaped leaves have smooth margins, and no heart-shaped leaf has a crenate margin; some shape-and-margin combinations simply do not exist in the data, so the model never gets to learn them.
Switch the Dataset and Accuracy Drops by 23% to 50%
The single most important sentence in the abstract is that accuracy dropped sharply, by 23% to 50%, when training and test data came from different datasets. A model trained on MedLEA and tested on Flavia or Swedish images no longer scores 100%; it lands around half or worse.
The causes are not hard to trace. MedLEA uses a phone, white paper, daylight, and no flash. Flavia uses scanners and digital cameras and contains blades only. Swedish uses scans. Kaggle is binary, so colour and texture features cannot even be computed and the feature matrix is structurally incomplete. What the model learned may include background brightness, edge sharpness, and compression artefacts as much as leaf geometry.
This is not unique to this paper, but it is the first question anyone procuring a leaf-identification system should ask: how far is your deployment setting from the capture conditions of the training data?
Where This Method Stops Being the Right Tool
- Species coverage: 31 common Sri Lankan medicinal plants. Sri Lanka is estimated to hold about 550 medicinal species, with some surveys reporting as many as 1,432, so 31 is a small slice.
- Leaf coverage: simple leaves only, meaning a single blade never divided into leaflets; compound leaves are excluded because the analysis is restricted to simple arrangement.
- Capture conditions: white background, centred leaf, daylight, no flash. Casual field photos are not in the training distribution.
- Cross-dataset behaviour: the paper itself reports a 23–50% drop, so the domain shift is unresolved.
- Label provenance: the three-level labels depend on an expert repository last updated on 11 May 2017, not on a field survey.
