Keras
Joblib
crop-disease-detection
deep-learning
tensorflow
densenet201
agriculture
computer-vision
Instructions to use MrFixy/Crop with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use MrFixy/Crop 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://MrFixy/Crop") - Notebooks
- Google Colab
- Kaggle
Upload README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,122 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- crop-disease-detection
|
| 5 |
+
- deep-learning
|
| 6 |
+
- tensorflow
|
| 7 |
+
- keras
|
| 8 |
+
- densenet201
|
| 9 |
+
- agriculture
|
| 10 |
+
- computer-vision
|
| 11 |
---
|
| 12 |
+
|
| 13 |
+
# Crop Disease Detection Using Deep Learning
|
| 14 |
+
|
| 15 |
+
A deep learning-based crop disease classification project using DenseNet201 to identify diseases across three major crops: Corn, Rice, and Wheat.
|
| 16 |
+
|
| 17 |
+
The project explores transfer learning, model fine-tuning, data augmentation, and class weighting to improve classification performance.
|
| 18 |
+
|
| 19 |
+
## Project Overview
|
| 20 |
+
|
| 21 |
+
This project classifies leaf images into 12 categories covering healthy and diseased conditions across three crops.
|
| 22 |
+
|
| 23 |
+
- **Architecture:** DenseNet201
|
| 24 |
+
- **Framework:** TensorFlow / Keras
|
| 25 |
+
- **Task:** Multi-class image classification
|
| 26 |
+
- **Number of classes:** 12
|
| 27 |
+
- **Crops:** Corn, Rice, and Wheat
|
| 28 |
+
|
| 29 |
+
## Model Performance
|
| 30 |
+
|
| 31 |
+
The improved model was evaluated against the original DenseNet201 + Linear SVM approach.
|
| 32 |
+
|
| 33 |
+
| Evaluation Metric | Original Model | Improved Model |
|
| 34 |
+
|---|---:|---:|
|
| 35 |
+
| Accuracy | 81.16% | **86.60%** |
|
| 36 |
+
| Balanced Accuracy | 78.24% | **81.66%** |
|
| 37 |
+
| Macro Precision | 78.32% | **83.23%** |
|
| 38 |
+
| Macro Recall | 78.24% | **81.66%** |
|
| 39 |
+
| Macro F1-score | 78.18% | **82.30%** |
|
| 40 |
+
| Weighted F1-score | 81.18% | **86.43%** |
|
| 41 |
+
|
| 42 |
+
The improved model achieved a 5.44 percentage-point increase in accuracy compared with the original model.
|
| 43 |
+
|
| 44 |
+
## Supported Classes
|
| 45 |
+
|
| 46 |
+
### Corn
|
| 47 |
+
- Corn Grey Spot
|
| 48 |
+
- Corn Northern Blight
|
| 49 |
+
- Corn Rust
|
| 50 |
+
- Healthy Corn
|
| 51 |
+
|
| 52 |
+
### Rice
|
| 53 |
+
- Rice Brown Spot
|
| 54 |
+
- Rice Hispa
|
| 55 |
+
- Rice Leaf Blast
|
| 56 |
+
- Healthy Rice
|
| 57 |
+
|
| 58 |
+
### Wheat
|
| 59 |
+
- Wheat Leaf Rust
|
| 60 |
+
- Wheat Stem Rust
|
| 61 |
+
- Wheat Stripe Rust
|
| 62 |
+
- Healthy Wheat
|
| 63 |
+
|
| 64 |
+
## Model Files
|
| 65 |
+
|
| 66 |
+
| File | Description |
|
| 67 |
+
|---|---|
|
| 68 |
+
| `selected_improved_densenet201.keras` | Selected improved DenseNet201 model |
|
| 69 |
+
| `original_densenet201_linear_svm.joblib` | Original DenseNet201 + Linear SVM model |
|
| 70 |
+
|
| 71 |
+
## Evaluation Materials
|
| 72 |
+
|
| 73 |
+
The repository may include the following evaluation materials:
|
| 74 |
+
|
| 75 |
+
- Confusion matrices for validation and test sets
|
| 76 |
+
- Per-class F1-score comparison
|
| 77 |
+
- Original versus improved model comparison
|
| 78 |
+
- Crop-level performance comparison
|
| 79 |
+
- Dataset class distribution
|
| 80 |
+
- Representative images from each class
|
| 81 |
+
|
| 82 |
+
## Installation
|
| 83 |
+
|
| 84 |
+
Install the required dependencies:
|
| 85 |
+
|
| 86 |
+
```bash
|
| 87 |
+
pip install tensorflow numpy pandas scikit-learn pillow
|
| 88 |
+
```
|
| 89 |
+
|
| 90 |
+
## Loading the Model
|
| 91 |
+
|
| 92 |
+
```python
|
| 93 |
+
import tensorflow as tf
|
| 94 |
+
|
| 95 |
+
model = tf.keras.models.load_model(
|
| 96 |
+
"selected_improved_densenet201.keras"
|
| 97 |
+
)
|
| 98 |
+
|
| 99 |
+
model.summary()
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
**Important:** Input image dimensions, normalization, and preprocessing must match the configuration used during training. The exact preprocessing configuration should be taken from the training pipeline.
|
| 103 |
+
|
| 104 |
+
## Project Goals
|
| 105 |
+
|
| 106 |
+
- Develop an automated crop disease classification system.
|
| 107 |
+
- Compare the original and improved model approaches.
|
| 108 |
+
- Investigate the impact of fine-tuning and other training strategies.
|
| 109 |
+
- Evaluate performance across multiple crop types and disease categories.
|
| 110 |
+
|
| 111 |
+
## Limitations
|
| 112 |
+
|
| 113 |
+
- Predictions depend on image quality and similarity to the training data.
|
| 114 |
+
- Classification results should not be treated as definitive agricultural diagnoses.
|
| 115 |
+
- Performance on images from different environments requires further evaluation.
|
| 116 |
+
|
| 117 |
+
## Author
|
| 118 |
+
|
| 119 |
+
**MrFixy**
|
| 120 |
+
|
| 121 |
+
- GitHub: https://github.com/MrFixy
|
| 122 |
+
- Hugging Face: https://huggingface.co/MrFixy
|