A machine learning web application for predicting urban areas from satellite imagery spectral data. This tool uses a pre-trained Random Forest model to classify urban and non-urban areas based on Landsat spectral features.
🌟 Features
📊 CSV-based Prediction: Upload CSV files with spectral features for urban classification
🎯 Pre-trained Model: Uses a Random Forest classifier trained on Manila urban data
📈 Interactive Visualizations: Multiple charts and graphs for result analysis
📱 Web Interface: User-friendly Gradio interface
📥 Download Results: Export predictions as CSV files
🌍 Spatial Analysis: Optional geographic coordinate support
🎪 Confidence Scoring: Quality assessment for each prediction
🏗️ Technology Stack
Technology Purpose Version
Python Backend language 3.8+
Gradio Web interface framework ≥3.50.0
Scikit-learn Machine learning library ≥1.0.0
Pandas Data processing ≥1.3.0
NumPy Numerical computations ≥1.21.0
Matplotlib Data visualization ≥3.5.0
Pickle Model serialization Built-in
Hugging Face Deployment platform -
📋 Required CSV Format
Essential Columns:
We evaluated five models (Logistic Regression, Random Forest, Decision Tree, K-Nearest Neighbors, and SVC) using Randomized Search with 5-fold cross-validation, optimizing for F1 score.
Best Model: Random Forest Classifier
Best Parameters: 200 estimators, max depth = 20, min samples split = 5, min samples leaf = 4
The Random Forest model demonstrated near-perfect performance with only 4 errors out of 10,000 samples (0.04%), all of which were false urban classifications. No false non-urban errors were observed.
This indicates that the model is highly reliable for detecting urban expansion in Manila, though a slight threshold adjustment may reduce false positives further.
Downloadable Files:
Complete results CSV with all predictions
Preserves all original input data plus predictions
🎮 How to Use
Prepare Your Data:
Collect spectral data from Landsat imagery
Calculate required indices (NDVI, NDBI, NDWI)
Format as CSV with expected column names
Run Prediction:
Upload CSV file through the web interface
Click "Predict Urban Areas"
View interactive results and visualizations
Analyze Results:
Review prediction statistics
Examine confidence levels
Download results for further analysis
Interpret Results:
Urban areas: High NDBI, moderate brightness
Non-urban: High NDVI (vegetation) or other features
Confidence scores indicate prediction reliability
🔧 Customization
Modifying Expected Features:
Edit the expected_features list in app.py: