This project aims to accurately predict and identify various diseases affecting tomato plants using image-based analysis and machine learning techniques. This tool can help farmers and agricultural professionals quickly identify diseases and apply the necessary treatments to improve crop health and yield.
- Overview
- Features
- Technologies Used
- Dataset
- Installation
- Usage
- Model Training
- Model Evaluation
- Future Work
- Contributing
- License
- Acknowledgements
Tomato plants are prone to various diseases that can significantly affect crop quality and yield. This project leverages computer vision and deep learning techniques to detect diseases from images of tomato leaves. By using a well-trained convolutional neural network (CNN), the model can classify images into various disease categories, allowing for timely and accurate treatment recommendations.
- Image-based Disease Detection: Uses deep learning to classify tomato leaf images into different disease categories.
- Real-time Inference: Provides predictions quickly, making it suitable for field usage.
- Scalable and Customizable: Allows for additional disease classes and new plant types in future versions.
- Python: Core programming language for the project.
- TensorFlow/Keras: Framework for building and training deep learning models.
- OpenCV: For image processing and augmentation.
- Jupyter Notebook: Used for interactive model development and experimentation.
- Numpy and Pandas: For data manipulation and preprocessing.
The dataset used in this project consists of labeled images of tomato leaves affected by various diseases as well as healthy leaves. The images are preprocessed and augmented to improve the model's performance and generalization.
Dataset source: Kaggle: Tomato Disease Dataset
Classes:
- Healthy
- Early Blight
- Late Blight
- Clone the repository:
git clone https://github.com/nerdylelouch/Tomato-Disease-Prediction.git cd Tomato-Disease-Prediction
- Install the required packages:
pip install -r requirements.txt
- Pre-trained Model Inference:
- Run the following command to load a saved model and make predictions:
python predict.py --image_path "path_to_image.jpg"
- Replace
"path_to_image.jpg"
with the path to the leaf image you want to classify.
- Run the following command to load a saved model and make predictions:
- Training a New Model:
- If you want to train the model from scratch with your dataset, refer to the Model Training section.
To train the model, follow these steps:
- Organize your dataset in the following structure:
data/
├── train/
│ ├── Early_Blight/
│ ├── Late_Blight/
│ ├── Healthy/
│ └── ...
└── test/
├── Early_Blight/
├── Late_Blight/
├── Healthy/
└── ...
- Run the training script:
python train.py --epochs 50 --batch_size 32
- Adjust the
--epochs
and--batch_size
parameters as per your system capabilities and requirements.
- The model and training logs will be saved in the
models/
directory.
To evaluate the trained model's performance on the test dataset:
python evaluate.py --model_path models/trained_model.h5
This script will display metrics such as accuracy and precision.
- Additional Classes: Expand the model to include more diseases and support other plant types.
- Mobile Integration: Develop a mobile app to allow users to upload leaf images directly from the field for immediate diagnosis.
- Improved Augmentation: Experiment with advanced augmentation techniques to further improve model generalization.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/new-feature
). - Make your changes and commit (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature/new-feature
). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.
- The dataset was sourced from Kaggle.
- Special thanks to the open-source community for the libraries and resources that made this project possible.
Enjoy using the Tomato Disease Prediction tool and feel free to contribute to make it even better!
This README is designed to provide clarity and ease of use for users and contributors. Let me know if you'd like adjustments!