Instructions to use Tushansh/ayush-medicinal-plant-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use Tushansh/ayush-medicinal-plant-classifier with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://Tushansh/ayush-medicinal-plant-classifier") - Notebooks
- Google Colab
- Kaggle
Upload folder using huggingface_hub
Browse files- .gitattributes +2 -35
- README.md +106 -0
- config.json +52 -0
- model.keras +3 -0
.gitattributes
CHANGED
|
@@ -1,35 +1,2 @@
|
|
| 1 |
-
*.
|
| 2 |
-
*.
|
| 3 |
-
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
-
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
-
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
-
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
-
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
-
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
-
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
-
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
-
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
-
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
-
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
-
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
-
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
-
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
-
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 1 |
+
*.keras filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- image-classification
|
| 4 |
+
- medicinal-plants
|
| 5 |
+
- ayurveda
|
| 6 |
+
- keras
|
| 7 |
+
- xception
|
| 8 |
+
library_name: keras
|
| 9 |
+
license: apache-2.0
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# AYUSH Medicinal Plant Classifier
|
| 13 |
+
|
| 14 |
+
🌿 A deep learning model for classifying 7 Indian medicinal plants based on leaf images.
|
| 15 |
+
|
| 16 |
+
## Model Description
|
| 17 |
+
|
| 18 |
+
This model uses transfer learning with Xception architecture to identify medicinal plants commonly used in AYUSH (Ayurveda, Yoga & Naturopathy, Unani, Siddha, and Homeopathy) medicine.
|
| 19 |
+
|
| 20 |
+
## Classes
|
| 21 |
+
|
| 22 |
+
The model can identify the following 7 medicinal plants:
|
| 23 |
+
|
| 24 |
+
1. **Aloevera** (Aloe barbadensis) - Ghritkumari
|
| 25 |
+
2. **Amla** (Phyllanthus emblica) - Indian Gooseberry
|
| 26 |
+
3. **Bhrami** (Bacopa monnieri) - Water Hyssop
|
| 27 |
+
4. **Ginger** (Zingiber officinale) - Adrak
|
| 28 |
+
5. **Neem** (Azadirachta indica) - Nimba
|
| 29 |
+
6. **Tulsi** (Ocimum sanctum) - Holy Basil
|
| 30 |
+
7. **Turmeric** (Curcuma longa) - Haldi
|
| 31 |
+
|
| 32 |
+
## Model Details
|
| 33 |
+
|
| 34 |
+
- **Base Architecture:** Xception (pre-trained on ImageNet)
|
| 35 |
+
- **Input Size:** 299x299x3 RGB images
|
| 36 |
+
- **Framework:** TensorFlow/Keras
|
| 37 |
+
- **Training Accuracy:** 97.56%
|
| 38 |
+
- **Validation Accuracy:** 100%
|
| 39 |
+
- **Test Accuracy:** 98.44%
|
| 40 |
+
- **Dataset:** Indian Medicinal Leaves Image Dataset (719 images)
|
| 41 |
+
|
| 42 |
+
## Usage
|
| 43 |
+
|
| 44 |
+
### Using Hugging Face Inference API
|
| 45 |
+
|
| 46 |
+
import requests
|
| 47 |
+
from PIL import Image
|
| 48 |
+
import io
|
| 49 |
+
|
| 50 |
+
API_URL = "https://api-inference.huggingface.co/models/Tushansh/ayush-medicinal-plant-classifier
|
| 51 |
+
headers = {{"Authorization": "Bearer YOUR_HF_TOKEN"}}
|
| 52 |
+
|
| 53 |
+
def query(image_bytes):
|
| 54 |
+
response = requests.post(API_URL, headers=headers, data=image_bytes)
|
| 55 |
+
return response.json()
|
| 56 |
+
Load your image
|
| 57 |
+
with open("plant_leaf.jpg", "rb") as f:
|
| 58 |
+
data = f.read()
|
| 59 |
+
|
| 60 |
+
Get prediction
|
| 61 |
+
output = query(data)
|
| 62 |
+
print(output)
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
### Using Python with transformers
|
| 66 |
+
|
| 67 |
+
from huggingface_hub import from_pretrained_keras
|
| 68 |
+
|
| 69 |
+
model = from_pretrained_keras( + REPO_ID + )
|
| 70 |
+
|
| 71 |
+
Process image and make predictions
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
## Training Details
|
| 75 |
+
|
| 76 |
+
- **Optimizer:** Adam
|
| 77 |
+
- **Loss:** Categorical Crossentropy
|
| 78 |
+
- **Callbacks:** EarlyStopping, ReduceLROnPlateau
|
| 79 |
+
- **Data Augmentation:** Rotation, Zoom, Flip, Brightness adjustment
|
| 80 |
+
|
| 81 |
+
## Limitations
|
| 82 |
+
|
| 83 |
+
- Model is specifically trained for these 7 Indian medicinal plants
|
| 84 |
+
- Best results with clear, well-lit leaf images
|
| 85 |
+
- May not generalize to other plant species
|
| 86 |
+
|
| 87 |
+
## Ethical Considerations
|
| 88 |
+
|
| 89 |
+
This model is intended for educational and research purposes. Plant identification should be verified by botanical experts before use in medical applications.
|
| 90 |
+
|
| 91 |
+
## Citation
|
| 92 |
+
|
| 93 |
+
@misc{{ayush-plant-classifier,
|
| 94 |
+
author = {{Your Name}},
|
| 95 |
+
title = {{AYUSH Medicinal Plant Classifier}},
|
| 96 |
+
year = {{2025}},
|
| 97 |
+
publisher = {{Hugging Face}}
|
| 98 |
+
}}
|
| 99 |
+
|
| 100 |
+
## License
|
| 101 |
+
|
| 102 |
+
Apache 2.0
|
| 103 |
+
|
| 104 |
+
## Contact
|
| 105 |
+
|
| 106 |
+
For questions or feedback, please open an issue in the repository.
|
config.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_type": "image-classification",
|
| 3 |
+
"task": "image-classification",
|
| 4 |
+
"framework": "keras",
|
| 5 |
+
"architectures": [
|
| 6 |
+
"Xception"
|
| 7 |
+
],
|
| 8 |
+
"num_classes": 7,
|
| 9 |
+
"image_size": 299,
|
| 10 |
+
"labels": [
|
| 11 |
+
"Aloevera",
|
| 12 |
+
"Amla",
|
| 13 |
+
"Bhrami",
|
| 14 |
+
"Ginger",
|
| 15 |
+
"Neem",
|
| 16 |
+
"Tulsi",
|
| 17 |
+
"Turmeric"
|
| 18 |
+
],
|
| 19 |
+
"id2label": {
|
| 20 |
+
"0": "Aloevera",
|
| 21 |
+
"1": "Amla",
|
| 22 |
+
"2": "Bhrami",
|
| 23 |
+
"3": "Ginger",
|
| 24 |
+
"4": "Neem",
|
| 25 |
+
"5": "Tulsi",
|
| 26 |
+
"6": "Turmeric"
|
| 27 |
+
},
|
| 28 |
+
"label2id": {
|
| 29 |
+
"Aloevera": 0,
|
| 30 |
+
"Amla": 1,
|
| 31 |
+
"Bhrami": 2,
|
| 32 |
+
"Ginger": 3,
|
| 33 |
+
"Neem": 4,
|
| 34 |
+
"Tulsi": 5,
|
| 35 |
+
"Turmeric": 6
|
| 36 |
+
},
|
| 37 |
+
"preprocessing": {
|
| 38 |
+
"image_mean": [
|
| 39 |
+
0.5,
|
| 40 |
+
0.5,
|
| 41 |
+
0.5
|
| 42 |
+
],
|
| 43 |
+
"image_std": [
|
| 44 |
+
0.5,
|
| 45 |
+
0.5,
|
| 46 |
+
0.5
|
| 47 |
+
],
|
| 48 |
+
"size": 299,
|
| 49 |
+
"do_resize": true,
|
| 50 |
+
"do_normalize": true
|
| 51 |
+
}
|
| 52 |
+
}
|
model.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f0e8c2bffdf4a4653c394d3bce1bebce2581de422f6e18ff515d7c8474c2bc90
|
| 3 |
+
size 87106667
|