An expert system that diagnoses plant diseases from leaf images by combining a CNN deep learning model with a JSON knowledge base to provide symptoms and treatment recommendations.
The model is trained on the PlantVillage dataset which consists of controlled lab images. It may perform differently on real-world field photographs with varying lighting or backgrounds.
Provide a leaf image path to the CLI. The model predicts the disease and the knowledge base returns matching symptoms and recommended treatment.
- CNN Model — trained on the PlantVillage dataset to classify 38 plant disease classes
- Knowledge Base — JSON file containing symptoms and treatments for each disease
- CLI App — takes an image path, runs prediction, and displays diagnosis with treatment advice
- Training Notebook — full training pipeline available on Kaggle
- Python
- TensorFlow / Keras
- NumPy
- Kagglehub
The model is trained on the PlantVillage dataset. Run the following to download it:
python dataset.pyMake sure your Kaggle API credentials are configured before running. See Kaggle API setup.
The pre-trained model is not included in this repo due to file size (134MB). To get the model:
- Option A — Run the training notebook on Kaggle: plant-disease-detector-ai-ccp
- Option B — Download the dataset and retrain locally using the notebook
Place the generated plant_disease_model.keras file in the root project directory.
Install dependencies:
pip install tensorflow numpy kagglehubDownload the dataset:
python dataset.pyRun the chatbot:
python chatbot.py- Run
python chatbot.py - Enter the file path of a leaf image when prompted
- The system will display the diagnosed disease, confidence score, symptoms and recommended treatment
- Type
exitto quit
A few sample images are available in the test_images/ folder to try out immediately.