Skip to content

samrin1502/Agri-Vision

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌱 Agri-Vision: Cotton Crop Analysis System

Agri-Vision is an AI-powered system that analyzes cotton crop images to determine growth stages and health conditions.
It helps farmers and researchers make informed decisions about crop management and harvest timing.


πŸ“Œ Overview

Agri-Vision uses deep learning and computer vision techniques to:

  • Detect cotton growth phases
  • Identify crop health issues and diseases
  • Provide confidence scores and actionable recommendations
  • Offer both a web interface and a REST API

✨ Features

  • 🌿 Growth Phase Detection (4 stages)
  • πŸ’š Health Assessment (disease & damage detection)
  • πŸ€– AI-Powered Analysis using deep learning
  • 🌐 Web Interface (Flask-based)
  • πŸ“Š REST API Support for programmatic access
  • 🎯 Smart Recommendations for farmers
  • ⚑ Fast Processing (< 2 seconds per image)

πŸ› οΈ Tech Stack

  • Python
  • Flask
  • TensorFlow
  • OpenCV
  • HTML/CSS
  • JavaScript

πŸ“ Project Structure

Agri-Vision/
β”‚
β”œβ”€β”€ results/                        # Stores output results and visualizations
β”‚   └── training_history.png
β”‚
β”œβ”€β”€ static/                         # Static assets
β”‚   β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ uploads/
β”‚   └── favicon.png
β”‚
β”œβ”€β”€ templates/                      # Flask HTML templates
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ results.html
β”‚   └── upload.html
β”‚
β”œβ”€β”€ .env                            # Environment variables (create manually)
β”œβ”€β”€ .gitignore
β”œβ”€β”€ app.py                          # Main Flask application
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
└── train.py                        # Model training script

πŸš€ Project Setup & Execution

Follow the steps below to run the project locally.

1️⃣ Clone the Repository

git clone <repository-url>
cd <project-folder>

2️⃣ Create a .env File

Create a .env file in the root directory of the project and add your secret key.

Example

SECRET_KEY=your_secret_key_here

Replace your_secret_key_here with your actual secret key.


3️⃣ Install Python Dependencies

Install all the required Python packages using:

pip install -r requirements.txt

4️⃣ Run the Project

Start the application using:

python app.py

βœ… Setup Complete

The project should now be running successfully on your local machine.


πŸ“Š Growth Phases Detected

  • 🌱 Vegetative / Budding – Early growth stage
  • 🌸 Flowering – Flower development stage
  • πŸ‚ Bursting (Ripped) – Cotton bolls opening
  • βœ… Harvest Ready – Optimal harvest time

🩺 Health Issues Identified

  • βœ… Healthy – No issues detected
  • πŸ› Pink Bollworm Damage – Pest infestation detected
  • 🎨 Discoloration – Nutrient or water deficiency
  • ⚠️ Other Damage – Miscellaneous crop issues

πŸ› οΈ API Reference

Analyze Image (POST Request)

curl -X POST -F "file=@cotton_image.jpg" http://localhost:5000/api/analyze

πŸ“¦ Response Format (JSON)

{
  "status": "success",
  "analysis": {
    "stage": "Bursting (Ripped)",
    "stage_confidence": 0.87,
    "health_status": "Pink Bollworm Damage",
    "health_confidence": 0.76,
    "health_score": 68.5,
    "is_ripped": true,
    "has_damage": true
  },
  "recommendations": ["..."]
}

🎯 Usage

🌐 Web Interface

  1. Go to /analyze
  2. Upload a cotton crop image
  3. View detailed analysis results
  4. Download the JSON report if needed

πŸ“ˆ Model Performance

  • βœ… Accuracy: ~85–90% on test data
  • ⚑ Processing Time: < 2 seconds per image
  • πŸ–ΌοΈ Supported Formats: JPG, PNG, JPEG
  • πŸ“¦ Maximum File Size: 10MB

πŸš€ Future Enhancements

  • πŸ“± Mobile application support
  • πŸŽ₯ Real-time video analysis
  • 🌾 Multi-crop support
  • ☁️ Weather data integration
  • πŸ“Š Yield prediction system
  • 🧠 Improved AI models

🀝 Contributing

Contributions are welcome to improve Agri-Vision and make it more useful for farmers, researchers, and developers.

Feel free to:

  • Fork the repository
  • Create a feature branch
  • Submit a pull request

πŸ“Œ Contribution Guidelines Reminder

Before Contributing

  • Do not start working on an issue until it is assigned to you.
  • Comment on the issue you want to work on.
  • Wait for maintainers to assign the issue before creating a PR.

πŸ”€ Pull Request Guidelines

  • Mention the related issue in your PR description using:
    • Closes #issue_number
    • Fixes #issue_number
  • Keep PRs focused on a single issue/topic.
  • Add screenshots or demo videos for UI-related changes.
  • Sync your branch with the latest repository changes before submitting a PR.

πŸ“ Additional Notes

  • Follow the project structure and coding style.
  • Avoid spam or duplicate PRs/issues.
  • Be respectful during code reviews and discussions.
  • Beginners are welcome β€” feel free to ask questions if stuck ✨

πŸ“œ License

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


πŸ™Œ Acknowledgements

Special thanks to:

  • TensorFlow
  • Flask
  • OpenCV
  • Open-source contributors
  • Agricultural research datasets

❀️ Made with Passion by neeru24

⭐ If you found this project helpful, consider giving it a star. ⭐

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages