Skip to content

PestGuardian is a web-based application designed to assist farmers and gardeners in identifying pests in their crops and providing actionable recommendations for their elimination

Notifications You must be signed in to change notification settings

armanjscript/PestGuardian

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PestGuardian: AI-Powered Pest Detection and Elimination Assistant

Description

PestGuardian is a web-based application designed to assist farmers and gardeners in identifying pests in their crops and providing actionable recommendations for their elimination. By leveraging advanced computer vision and natural language processing, PestGuardian allows users to upload images of pests, detects the pests using a state-of-the-art YOLO model, and generates practical elimination methods using web search and AI-driven recommendations.

This project combines cutting-edge technologies to create a user-friendly tool that simplifies pest management, making it accessible even to those without extensive technical expertise.

Technologies Used

Technology Purpose
Streamlit Creates the interactive web interface for user interaction.
Ultralytics YOLO Detects pests in uploaded images using the YOLO model.
LangChain & LangChain-Ollama Powers natural language processing with the Qwen2.5 model for generating recommendations.
GoogleSerperAPIWrapper Performs web searches to find pest elimination methods.
LangGraph Orchestrates the workflow of pest detection, web search, and recommendation generation.
nest_asyncio Handles asynchronous operations for smooth execution in the browser.

Installation Instructions

To run PestGuardian locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/armanjscript/PestGuardian.git
  2. Navigate to the project directory:

    cd PestGuardian
  3. Install dependencies:

    • If a requirements.txt file is provided, install the dependencies using:
      pip install -r requirements.txt
    • If not, install the required libraries manually:
      pip install streamlit ultralytics langchain langchain-ollama langgraph google-serper nest-asyncio
  4. Set up environment variables:

    • Obtain a Serper API key from Serper.dev for web searching.
    • Set the environment variable SERPER_API_KEY:
      export SERPER_API_KEY=your_api_key_here
  5. Download the YOLO model:

    • Place the YOLO model file (best.pt) in the project directory.
    • If you don’t have the model, you can:
      • Train your own YOLO model using Ultralytics.
      • Use a pre-trained model suitable for pest detection, ensuring compatibility with Ultralytics YOLO.

Usage Instructions

  1. Run the application:

    streamlit run main.py
  2. Upload an image:

    • Open the web interface in your browser (typically at http://localhost:8501).
    • Use the file uploader to upload an image of pests in your garden or farm (supported formats: .jpg, .jpeg, .png).
  3. View results:

    • The application will:
      • Detect pests using the YOLO model.
      • Search for elimination methods using the Serper API.
      • Generate recommendations using the OllamaLLM (Qwen2.5 model).
    • Results, including detected pests and recommendations, will be displayed in the interface.
    • Expand the “View detailed search results” section to see additional information from the web search.

Example Workflow

  1. Image Upload: User uploads an image of a garden with visible pests.
  2. Pest Detection: The YOLO model analyzes the image and identifies pests (e.g., aphids, beetles).
  3. Web Search: The application searches for elimination methods for each detected pest using the Serper API.
  4. Recommendation Generation: The Qwen2.5 model processes the search results and generates concise, practical recommendations.
  5. Result Display: The interface shows the detected pests, recommendations, and optional detailed search results.

Contributing

We welcome contributions to PestGuardian! To contribute:

  • Open an issue on the GitHub repository to report bugs or suggest features.
  • Submit a pull request with your changes, ensuring they follow the project’s coding standards and include documentation.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact Information

For questions, feedback, or support, please:

Future Improvements

PestGuardian is an evolving project with several planned enhancements:

  • Improve pest detection accuracy by fine-tuning the YOLO model with diverse datasets.
  • Add multilingual support for recommendations to reach a broader audience.
  • Integrate additional APIs for comprehensive pest information.
  • Enhance the user interface for a more intuitive and engaging experience.

Troubleshooting

  • Missing YOLO model: Ensure best.pt is in the project directory. Check Ultralytics documentation for model training or acquisition.
  • API key issues: Verify that the SERPER_API_KEY is correctly set in your environment.
  • Dependency errors: Ensure all required libraries are installed and compatible with your Python version (recommended: Python 3.8+).
  • Async issues: The application uses nest_asyncio to handle asynchronous operations, but ensure your environment supports async execution.

About

PestGuardian is a web-based application designed to assist farmers and gardeners in identifying pests in their crops and providing actionable recommendations for their elimination

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages