This project is designed to detect and classify 10 different diseases in tomato leaves using TensorFlow and OpenCV (cv2). The model leverages deep learning techniques to accurately identify the disease present in the leaf, helping farmers and gardeners in early diagnosis and treatment.
Tomato plants are susceptible to various diseases that can severely impact crop yield and quality. This project aims to automate the detection of these diseases using computer vision and deep learning, providing a reliable and efficient tool for farmers.
The model can identify the following 10 diseases:
- Bacterial spot
- Early blight
- Late blight
- Leaf Mold
- Septoria leaf spot
- Spider mites
- Target spot
- Yellow Leaf Curl Virus
- Mosaic Virus
- Healthy
The dataset used for training and testing the model consists of labeled images of tomato leaves, each annotated with one of the 10 possible diseases or marked as healthy. The dataset is split into training, validation, and test sets to ensure the model generalizes well to unseen data.
The model is built using TensorFlow and leverages a convolutional neural network (CNN) architecture. The key features include:
- Multiple convolutional layers for feature extraction
- Max-pooling layers for dimensionality reduction
- Fully connected layers for classification
- Softmax activation for multi-class classification
OpenCV (cv2) is used for image preprocessing, including resizing, normalization, and augmentation.
-
Training the Model:
- Place the dataset in the appropriate directory (
/data
) and ensure it is correctly structured. - Run the training script:
python train.py
- Place the dataset in the appropriate directory (
-
Predicting on New Images:
- Use the trained model to predict the disease on new tomato leaf images:
python predict.py --image_path path/to/leaf_image.jpg
- Use the trained model to predict the disease on new tomato leaf images:
-
Evaluating the Model:
- To evaluate the model on the test set, run:
python evaluate.py
- To evaluate the model on the test set, run: