This project is a web application that classifies potato leaf health based on uploaded images. It can detect Potato Early Blight, Potato Late Blight, and Healthy Potato Leaves, providing a confidence score for each prediction.
- Frontend: Built with React, featuring a user-friendly interface for image upload via drag-and-drop or file selection.
- Backend: FastAPI serves as the API layer, facilitating communication with the TensorFlow Serving model for real-time predictions.
- Model Deployment: A pre-trained CNN model, hosted on TensorFlow Serving, processes input images and returns classification results.
The model is trained on the PlantVillage Dataset, which includes labeled images of potato leaves with various conditions, helping to differentiate diseased and healthy samples. p.s you can also find the Dataset here as a ZIP file: C:<your directory>\potato_classifier\training\PlantVillage.zip
- Model Training: The CNN model was trained using the PlantVillage dataset and saved for deployment.
- Model Deployment: The trained model is deployed on TensorFlow Serving, accessed through FastAPI to serve predictions to the frontend.
- Web Interface: Users upload an image of a potato leaf, and the app displays the classification and confidence score.
To get a local copy of the project running, follow these steps:
-
Clone the Repository:
git clone https://github.com/BEKtesfish/CNN-Image-Classification-Web-Application.git CNN-Image-Classification-Web-Application
-
Create and Activate a Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Backend Dependencies:
pip install -r requirements.txt
-
Setup TensorFlow Serving: To serve the model with TensorFlow Serving, use Docker:
docker run -t --rm -p 8501:8501 -v C:<your repository>\potato_classifier\models:/models tensorflow/serving --rest_api_port=8501 --model_config_file=/potato_classifier/models.config
For more details, see the TensorFlow Serving Documentation.
-
Run the FastAPI Backend: Inside the api directory, start the backend server:
cd api python main-tf-serving.py -
Run the Frontend: Navigate to the frontend directory, install dependencies, and start the React app:
cd ../front npm install npm start -
Access the Application: Open your browser and go to http://localhost:3000. Here, you’ll find a drag-and-drop section where you can upload an image of a potato leaf to receive predictions and a confidence score
Model Training Notebook: In the training folder,contains the Jupyter notebook used for training the CNN model. and the 1st version of the trained model can be found in the models folder
