Image Classification
Keras
English
agriscan
agriculture
plant-disease
crop-classification
efficientnet
efficientnetb0
tensorflow
plantvillage
Instructions to use Vernard/AgriScan_EfficientNetB0_Two_Classifier_Training with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use Vernard/AgriScan_EfficientNetB0_Two_Classifier_Training with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://Vernard/AgriScan_EfficientNetB0_Two_Classifier_Training") - Notebooks
- Google Colab
- Kaggle
Upload README_AgriScan_EfficientNetB0_HuggingFace.md
Browse files
README_AgriScan_EfficientNetB0_HuggingFace.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: other
|
| 5 |
+
library_name: keras
|
| 6 |
+
pipeline_tag: image-classification
|
| 7 |
+
tags:
|
| 8 |
+
- agriscan
|
| 9 |
+
- agriculture
|
| 10 |
+
- plant-disease
|
| 11 |
+
- crop-classification
|
| 12 |
+
- image-classification
|
| 13 |
+
- efficientnet
|
| 14 |
+
- efficientnetb0
|
| 15 |
+
- tensorflow
|
| 16 |
+
- keras
|
| 17 |
+
- plantvillage
|
| 18 |
+
datasets:
|
| 19 |
+
- mohanty/PlantVillage
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# AgriScan EfficientNetB0 β Crop and Plant Disease Classifiers
|
| 23 |
+
|
| 24 |
+
AgriScan is an agricultural intelligence project developing computer-vision tools to support crop identification and plant-health screening.
|
| 25 |
+
|
| 26 |
+
This repository is intended to contain two separately trained EfficientNetB0 models:
|
| 27 |
+
|
| 28 |
+
1. **Crop classifier** β predicts whether an image belongs to maize, potato, or tomato.
|
| 29 |
+
2. **Disease classifier** β predicts one of 17 crop-condition classes across those crops.
|
| 30 |
+
|
| 31 |
+
> **Status:** Research and pilot prototype. Add measured evaluation results after the training notebook has completed successfully.
|
| 32 |
+
|
| 33 |
+
## Repository contents
|
| 34 |
+
|
| 35 |
+
Expected files:
|
| 36 |
+
|
| 37 |
+
```text
|
| 38 |
+
.
|
| 39 |
+
βββ README.md
|
| 40 |
+
βββ agriscan_efficientnet_crop.keras
|
| 41 |
+
βββ agriscan_efficientnet_disease.keras
|
| 42 |
+
βββ crop_names.json
|
| 43 |
+
βββ class_names.json
|
| 44 |
+
βββ evaluation_metrics.json
|
| 45 |
+
βββ crop_classification_report.csv
|
| 46 |
+
βββ disease_classification_report.csv
|
| 47 |
+
βββ crop_confusion_matrix.csv
|
| 48 |
+
βββ disease_confusion_matrix.csv
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
Upload only the files that have actually been generated. Evaluation reports and metrics should be added after the training and evaluation cells finish.
|
| 52 |
+
|
| 53 |
+
## Model details
|
| 54 |
+
|
| 55 |
+
| Property | Crop classifier | Disease classifier |
|
| 56 |
+
|---|---|---|
|
| 57 |
+
| Architecture | EfficientNetB0 | EfficientNetB0 |
|
| 58 |
+
| Task | Crop classification | Crop-condition classification |
|
| 59 |
+
| Number of output classes | 3 | 17 |
|
| 60 |
+
| Input | RGB image | RGB image |
|
| 61 |
+
| Input size | 224 Γ 224 pixels | 224 Γ 224 pixels |
|
| 62 |
+
| Model format | Keras `.keras` | Keras `.keras` |
|
| 63 |
+
|
| 64 |
+
The training workflow uses transfer learning with an ImageNet-pretrained EfficientNetB0 backbone, first training the classification head and then fine-tuning upper backbone layers.
|
| 65 |
+
|
| 66 |
+
### Crop classes
|
| 67 |
+
|
| 68 |
+
- Maize
|
| 69 |
+
- Potato
|
| 70 |
+
- Tomato
|
| 71 |
+
|
| 72 |
+
### Disease classes
|
| 73 |
+
|
| 74 |
+
The 17 output labels are defined in `class_names.json`. **The JSON order is significant** because it maps each output index to its label. Use the exact file produced by the training notebook; do not manually reorder the labels.
|
| 75 |
+
|
| 76 |
+
## Dataset and evaluation
|
| 77 |
+
|
| 78 |
+
The training workflow uses the `mohanty/PlantVillage` dataset and its `splits/color_train.txt` and `splits/color_test.txt` manifests, filtered to maize, potato, and tomato classes.
|
| 79 |
+
|
| 80 |
+
The training partition is divided into training and validation subsets. The source test partition is reserved for final evaluation.
|
| 81 |
+
|
| 82 |
+
No performance metrics are stated here because the EfficientNetB0 training run must complete before results can be reported. After evaluation, update this section using the generated `evaluation_metrics.json` and classification reports. Report the test-set size and metrics exactly as measured; do not use training or validation scores as test scores.
|
| 83 |
+
|
| 84 |
+
## Input preprocessing
|
| 85 |
+
|
| 86 |
+
- Convert the image to RGB.
|
| 87 |
+
- Resize to 224 Γ 224 pixels.
|
| 88 |
+
- Supply pixel values in the range expected by the saved model.
|
| 89 |
+
- The Keras EfficientNetB0 backbone includes input rescaling. Do not apply MobileNetV2-specific `Rescaling(1/127.5, offset=-1)` preprocessing unless the model architecture is deliberately changed and retrained.
|
| 90 |
+
|
| 91 |
+
Use the model's actual training/inference pipeline when deploying it.
|
| 92 |
+
|
| 93 |
+
## Recommended inference flow
|
| 94 |
+
|
| 95 |
+
1. Run the crop classifier.
|
| 96 |
+
2. Run the disease classifier.
|
| 97 |
+
3. Read the predicted labels using `crop_names.json` and `class_names.json`.
|
| 98 |
+
4. Compare the crop predicted by the crop classifier with the crop implied by the disease-class label.
|
| 99 |
+
5. If the two classifiers disagree, or confidence is low, return an uncertain/review result instead of presenting a definitive diagnosis.
|
| 100 |
+
|
| 101 |
+
The two classifiers are independent models. A downstream application must implement the routing, confidence policy, and disagreement handling.
|
| 102 |
+
|
| 103 |
+
## Intended use
|
| 104 |
+
|
| 105 |
+
This model is intended for research, prototyping, and controlled pilot evaluation of crop classification and plant-disease image classification for maize, potato, and tomato.
|
| 106 |
+
|
| 107 |
+
## Limitations and responsible use
|
| 108 |
+
|
| 109 |
+
- This is a closed-set classifier. It is not a general plant detector and may assign an unsupported label to non-plant images.
|
| 110 |
+
- It predicts only among the classes represented in the training labels; unknown diseases and other crops are not supported.
|
| 111 |
+
- PlantVillage images may differ from farmer field photographs in lighting, backgrounds, camera quality, geography, crop varieties, and disease severity.
|
| 112 |
+
- A high softmax score is not a guarantee of correctness and should not be treated as calibrated probability without further calibration work.
|
| 113 |
+
- Predictions are not a substitute for expert agricultural advice or laboratory diagnosis.
|
| 114 |
+
- Validate on representative real-world field images before operational deployment.
|
| 115 |
+
|
| 116 |
+
## Citation and attribution
|
| 117 |
+
|
| 118 |
+
The dataset used by the training workflow is available as [`mohanty/PlantVillage`](https://huggingface.co/datasets/mohanty/PlantVillage). Review the dataset card and its terms before redistributing derived assets.
|
| 119 |
+
|
| 120 |
+
## Contact and project
|
| 121 |
+
|
| 122 |
+
Project: **AgriScan**, an agricultural intelligence initiative associated with CDSA.
|
| 123 |
+
|
| 124 |
+
For deployment, document the model version, training date, dataset version, evaluation results, and any changes to preprocessing or class mappings.
|