Wampu204/farmlenz
0
NDVI-Based Field Segmentation
 
A web application for analyzing agricultural fields using satellite imagery and NDVI (Normalized Difference Vegetation Index) data to create management zones for precision agriculture like zoning based on yield of the field areas.
Table of Contents
- Overview
- Features
- Installation
- Usage
- Technical Details
- Demo
- Example Use Cases
- Contributing
- License
- Acknowledgments
Overview
This application leverages Google Earth Engine and Sentinel-2 imagery to compute NDVI values across agricultural fields. By clustering field pixels into management zones, farmers and agronomists can make data-driven decisions on irrigation, fertilization, and pest management.
Key capabilities include:
- Computation of median NDVI over a selected date range
- Integration of daily rainfall (CHIRPS) to correlate weather with crop health
- Customizable clustering algorithms
- Time-series visualization of vegetation dynamics
Features
- Interactive Field Selection: Input latitude, longitude, and radius to define the target field.
- Multiple Clustering Methods: K-Means, DBSCAN, Mean Shift, or Gaussian Mixture Models (GMM).
- NDVI Time Series Analysis: View historical NDVI trends for monitoring crop development.
- Rainfall Data Integration: Overlay precipitation patterns to diagnose water stress.
- Crop-Specific Insights: Tailor analysis to crop type and growth stage.
- Downloadable Reports: Export CSV and PDF summaries of zone statistics and time-series data.
- Algorithm Comparison: Side-by-side evaluation of clustering outcomes.
- Interactive Maps: Color-coded maps of NDVI and management zones.
- Parameter Tuning: Adjust time window, clustering parameters, and data thresholds.
Installation
Prerequisites
- Python 3.7 or higher
- Google Earth Engine account
- Streamlit
Setup
- Clone the repository:
git clone https://github.com/Priyam-28/CropSight.git
cd ndvi-field-segmentation- Install dependencies:
pip install -r requirements.txt- Authenticate Earth Engine:
earthengine authenticateUsage
- Launch the app:
streamlit run app.py- In the browser UI:
- Enter your field’s latitude and longitude.
- Specify a radius (in meters) around the point.
- Choose a date range for analysis.
- Select your crop type and growth stage.
- Pick a clustering algorithm and adjust its parameters.
- Click Analyze Field.
- Navigate tabs:
- NDVI Map: Visualize spatial NDVI distribution.
- Field Zones: Explore segmented management zones.
- Time Series: Inspect NDVI trends over time.
- Rainfall: Check precipitation alongside NDVI.
- Analysis: View statistics and tailored recommendations.
- Comparison: Compare multiple clustering outputs.
Technical Details
Data Sources
- Sentinel-2 (10 m resolution) for imagery.
- CHIRPS daily precipitation dataset.
Processing Workflow
- Fetch Sentinel-2 image collection for selected dates.
- Compute NDVI for each scene:
(NIR - RED) / (NIR + RED). - Aggregate to median NDVI mosaic.
- Cluster pixel values into zones using chosen algorithm.
- Extract NDVI & rainfall time series for the field.
- Generate statistics (mean, std, zone area) and insights.
Clustering Options
Screenshots
Select Crop and Field
Field Zones
NDVI Time Series
Rainfall Analysis
Example Use Cases
- Variable Rate Application: Generate prescription maps for targeted inputs.
- Irrigation Management: Detect water-stressed zones for optimized watering.
- Yield Estimation: Correlate NDVI patterns with expected yield.
- Problem Spotting: Identify underperforming patches for intervention.
- Seasonal Tracking: Monitor crop growth throughout the season.
Contributing
Contributions welcome! Please follow these steps:
- Fork the repo and create a branch:
git checkout -b feature/YourFeature - Commit your changes:
git commit -m "Add new feature" - Push to your branch:
git push origin feature/YourFeature - Open a Pull Request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Acknowledgments
- Google Earth Engine for satellite data access.
- Sentinel-2 mission for high-resolution imagery.
- CHIRPS for global precipitation datasets.
- Streamlit for the interactive UI.
