Aerial AI
Semantic and instance segmentation for buildings, roads, water, and solar panels in aerial imagery.
Aerial AI identifies structures and land features in aerial imagery. It combines semantic segmentation for buildings, roads, and water with instance segmentation for individual solar panels, then exposes both tasks through a Streamlit inference interface.
Datasets
- Aerial Segmentation (Kaggle): RGB aerial images and class masks for semantic segmentation
- Solar Plants Brazil: TIFF imagery and binary masks for solar-panel instances
- Indian demo set: Sample aerial TIFF images used for testing and inference
Models
- Semantic segmentation: SegFormer, initialised from
nvidia/segformer-b1-finetuned-cityscapes-1024-1024 - Instance segmentation: Mask2Former, initialised from
facebook/mask2former-swin-base-coco-instance
The best fine-tuned checkpoints are stored in output/semantic/best_model and output/instance/best_model.
Workflow
- Preparation scripts download and organise the data into training and validation sets.
train_semantic.pyfine-tunes SegFormer for buildings, roads, and water.train_instance.pyfine-tunes Mask2Former for solar-panel instances.app.pyloads the selected checkpoint and runs inference.- Streamlit displays the segmentation overlay and summary statistics.
Inference Interface

Demo
Train the Models
# Train both models on Windows
train_all.bat
# Or train individually
python train_semantic.py --train_image_dir ./data/aerial_segmentation/train/images --train_mask_dir ./data/aerial_segmentation/train/masks --val_image_dir ./data/aerial_segmentation/val/images --val_mask_dir ./data/aerial_segmentation/val/masks
python train_instance.py --train_image_dir ./data/solar_panels/train/images --train_mask_dir ./data/solar_panels/train/masks --val_image_dir ./data/solar_panels/val/images --val_mask_dir ./data/solar_panels/val/masksRun the Interface
streamlit run app.pySource code: aerial_AI