flowchart LR
A[Satellite Imagery] --> B[Preprocessing]
B --> C[Feature Extraction]
C --> D[Training Data Collection]
D --> E[Model Training]
E --> F[Classification]
F --> G[Accuracy Assessment]
G --> H{Acceptable?}
H -->|No| D
H -->|Yes| I[Final Map]
style E fill:#4A90E2
style F fill:#4A90E2
Session 1: Supervised Classification with Random Forest
Theory and Practice for Earth Observation
Session 1: Supervised Classification with Random Forest
Theory and Practice for Earth Observation
Learn to classify satellite imagery using Random Forest and Google Earth Engine
Session Overview
This 3-hour session introduces supervised classification for Earth Observation, focusing on the Random Forest algorithm and its implementation in Google Earth Engine.
Presentation
By the end of this session, you will be able to:
- Understand supervised classification workflow for EO data
- Explain how decision trees and Random Forest work
- Implement Random Forest classification using Google Earth Engine
- Perform accuracy assessment and interpret results
- Apply classification to Palawan land cover mapping
Presentation Slides
Part A: Theory (1.5 hours)
Topics Covered
Supervised Classification Basics
- Classification workflow
- Training data requirements
- Feature extraction
- Model validation
Decision Trees
- Recursive partitioning
- Splitting criteria (Gini, entropy)
- Overfitting prevention
- Tree visualization
Random Forest Ensemble
- Bootstrap aggregation (bagging)
- Random feature selection
- Voting mechanism
- Ensemble advantages
Feature Importance
- Variable selection
- Spectral band importance
- Index contribution
- Interpretation strategies
Accuracy Assessment
- Confusion matrices
- Producer’s accuracy (recall)
- User’s accuracy (precision)
- Kappa coefficient
Google Earth Engine
- Platform capabilities
- Cloud computing advantages
- GEE Python API
- geemap library
Theory Materials
📊 Interactive Theory Notebook
Step-by-step exploration of Random Forest concepts with visualizations and exercises.
- Decision tree interactive demos
- Random Forest voting visualization
- Feature importance analysis
- Confusion matrix interpretation
- Concept check quiz
⏱️ Estimated Time: 70 minutes
Part B: Hands-on Lab (1.5 hours)
Practical Workflow
This hands-on lab guides you through a complete land cover classification workflow for Palawan using Sentinel-2 imagery and Random Forest.
Lab Sections
1. Setup (10 minutes) - Import libraries (geemap, ee, scikit-learn) - Authenticate Google Earth Engine (with your Cloud project ID) - Define Palawan study area - Set date range for imagery
2. Data Acquisition (20 minutes) - Load Sentinel-2 ImageCollection - Apply cloud masking (Cloud Score+) - Filter by date and cloud cover - Create median composite - Compute spectral indices: - NDVI (vegetation) - NDWI (water) - NDBI (built-up) - EVI (enhanced vegetation) - Visualize the RGB composite
3. Training Data (20 minutes) - Derive training points from ESA WorldCover 2021 for five classes: - Forest - Agriculture - Water - Urban - Mangrove - Visualize training areas on map - Sample spectral values - Prepare feature matrix - Inspect training statistics
4. Model Training (20 minutes) - Configure Random Forest classifier - Set hyperparameters: - Number of trees (e.g., 100) - Variables per split - Min leaf population - Train model on Sentinel-2 features - Inspect feature importance
5. Classification (15 minutes) - Apply trained model to study area - Generate land cover map - Create visualization palette - Display results on interactive map - Calculate area statistics by class
6. Validation (25 minutes) - Sample an independent set of validation points - Apply model to validation data - Calculate accuracy metrics: - Overall accuracy - Producer’s accuracy - User’s accuracy - Kappa coefficient - Generate confusion matrix - Analyze misclassification patterns
7. Exercises (20 minutes) - Modify number of trees - Inspect feature importance and remove spectral indices - Classify a different Philippine region - Export results to Google Drive
Lab Materials
💻 Hands-on Lab Notebook
Complete implementation of Random Forest classification workflow with Google Earth Engine.
⏱️ Estimated Time: 90 minutes
📋 Prerequisites: - Google Earth Engine access with a registered Cloud project (access guide) - Basic Python knowledge - Understanding of remote sensing concepts
Philippine Context
This session uses Palawan as the study area, a biodiversity hotspot and UNESCO Biosphere Reserve facing challenges from:
- Deforestation and illegal logging
- Agricultural expansion
- Mining activities
- Coastal development
- Climate change impacts
Applications for Philippine Agencies:
- DENR: Forest monitoring and protected area management
- DA: Agricultural land mapping and crop monitoring
- NDRRMC: Land cover baseline for disaster risk assessment
- PhilSA: Space-based monitoring and Earth observation data services
- LGUs: Municipal planning and zoning
Key Concepts
What is Supervised Classification?
Supervised classification assigns labels to pixels based on their spectral characteristics, using labeled training data to learn the relationship between spectral signatures and land cover classes.
Why Random Forest for EO?
Strengths: - Handles high-dimensional data (many spectral bands/indices) - Resistant to overfitting through ensemble averaging - Provides feature importance rankings - Fast training and prediction - No assumptions about data distribution - Works well with limited training samples
Ideal for: - Land cover classification - Crop type mapping - Forest/non-forest discrimination - Urban area detection
Common Land Cover Classes
Natural Ecosystems: - Primary forest (dipterocarp) - Secondary forest - Mangroves - Grasslands - Water bodies
Human-Modified: - Agricultural land (rice, coconut) - Urban/built-up areas - Bare soil - Mining areas - Roads and infrastructure
Technical Details
Google Earth Engine
Google Earth Engine provides:
- Petabyte-scale satellite imagery archive
- Cloud computing infrastructure
- Pre-processed analysis-ready data
- JavaScript and Python APIs
- Free for non-commercial and research use (requires a registered Google Cloud project)
Key GEE Concepts: - ImageCollection: Time series of satellite images - Image: Single satellite scene or composite - Feature/FeatureCollection: Vector data (training polygons) - Reducer: Aggregation operations - Classifier: Machine learning algorithms
Random Forest Hyperparameters
| Parameter | Description | Typical Range | Effect |
|---|---|---|---|
numberOfTrees |
Number of trees in ensemble | 50-500 | More trees → better performance, longer training |
variablesPerSplit |
Features to consider per split | √n to n | Lower → more randomness, less correlation |
minLeafPopulation |
Min samples in leaf node | 1-10 | Higher → simpler trees, less overfitting |
bagFraction |
Fraction for bootstrapping | 0.5-1.0 | Lower → more randomness |
maxNodes |
Max nodes per tree | null (unlimited) | Limits tree complexity |
Spectral Indices for Classification
Vegetation Indices: - NDVI: (NIR - Red) / (NIR + Red) → vegetation vigor - EVI: 2.5 × (NIR - Red) / (NIR + 6×Red - 7.5×Blue + 1) → improved sensitivity
Water Indices: - NDWI: (Green - NIR) / (Green + NIR) → water bodies - MNDWI: (Green - SWIR) / (Green + SWIR) → water/wetlands
Built-up Indices: - NDBI: (SWIR - NIR) / (SWIR + NIR) → urban areas
Resources
Documentation
Philippine EO Resources
Course Materials
Next Steps
Session 2 builds on these fundamentals with advanced Palawan land cover classification:
- Multi-temporal composites (dry/wet season)
- Advanced feature engineering (GLCM texture, topographic)
- 8-class detailed classification
- Hyperparameter tuning
- Change detection (2020 vs. 2024)
- Forest loss analysis
To Prepare: - Complete all Session 1 exercises - Review confusion matrix analysis - Think about potential classification improvements - Consider additional features that might help
Questions & Support
- Review the FAQ
- Email the instructor: dimitris@anefelo.com
Day 2 · Session 1 of the EO AI/ML Training.