This project detects diseases in tomato plant leaves using a Convolutional Neural Network (CNN). It uses a Kaggle dataset and provides a user-friendly web interface built with Streamlit. The application can also be deployed using Docker for easy sharing and demonstration.
- Tomato leaf disease classification (11 classes)
- CNN model trained using TensorFlow / Keras
- Upload leaf images and get real-time predictions
- Streamlit-based interactive GUI
- Dockerized for consistent deployment
- Clean GitHub repository structure with screenshots and documentation
tomato-disease-detection/ |
βββ app.py # Streamlit application
βββ Dockerfile # Docker deployment
βββ requirements.txt # Python dependencies
βββ README.md # Project documentation
βββ tomato_model.h5 # Trained CNN model
βββ src/ # Training scripts and preprocessing
β βββ train.py
β βββ model.py
β βββ preprocess.py
βββ screenshots/ # Screenshots for README & PPT
- Source: Kaggle β Tomato Plant Disease Dataset
- Total Classes: 11 (healthy + diseased)
- Dataset is not included due to size constraints
Classes: Bacterial_spot, Early_blight, Late_blight, Leaf_Mold, Septoria_leaf_spot, Spider_mites Two-spotted_spider_mite, Target_Spot, Tomato_Yellow_Leaf_Curl_Virus, Tomato_mosaic_virus, healthy, powdery_mildew
- Model Type: Convolutional Neural Network (CNN)
- Framework: TensorFlow / Keras
- Image Size: 224 Γ 224
- Optimizer: Adam
- Loss Function: Categorical Crossentropy
- Epochs: 10
- Batch Size: 32
- Validation Accuracy: ~78β82%
| Epoch | Training Accuracy | Validation Accuracy | Training Loss | Validation Loss |
|---|---|---|---|---|
| 1 | 42% | 49% | 1.61 | 1.52 |
| 2 | 60% | 66% | 1.10 | 0.94 |
| 3 | 65% | 74% | 0.97 | 0.75 |
| 4 | 69% | 71% | 0.87 | 0.93 |
| 5 | 71% | 76% | 0.81 | 0.67 |
| 6 | 73% | 75% | 0.76 | 0.84 |
| 7 | 73% | 77% | 0.74 | 0.71 |
| 8 | 75% | 78% | 0.68 | - |
| 9 | 76% | 79% | - | - |
| 10 | 77β80% | 78β80% | - | - |
Observations:
- Steady increase in accuracy shows effective learning.
- Validation accuracy closely tracks training accuracy β good generalization.
- Minor fluctuations in validation loss are expected due to dataset diversity.
- CPU-only training caused longer epoch durations (~30β40 min per epoch).
Limitations:
- Accuracy can improve with transfer learning (MobileNetV2, ResNet50) and GPU acceleration.
- Model is trained on a fixed dataset and may need retraining for real-world scenarios.
- Model Training
- Streamlit Interface
- Prediction Result
git clone https://github.com/DudalaShrujana/tomato-disease-detection.git
cd tomato-disease-detection
pip install -r requirements.txt
streamlit run app.pyOpen browser: http://localhost:8501
# Build Docker Image
docker build -t tomato-disease-app .
# Run Container
docker run -d -p 8501:8501 tomato-disease-appOpen browser: http://localhost:8501
- Improve accuracy using transfer learning (MobileNetV2, ResNet50)
- GPU acceleration for faster training
- Web interface improvements (image gallery, batch prediction)
- Extend to other crops and plant diseases