Overview
PlantVision is an innovative deep learning solution that leverages computer vision to help farmers and agricultural specialists identify plant diseases quickly and accurately. Built on a Convolutional Neural Network architecture, this model analyzes images of plant leaves to detect and classify diseases, providing early warning and treatment recommendations to prevent crop loss.
Technical Documentation
Architecture
The system consists of three main components:
- CNN-based Image Classification Model: Built with TensorFlow and PyTorch, using an EfficientNet-B2 backbone pre-trained on ImageNet.
- Mobile Application: Developed using Flutter for cross-platform deployment.
- Backend API: A Flask-based API to handle image processing, model inference, and deliver results.
The CNN Model
The core of the project is the deep learning model. We chose EfficientNet due to its excellent balance of accuracy and computational efficiency, making it suitable for potential mobile deployment. This is a key architectural decision.
Data Preprocessing
Data augmentation was critical. Techniques included random rotations, flips, and brightness adjustments to simulate real-world conditions.
Model Performance
Below is a summary of the model's performance on the hold-out test set.
Metric | Score | Notes |
---|---|---|
Accuracy | 98.7% | Overall correctness |
Precision | 97.2% | Of positive predictions, how many are correct |
Recall | 96.5% | Of actual positives, how many were found |
F1-Score | 96.8% | Harmonic mean of Precision and Recall |
Note: These metrics represent the weighted average across all disease classes, accounting for class imbalance.
Mathematical Formulation
The loss function used is the cross-entropy loss, defined as:
Where is the number of classes, is the true label (one-hot encoded), and is the predicted probability for class .
Performance Metrics
Accuracy
98.7%
Precision
97.2%
Recall
96.5%
F1 Score
96.8%
Top 1% Acc
99.1%
Top 5% Acc
99.8%
Project Structure
Project Root
plantvision/
├── data/ # ⛔ Not included in Git. Use DVC or git-lfs
├── src/ # ✅ Source code
│ ├── configs/ # 📄 YAML configs (no hardcoded values)
│ ├── data/ # 📦 Data loading, augmentations
│ ├── models/ # 🧠 Model definitions: CNNs, EfficientNet
│ ├── train.py # 🚂 Launch training with config + MLflow
│ ├── evaluate.py # 📊 Validation + metrics
│ ├── quantize.py # 🔧 Convert to ONNX/TFLite/INT8
│ ├── serve/ # 🌐 FastAPI or TorchServe entrypoint
│ └── utils.py # 🛠 Logging, reproducibility, etc.
├── docker/ # 🐳 Training + inference Dockerfiles
├── mlruns/ # 🧪 MLflow experiment tracking
├── mlflow/ # ⚙️ Config for MLflow server (optional)
├── Dockerfile # 🔧 Main container spec
├── docker-compose.yml # 🚀 Stack for local dev
├── requirements.txt # 📦 Python dependencies
├── README.md # 📘 Docs & instructions
├── start.sh # 🏁 Easy entrypoint to run things
└── experiment/ # 📁 Jupyter notebooks, exploration
Challenges & Future Plans
Challenges
- Dealing with imbalanced classes in the dataset.
- Optimizing model size for mobile deployment.
- Handling varying lighting conditions.
- Ensuring model generalization.
Future Work
- Expand the model to cover more plant species.
- Implement real-time detection capabilities.
- Integrate with agricultural IoT systems.
- Add severity estimation.