# Africa Segmentation Benchmarks
Satellite segmentation benchmark pipeline.
## Layout
```
data/ → images/, gray/, annotations/ per split
train|val|test|whole_data/
images/ RGB satellite tiles
gray/ ground-truth class-id masks
annotations/ RGB color masks for visualization
configs/
classes.yaml → class ids, colors, SAM3 prompts
dataset.yaml → split paths
inference/*.yaml → per-model configs
results/ → predictions and metrics per run
{run_name}/{split}/
masks_gray/
masks_rgb/
metrics/
scripts/
run_inference.py → run any model on a split
run_metrics.py → compare predictions against ground truth
slurm/ → HPC batch scripts
src/africa_benchmark/
inference/adapters/ → one file per model (sam3_concept.py, gemini.py, ...)
```
## How to
### 1. Install dependencies into a Singularity overlay (HPC)
```bash
# SAM3 needs an overlay with torch 2.10 + CUDA 12.8 -
sbatch --export=ALL,INSTALL_SAM3=1,INSTALL_SAM2=0 scripts/slurm/install_to_overlay.sbatch
```
### 2. Run benchmarks
```bash
# SAM3
sbatch --export=ALL,MODEL_CONFIG=configs/inference/sam3_concept.yaml,RUN_NAME=sam3_concept,SPLITS="val test",HF_TOKEN="YOUR_TOKEN_HERE" scripts/slurm/run_split_benchmark.sbatch
# Gemini
sbatch --export=ALL,MODEL_CONFIG=configs/inference/gemini.yaml,RUN_NAME=gemini,SPLITS="val test",GEMINI_API_KEY="YOUR_API_KEY_HERE" scripts/slurm/run_split_benchmark.sbatch
```
Results land in `results/{run_name}/{split}/masks_gray/`. Metrics are under `results/{run_name}/{split}/metrics/`.