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