Documentation

Installation Guide

PlantPulse AI: Advanced Plant Disease Detection System Using Deep Learning - Final Year Project with Source Code

Step-by-step Setup Verified Instructions Chat Support
Back to Project
Complete Guide

Complete Installation and Setup Guide for PlantPulse AI

System Requirements

Component Minimum Requirement Recommended
Operating System Windows 10, macOS 10.14, Ubuntu 18.04 Windows 11, macOS 12+, Ubuntu 22.04
Python Version Python 3.8 Python 3.10 or higher
RAM 4GB 8GB or more
Storage 2GB free space 5GB free space
Processor Dual Core 2.0 GHz Quad Core 2.5 GHz or higher

Pre-Installation Requirements

  1. Install Python
    • Download Python 3.10.11 from official website
    • During installation, check "Add Python to PATH"
    • Verify installation by opening command prompt/terminal and typing: python --version
  2. Install pip (Python Package Manager)
    • Usually comes with Python installation
    • Verify by typing: pip --version
    • If not installed, download get-pip.py and run: python get-pip.py
  3. Install Git (Optional but Recommended)
    • Download from git-scm.com
    • Useful for version control and cloning repositories

Step 1: Extract Project Files

  1. Download the PlantPulse AI project ZIP file from CodeAj Marketplace
  2. Extract the ZIP file to your desired location (e.g., Desktop, Documents)
  3. Open command prompt (Windows) or terminal (Mac/Linux)
  4. Navigate to the project directory:
    cd path/to/plantpulse-ai

    Example for Windows:

    cd C:\Users\YourName\Desktop\plantpulse-ai

    Example for Mac/Linux:

    cd ~/Desktop/plantpulse-ai

Step 2: Create Virtual Environment

Why Virtual Environment? It keeps project dependencies isolated and prevents conflicts with other Python projects.

For Windows Users:

  1. Create virtual environment:
    python -m venv venv
  2. Activate virtual environment:
    venv\Scripts\activate
  3. You should see (venv) prefix in your command prompt

For Mac/Linux Users:

  1. Create virtual environment:
    python3 -m venv venv
  2. Activate virtual environment:
    source venv/bin/activate
  3. You should see (venv) prefix in your terminal

Step 3: Install Required Dependencies

  1. Make sure virtual environment is activated (you should see (venv) prefix)
  2. Upgrade pip to latest version:
    pip install --upgrade pip
  3. Install all required packages:
    pip install -r requirements.txt
  4. Wait for installation to complete (may take 5-10 minutes depending on internet speed)

Core Dependencies Installed:

Package Version Purpose
Flask 2.3.0 Web framework for backend application
TensorFlow 2.13.0 Deep learning framework for AI model
Keras 2.13.1 High-level neural networks API
OpenCV 4.8.0 Image processing and computer vision
NumPy 1.24.3 Numerical computing library
Pillow 10.0.0 Image file handling
Werkzeug 2.3.0 WSGI utility library for Flask

Step 4: Verify Model Files

  1. Navigate to the models folder inside project directory
  2. Verify that plant_disease_model.h5 file exists
  3. Check file size (should be approximately 85MB)
  4. If model file is missing or corrupted:
    • Re-download the project
    • Or contact CodeAj support for model file

Step 5: Configure Application Settings

  1. Open app.py file in any text editor (VS Code, Notepad++, etc.)
  2. Review the following configurations:
    UPLOAD_FOLDER = 'uploads'
    MAX_FILE_SIZE = 16 * 1024 * 1024  # 16MB
    ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'}
                
  3. You can modify these settings if needed, but default values work well
  4. Save the file after making any changes

Step 6: Create Required Directories

  1. The application needs certain directories to function properly
  2. If not present, create the following folders in project root:
    • uploads - For storing user uploaded images
    • static/uploads - For serving processed images
  3. Create directories manually or run:
    mkdir uploads
    mkdir static/uploads

Step 7: Run the Application

  1. Make sure you are in the project root directory
  2. Ensure virtual environment is activated
  3. Start the Flask application:
    python app.py
  4. Wait for the server to start (5-10 seconds for model loading)
  5. You should see output similar to:
     * Serving Flask app 'app'
     * Debug mode: on
    WARNING: This is a development server.
     * Running on http://127.0.0.1:5000
    Press CTRL+C to quit
                

Step 8: Access the Application

  1. Open your web browser (Chrome, Firefox, Edge, Safari)
  2. Navigate to: http://localhost:5000 or http://127.0.0.1:5000
  3. The PlantPulse AI homepage should load
  4. You should see the drag-and-drop upload interface

Step 9: Test the Application

  1. Prepare a test image of a plant leaf (JPG, JPEG, or PNG format)
  2. Click on the upload area or drag and drop the image
  3. Wait 2-3 seconds for AI model to process the image
  4. View the results displaying:
    • Detected disease name
    • Confidence score percentage
    • Disease symptoms
    • Treatment recommendations
    • Prevention methods

Project Directory Structure

