This assignment demonstrates two segmentation approaches described in the accompanying paper:
- Triple-scale model training – three networks (Big, Medium, Small) trained jointly.
- Multi-Head model – a single backbone with three parallel heads (Big, Medium, Small).
Everything you need to reproduce the experiments is already in the repository; just make sure the Cityscapes dataset is in the expected folders.
| Path | Purpose |
|---|---|
final_assignment/train.py |
Launches triple-scale training. |
final_assignment/models/ |
Pre-defined model architectures: big.pth, medium.pth, small.pth. |
final_assignment/Multiheadmodel/ |
Code for the Multi-Head model. |
final_assignment/data/cityscapes/gtFine/ |
Cityscapes ground-truth masks (download separately). |
final_assignment/data/cityscapes/leftImg8bit/ |
Cityscapes RGB images (download separately). |
dice_loss.py |
Shared Dice-loss implementation used by all models. |
python final_assignment/train.py
### 3.2 Multi-Head model
python final_assignment/Multiheadmodel/train_multihead.py
Builds one backbone and attaches the three heads (also loaded from models/).
## 4 Prerequisites
Cityscapes dataset – place it exactly like this:
final_assignment/data/cityscapes/
├── gtFine/
└── leftImg8bit/
Python ≥3.8 with torch, torchvision, numpy, tqdm, etc.
## 5 Notes
Modify dice_loss.py to experiment with other loss functions.