A web-based application for automated tree detection and manual annotation using satellite imagery. This tool combines deep learning-based tree detection with interactive manual annotation capabilities to create comprehensive tree datasets.
- Automated Tree Detection: Uses DeepForest model to automatically detect trees in satellite imagery
- Interactive Annotation: Manual drawing tools for additional tree annotations
- KML/KMZ Support: Upload geographic boundaries via KML/KMZ files
- High-Resolution Satellite Imagery: Downloads high-zoom satellite imagery for detailed analysis
- Cloud Storage Integration: Automatic upload to AWS S3 for image and annotation storage
- Export Capabilities: Save annotations as CSV files with geographic coordinates
- Web-Based Interface: Built with Streamlit for easy access and use
- Frontend: Streamlit, Folium (interactive maps)
- AI/ML: DeepForest (tree detection model)
- Geospatial: GeoPandas, Rasterio, Shapely
- Cloud: AWS S3 (storage)
- Satellite Imagery: TMS/XYZ tile services
- Containerization: Docker
- Python 3.11+
- AWS S3 bucket and credentials
- Docker (optional, for containerized deployment)
-
Build the Docker image
docker build -t annotation-tool . -
Run the container
docker run -it --rm \ -v $(pwd):/app \ -p 8888:8888 \ --env-file .env \ annotation-tool
- Upload a KML or KMZ file containing the geographic boundary of the area you want to analyze
- The tool will automatically download high-resolution satellite imagery for that area
- The DeepForest model will automatically detect trees in the satellite imagery
- Detected trees are filtered by:
- Area: ≤ 60 m² (to exclude large objects)
- Confidence score: ≥ 0.15 (to ensure quality detections)
- Use the drawing tools on the map to add additional tree annotations
- Draw rectangles around trees that may have been missed by the model
- All manually drawn annotations are labeled as "Tree"
- Click "Save Annotations as CSV" to export all annotations
- The CSV file includes:
- Geographic coordinates (WGS84)
- Pixel coordinates
- Tree areas
- Confidence scores
- Source (model vs. manual annotation)
- Image path reference
- Download the CSV file locally
- Annotations are also automatically uploaded to your S3 bucket
annotation-tool/
├── app.py # Main Streamlit application
├── utils.py # Utility functions for geospatial operations
├── model-inference.py # DeepForest model inference utilities
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
├── .streamlit/ # Streamlit configuration
│ └── secrets.toml # AWS credentials (create this)
└── venv/ # Virtual environment (created locally)
The DeepForest model uses default settings optimized for tree detection:
- Minimum confidence threshold: 0.15
- Maximum tree area: 60 m²
- Satellite imagery zoom level: 19
The tool generates CSV files with the following columns:
geometry: Geographic coordinates (WGS84)xmin,ymin,xmax,ymax: Pixel coordinateslabel: Tree classificationscore: Detection confidence (model predictions only)area_m2: Tree crown area in square meterslabelled_by: Source of annotation ("model" or "user")image_path: Reference to the satellite image
This project is licensed under the MIT License - see the LICENSE file for details.
- DeepForest - Tree detection model
- Streamlit - Web application framework
- GeoPandas - Geospatial data manipulation
- Folium - Interactive maps
-
GDAL Installation Issues
- On macOS:
brew install gdal - On Ubuntu:
sudo apt-get install libgdal-dev - Use conda:
conda install gdal
- On macOS:
-
AWS Credentials Not Found
- Ensure
.streamlit/secrets.tomlexists and contains valid credentials - Check AWS IAM permissions for S3 access
- Ensure
-
Memory Issues with Large Images
- Reduce the area size in your KML file
- The tool automatically ensures a minimum area of 9,500 m²
-
No Trees Detected
- Check if the satellite imagery is clear and contains trees
- Verify the area is not too small or too large
- Try adjusting the confidence threshold in the code