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
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:
pip install tensorflow numpy pandas scikit-learn pillow
Loading the Model
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
- Downloads last month
- 29