All training checkpoints, backup runs, and the full dataset are hosted on Google Drive.
β Access the Full Project Drive Folder
The Drive contains:
Offroad_Segmentation_Training_Dataset/β official train / val / test splitsoffroad_project_backup/β all Colab training runs and checkpoint historyCodeWizards_Offroad_Submission/β this submission package
We tackle Duality AI's Offroad Semantic Scene Segmentation challenge β classifying every pixel of synthetic desert RGB images into 10 terrain classes using the Falcon digital-twin pipeline.
Our solution fine-tunes SegFormer-B2 (nvidia/mit-b2, ImageNet-22k pretrained) with:
- Median-frequency class weighting to handle severe pixel imbalance
- Strong colour + geometric augmentation for domain robustness
- Mixed-precision (AMP) training for GPU efficiency
- Multi-scale + horizontal flip TTA at inference β boosting mIoU without touching test labels
| Setting | Value |
|---|---|
| Backbone | nvidia/mit-b2 |
| Classes | 10 terrain classes |
| Image size | 512 Γ 512 |
| Optimizer | AdamW (lr=6e-5, wd=0.01) |
| Epochs | 60 |
| Val mIoU (flip TTA) | ~0.658 |
| Val mIoU (multi-scale + flip TTA) | ~0.662 |
| Rule | Practice |
|---|---|
Train only on train/ (+ val/ for metrics) |
β Yes |
Never train or tune using testImages/ labels |
β Test folder has RGB only β no masks used |
| Outputs use official class IDs in PNGs | β
Saved as uint16 with values 100, 200, β¦ 10000 |
Duality-AI-main/
βββ README.md
βββ requirements.txt
βββ SUBMISSION_CHECKLIST.md
βββ run_evaluate.bat β Windows shortcut
βββ run_test.bat β Windows shortcut
β
βββ configs/
β βββ config.yaml β Default: Google Colab / Drive paths
β βββ config.windows.yaml β Local Windows (P:\ drive) paths
β
βββ src/
β βββ dataset.py β Custom Dataset + Albumentations augmentation
β βββ model.py β SegFormerWrapper + checkpoint normalization
β βββ train.py β Training loop (AMP, checkpointing, resume)
β βββ test.py β Inference + multi-scale TTA β uint16 PNGs
β βββ evaluate.py β Quick per-epoch mIoU
β βββ evaluate_full.py β Full report: mIoU, confusion matrix, per-class IoU
β βββ eda.py β Class distribution analysis
β βββ bench_infer.py β Latency benchmark (median ms)
β βββ visualize.py β Side-by-side prediction panels
β
βββ runs/
β βββ checkpoints/ β Place best_model.pth here (copy from Drive backup)
β βββ training_curves.png
β βββ confusion_matrix.png
β βββ per_class_iou.png
β βββ class_distribution.png
β
βββ predictions/ β Output: <stem>_pred.png (uint16, official IDs)
β
βββ report/
βββ CODEWIZARDS_REPORT.md
βββ CODEWIZARDS_REPORT.docx
- Python 3.10 (Miniconda / Anaconda recommended)
- NVIDIA GPU with CUDA (for training); CPU inference is possible but slow
conda create -n EDU python=3.10 -y
conda activate EDU
cd CodeWizards_Offroad_Submission
pip install -r requirements.txtpip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118python -c "import torch; print(torch.cuda.is_available(), torch.cuda.get_device_name(0) if torch.cuda.is_available() else 'CPU only')"Two config files are provided under configs/. Copy the right one to configs/config.yaml before running.
configs/config.yaml is pre-configured for Colab after mounting Drive:
data:
train_rgb: "/content/drive/MyDrive/Offroad_Project/Offroad_Segmentation_Training_Dataset/train/Color_Images"
train_masks: "/content/drive/MyDrive/Offroad_Project/Offroad_Segmentation_Training_Dataset/train/Segmentation"
val_rgb: "/content/drive/MyDrive/Offroad_Project/Offroad_Segmentation_Training_Dataset/val/Color_Images"
val_masks: "/content/drive/MyDrive/Offroad_Project/Offroad_Segmentation_Training_Dataset/val/Segmentation"
test_rgb: "/content/drive/MyDrive/Offroad_Project/Offroad_Segmentation_Training_Dataset/testImages"Shared Drive note: If the dataset is "Shared with me", right-click
Offroad_Projectβ Add shortcut to Drive so theMyDrive/...path resolves in Colab.
# Copy windows config over the default
copy configs\config.windows.yaml configs\config.yamldata:
train_rgb: "P:/SRM Hackathon/Offroad_Segmentation_Training_Dataset/train/Color_Images"
# ... adjust P:\ paths to your local extractfrom google.colab import drive
drive.mount('/content/drive')%cd /content/drive/MyDrive/Offroad_Project/CodeWizards_Offroad_Submission
!pip install -r requirements.txt
!python src/evaluate_full.pyAlways run commands from the
CodeWizards_Offroad_Submissionroot soruns/checkpointsresolves correctly.
Training saves checkpoints to offroad_project_backup/ on Drive. Copy your best checkpoint into this repo:
runs/checkpoints/best_model.pth
Supported checkpoint formats (all handled automatically by normalize_training_state_dict() in src/model.py):
| Source | Key prefix | Handled? |
|---|---|---|
This repo's train.py |
model.segformer.* |
β |
| Colab / Hugging Face raw | segformer.*, decode_head.* |
β auto-remapped |
| DDP multi-GPU | module.* prefix |
β stripped |
Run all commands from the project root.
| Task | Command |
|---|---|
| Class distribution analysis | python src/eda.py |
| Training (if re-running) | python src/train.py |
| Full validation report (mIoU + plots) | python src/evaluate_full.py |
| Inference speed benchmark | python src/bench_infer.py |
| Generate test predictions | python src/test.py |
| Visualize predictions (8 samples) | python src/visualize.py --limit 8 |
Outputs:
- Predictions β
predictions/<stem>_pred.png(uint16, official Falcon class IDs) - Plots β
runs/training_curves.png,runs/confusion_matrix.png,runs/per_class_iou.png
Configured in configs/config.yaml under inference::
inference:
use_multiscale_tta: true # Multi-scale + flip averaging (recommended)
tta_scales: [448, 512, 576] # Reduce if GPU OOM (remove largest scale)TTA recommendation: Keep
use_multiscale_tta: truefor submission-quality predictions. It provides a ~0.4% mIoU gain over single-scale without touching any test labels.
| Raw Falcon ID | Class | Notes |
|---|---|---|
100 |
Trees | Sparse vegetation |
200 |
Lush Bushes | Often confused with Dry Bushes |
300 |
Dry Grass | Large region coverage |
500 |
Dry Bushes | Frequent desert vegetation |
550 |
Ground Clutter | Rarest class; hardest to segment |
600 |
Flowers | Small, rare pixels |
700 |
Logs | Thin structures |
800 |
Rocks | High texture diversity |
7100 |
Landscape | Dominant ground cover |
10000 |
Sky | Dominant background |
Internal training uses 0β9 indices with ignore_index=255 for void pixels. Output PNGs encode the original Falcon IDs as uint16.
| Evaluation Mode | mIoU |
|---|---|
Single forward (evaluate_full.py) |
0.6556 |
| Checkpoint metadata (best epoch) | 0.6576 |
| Flip TTA (Colab eval) | ~0.658 |
| Multi-scale + flip TTA | ~0.662 β |
The mIoU improvement from ~0.658 β ~0.662 comes entirely from inference-time ensembling on the same weights β no additional training data or test labels used.
Strongest classes: Sky, Trees, Landscape
Weakest classes: Ground Clutter, Dry Bushes, Rocks (confusion with adjacent texture classes)
-
configs/config.yamlβ all five data paths exist on your machine -
runs/checkpoints/best_model.pthβ final weights copied from Drive backup -
python src/evaluate_full.pyβ completes cleanly; mIoU noted for report -
python src/test.pyβpredictions/has one*_pred.pngper test image -
python src/bench_infer.pyβ median ms recorded for report -
report/CODEWIZARDS_REPORT.mdβ team name filled, PNGs embedded, exported to PDF - Zip folder + PDF β
Vortex_CodeWizards_Submission.zip
| Name | Role |
|---|---|
| Shivanshu Tiwari | Model architecture & training pipeline |
| Anirudh Agarwal | Data augmentation & evaluation |
| Mohammad Raees | Inference, TTA & benchmarking |
| Aditya Gaur | EDA, visualisation & report |
Institution: Ajay Kumar Garg Engineering College
Team Name: Vortex
Event: CodeWizards 2.0 Β· SRMIST Delhi-NCR Β· April 2026
Challenge: Powered by Duality AI β Falcon digital-twin platform