Documentation

Installation Guide

PestGuard AI: Pest Detection and Pesticide Recommendation System using Deep Learning

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

How to Set Up and Run PestGuard AI

Setup takes about 15 to 20 minutes on a normal laptop. You don't need a GPU because the trained model is already included.

Before You Start

  • Python 3.8 or newer installed (tick "Add Python to PATH" during installation on Windows)
  • pip, which ships with Python
  • A free OpenWeatherMap API key for the spray advisory feature
  • The model file (pest_model.pth) and dataset, shared with your purchase

Step-by-Step Setup

  1. Get the project files. Extract the zip you received, or clone the repository, then open a terminal inside the project folder:
    cd Pest-detection-and-pesticides-recommendation-system-main
  2. Create a virtual environment. This is optional, but it keeps the project's packages separate from the rest of your system.
    python -m venv venv
    Activate it on Windows:
    venv\Scripts\activate
    Activate it on macOS or Linux:
    source venv/bin/activate
  3. Place the trained model. Make sure a folder named models exists in the project root. If it doesn't, create it:
    mkdir models
    Copy pest_model.pth into this folder. If you also want to retrain, put the dataset in the pest_dataset folder.
  4. Install the required libraries.
    pip install -r requirements.txt
    PyTorch is the largest download, so this step can take a few minutes on a slow connection.
  5. Add your weather API key. Open the project's configuration (or the .env file, if your copy has one) and paste your OpenWeatherMap key where the weather key is expected. Without the key, the app still works, but the spray advisory won't load live data.
  6. Start the application.
    python main.py
  7. Open it in your browser. Go to http://localhost:5001. Upload a pest image from the upload page to see the detection result, treatments and weather advice.

Officer Dashboard Login

Use these default credentials to open the admin side, where you can edit pest records and read user queries:

  • Username: officer
  • Password: officer123

Change the password before showing the project publicly.

Common Issues

  • Model not found error: check that the file is named exactly pest_model.pth and sits directly inside models/.
  • Port 5001 already in use: close the other app using that port, or change the port in main.py.
  • pip install fails on PyTorch: upgrade pip with python -m pip install --upgrade pip and try again.

If you'd rather not handle this yourself, the Project Setup add-on covers installation on your machine and a walkthrough of the code.

Need Help?

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

Chat with Us