Skip to content

DidItWork/PMTrans_openMMSeg

Repository files navigation

PMFormer: Patch-Mix Transformer for Domain-Adaptive Semantic Segmentation

Get Started

Please see Overview for the general introduction of MMSegmentation.

Environment Setup

Please see for Get Started for MMsegmentation environment setup.

Setup Datasets

After unzipping SYNTHIA_RAND_CITYSCAPES dataset into data/synthia, run the following scripts for conversion:

Splitting Synthia Images into Train-Test-Val splits

python tools/dataset_converters/synthia_arange.py data/synthia/

Formating Synthia Images to be consistent with Cityscapes ones

python tools/dataset_converters/synthia_2_cityscape.py data/synthia/GT

The final folder structure should look like this:

DAFormer
├── ...
├── data
│   ├── cityscapes
│   │   ├── leftImg8bit
│   │   │   ├── test
│   │   │   ├── train
│   │   │   ├── val
│   │   ├── gtFine
│   │   │   ├── test
│   │   │   ├── train
│   │   │   ├── val
│   ├── gta
│   │   ├── images
│   │   ├── labels
│   ├── synthia
│   │   ├── RGB
│   │   ├── GT
│   │   │   ├── LABELS
├── ...

Pseudo Labelling

python target_labelling.py data/cityscapes/leftImg8bit
By default, the script looks in work_dirs/segformer_mit-b5_8xb1-40k_synthia-512x512/iter_40000.pth for the model file.

Training PMTrans

python tools/train.py configs/segformer/pmtrans_mit-b0_8xb1-40k_synthia2cityscapes-256x256.py
Note: You can also replace b0 with desired model size (b1, b2, b3, b4, b5)

Testing PMTrans

python tools/test.py configs/segformer/pmtrans_mit-b0_8xb1-40k_synthia2cityscapes-256x256.py work_dirs/pmtrans_mit-b0_8xb1-40k_synthia2cityscapes-256x256/iter_[iteration].pth --show

File Locations

About

Patch-Mix Transformer implemented on openmmsegmentation

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages