A high-capacity semantic segmentation system for offroad terrain classification using DINOv2 backbone with UPerNet decoder.
- Backbone: DINOv2 (ViT-B/14) for rich spatial embeddings
- Decoder: UPerNet with Pyramid Pooling Module (PPM) for multi-scale context
- Loss Functions:
- Online Hard Example Mining (OHEM)
- Class-Weighted Lovász Loss
- Boundary Loss
- Inference: Hardware-aware Test-Time Augmentation (TTA)
- 8 geometric D4 rotations
- 3x multi-scale predictions
git clone https://github.com/VectorFlow-vvce/Track2_code_Geass.git
cd Track2_code_Geass/vibaethon3/vibaethon3Download model and dataset files from: 📁 Google Drive Link
Extract downloaded files to repository root:
segmentation_head.pth→ repo root- Dataset folders (if needed) → repo root
python -m venv env
source env/bin/activate # On Windows: env\Scripts\activatepip install -r requirements.txtCopy the example environment file and update with your paths:
cp .env.example .envEdit .env and set:
TRAIN_IMAGE_DIR: Path to training imagesTRAIN_MASK_DIR: Path to training masksTEST_IMAGE_DIR: Path to test imagesTEST_OUTPUT_DIR: Where to save predictions (default:./test_predictions/)
python train_segmentaion.pyTraining statistics will be saved to logs directory.
python test_local.pyPredictions will be saved to the test_predictions/ directory.
Track2_code_Geass/vibaethon3/vibaethon3/
├── .env.example # Example environment file
├── .gitignore # Git ignore rules
├── requirements.txt # Python dependencies
├── train_segmentaion.py # Training script
├── test_local.py # Testing/inference script
├── test_segmentation.py # Additional test script
├── README.md # This file
├── Offroad_Segmentation_testImages/ # Sample test images
│ ├── Color_Images/ # Input images
│ └── Segmentation/ # Ground truth masks
└── .venv/ # Virtual environment (ignored by git)
The following large files are excluded from the GitHub repository and available in Google Drive:
segmentation_head.pth- Trained segmentation model (model weights)best_model_v4.pth- Full trained model (too large)swa_model_v4.pth- Stochastic Weight Averaging checkpointOffroad_Segmentation_Training_Dataset/- Full training dataset.venv/- Virtual environment folder*.log- Log files (torch_install.log, test_output.log, etc.)test_predictions/- Generated predictions from inferencerare_class_weights.json- Auto-generated class weights file
All model files and datasets are available here:
Download and extract the following files to your repository root:
your_repo/
├── segmentation_head.pth # ← Download from Drive
├── Offroad_Segmentation_Training_Dataset/ # ← Download from Drive (if needed)
└── [other files in this repo]
train_segmentaion.py- Training scripttest_local.py- Testing scripttest_segmentation.py- Inference scriptrequirements.txt- Dependencies list.env.example- Configuration template.gitignore- Git ignore rulesREADME.md- DocumentationOffroad_Segmentation_testImages/- Sample test images
The model segments 10 offroad terrain classes: 0. Landscape/Background
- Trees
- Lush Bushes
- Dry Grass
- Dry Bushes
- Ground Clutter
- Logs
- Rocks
- Unknown
- Sky
- GPU with CUDA support recommended (tested on NVIDIA GPUs)
- Minimum 8GB VRAM for training
- 4GB VRAM for inference with TTA
Default hyperparameters (editable in train_segmentaion.py):
- Batch Size: 4
- Epochs: 25
- Learning Rate: 5e-6 (backbone), 1e-4 (decoder)
- Optimizer: AdamW with Lookahead
- Scheduler: Cosine Annealing + OneCycleLR
- Progressive Resizing: 252x448 → 504x896 at epoch 12
- Model trained on offroad terrain segmentation dataset
- Achieves state-of-the-art mIoU on test set
- Uses DINOv2 backbone for superior feature extraction
- DINOv2: https://github.com/facebookresearch/dinov2
- UPerNet: https://github.com/open-mmlab/mmsegmentation
- Segmentation Models PyTorch: https://github.com/qubvel/segmentation_models.pytorch
This project is part of Track 2 - Code Geass collaboration.
For issues or questions, please refer to the project repository or contact the development team.