plantpulse-ai/
│
├── app.py                      # Main Flask application file
├── requirements.txt            # Python dependencies list
├── README.md                   # Project documentation
│
├── models/
│   └── plant_disease_model.h5  # Trained deep learning model (85MB)
│
├── static/
│   ├── css/
│   │   └── style.css          # Stylesheet files
│   ├── js/
│   │   └── script.js          # JavaScript files
│   ├── images/                # Static images
│   └── uploads/               # Processed uploaded images
│
├── templates/
│   ├── index.html             # Homepage
│   ├── detect.html            # Detection page
│   ├── diseases.html          # Disease catalog
│   ├── about.html             # About page
│   └── contact.html           # Contact page
│
├── uploads/                    # User uploaded images (temporary)
│
├── utils/
│   ├── preprocessing.py       # Image preprocessing functions
│   └── model_utils.py         # Model loading and prediction
│
└── venv/                       # Virtual environment (created by you)
    

Common Issues and Troubleshooting

Issue 1: TensorFlow Installation Failed

Error: Could not install TensorFlow

Solution:

  1. Install Microsoft Visual C++ Redistributable (Windows users):
    • Download from Microsoft website
    • Install and restart computer
  2. Try CPU-only version:
    pip install tensorflow-cpu
  3. Check Python version compatibility (must be 3.8 to 3.11 for TensorFlow 2.13)

Issue 2: Port 5000 Already in Use

Error: Address already in use

Solution:

  1. Change port in app.py:
    app.run(debug=True, port=5001)
  2. Or find and stop the process using port 5000:
    • Windows: netstat -ano | findstr :5000
    • Mac/Linux: lsof -i :5000

Issue 3: Model File Not Found or Failed to Load

Error: Cannot find model file or model loading error

Solution:

  1. Verify model file exists in models/ directory
  2. Check file size (should be around 85MB)
  3. Verify file path in app.py is correct
  4. Re-extract the project ZIP file if model is corrupted
  5. Contact CodeAj support for model file re-download

Issue 4: OpenCV Import Error

Error: ImportError: DLL load failed (Windows) or similar

Solution:

  1. Uninstall and reinstall OpenCV:
    pip uninstall opencv-python
    pip install opencv-python
  2. Try headless version:
    pip install opencv-python-headless
  3. Linux users may need system dependencies:
    sudo apt-get install python3-opencv
    sudo apt-get install libsm6 libxext6 libxrender-dev

Issue 5: Module Not Found Error

Error: ModuleNotFoundError: No module named 'xyz'

Solution:

  1. Make sure virtual environment is activated
  2. Reinstall requirements:
    pip install -r requirements.txt
  3. Install specific missing module:
    pip install module-name

Issue 6: Out of Memory Error

Error: MemoryError or ResourceExhaustedError

Solution:

  1. Close other applications to free up RAM
  2. Reduce batch size in model configuration
  3. Use smaller image sizes for testing
  4. Upgrade RAM if possible (minimum 8GB recommended)

Advanced Configuration

Running on Different Host/Port

Edit the last line of app.py:

app.run(host='0.0.0.0', port=8080, debug=True)
  • host='0.0.0.0' - Makes app accessible from other devices on network
  • port=8080 - Changes port number
  • debug=False - Disable debug mode for production

Production Deployment with Gunicorn

  1. Install Gunicorn:
    pip install gunicorn
  2. Run with Gunicorn:
    gunicorn -w 4 -b 0.0.0.0:5000 app:app
  3. -w 4 means 4 worker processes (adjust based on CPU cores)

Docker Deployment

  1. Create Dockerfile in project root
  2. Build Docker image:
    docker build -t plantpulse-ai .
  3. Run Docker container:
    docker run -p 5000:5000 plantpulse-ai

Environment Variables Configuration

Create a .env file in project root for sensitive configurations:

FLASK_APP=app.py
FLASK_ENV=development
SECRET_KEY=your-secret-key-here
MAX_CONTENT_LENGTH=16777216
UPLOAD_FOLDER=uploads
MODEL_PATH=models/plant_disease_model.h5
    

Testing the API Endpoints

Use tools like Postman or curl to test API:

curl -X POST -F "file=@path/to/image.jpg" http://localhost:5000/predict
    

Stopping the Application

  1. Press CTRL + C in the terminal/command prompt
  2. Wait for graceful shutdown
  3. Deactivate virtual environment:
    deactivate

Uninstallation

  1. Deactivate virtual environment if active
  2. Delete the project folder
  3. No system-wide changes are made, so no cleanup needed

Getting Help and Support

  • Check documentation folder for detailed guides
  • Visit CodeAj website for video tutorials
  • Contact support through CodeAj Marketplace
  • Join CodeAj community forum for peer support

Next Steps After Installation

  1. Explore all pages of the application
  2. Test with different plant images
  3. Read the code to understand implementation
  4. Customize the UI according to your preferences
  5. Add more features or plant species
  6. Prepare your project presentation
  7. Generate project report and documentation

Performance Optimization Tips

  • Use image compression before upload
  • Implement caching for frequently accessed predictions
  • Enable model quantization for faster inference
  • Use CDN for static files in production
  • Implement rate limiting for API endpoints
  • Enable GZIP compression in Flask

Security Best Practices

  • Never commit .env file to version control
  • Implement file size and type validation
  • Use HTTPS in production environment
  • Sanitize user inputs
  • Implement CSRF protection
  • Regular security updates for dependencies

Congratulations! You have successfully installed and configured PlantPulse AI. You are now ready to detect plant diseases using artificial intelligence.

Need Help?

Our team is here to assist you with installation and setup.

Chat with Us
Chat with us