How manthan89-py/plant-disease-detection works
Project Type and Purpose
• This is a full-stack application that integrates a deep learning component for classifying leaf images into 39 disease categories.
• The primary purpose is to detect plant diseases using a Convolutional Neural Network (CNN) built in PyTorch and served via a Flask web application.
• The project supports both a deployed web app (with a downloadable pre-trained model) and a standalone model exploration via Jupyter Notebook in the Model folder.
File Structure to Unearth Architectural Clues
• Under “Flask Deployed App,” you have:
• app.py: The main Flask application that handles web requests, routing, and API logic.
• CNN.py: Likely contains helper functions or the neural network definitions for inference.
• Procfile: Configuration for deployment (e.g. on Heroku), indicating a cloud-based deployment.
• requirements.txt: Lists the dependencies which include Flask, PyTorch, etc.
• Templates folder: Contains the HTML files such as home.html, contact-us.html, and so on. This represents the user interface layer.
• Static folder: Serves assets like images and uploaded files, indicating that user input (leaf images) is collected and processed.
• Supplementary CSV files (disease_info.csv, supplement_info.csv): Provide metadata/details, likely enhancing the app’s information display.
• Under “Model,” you have:
• Jupyter Notebook (.ipynb), markdown, and PDF files showing that this is where deep learning model training, evaluation, and experimentation occur.
• Additional folders like demo_images and test_images are used for demonstration and validation.
a. Main Components to Identify:
• Web Frontend: Represent the HTML templates, static assets, and contact pages.
• Web Backend: The Flask application (app.py) which routes requests and communicates with the model.
• Deep Learning Model: The CNN defined in CNN.py and the pre-trained PyTorch model (plant_disease_model_1.pt).
• Data Sources: CSV files that provide disease and supplement information.
• User Input and Output: The mechanism by which users upload images and view predictions.
• Deployment Configuration: Procfile and deployment guidelines indicating cloud deployment (Heroku).
b. Relationships and Interactions:
• The user interacts with the web frontend (via HTML templates) which sends image data to the Flask backend.
• The Flask backend processes the image, calls the CNN model (via CNN.py and the pre-trained model file) to classify the input.
• Predictions are returned from the deep learning model to the backend and then rendered on the result page.
• Additional interactions might include displaying supplementary information from CSV files and handling static content (uploads, CSS, JS).
c. Architectural Patterns and Design Principles:
• Separation of Concerns: Clear split between frontend (UI based on HTML, CSS in the static folder) and backend (Flask app handling business logic).
• Modular Design: Distinct modules for model inference (CNN.py and pre-trained model file) and web-serving.
• Deployment Readiness: Use of configuration files (Procfile) for cloud deployment.
d. Relevant Technologies and Frameworks:
• Python and Flask for the backend web framework.
• PyTorch for the deep learning (CNN) components.
• HTML/CSS (templates and static assets) for the frontend.
• Supporting tools: Jupyter for model testing and demonstration.