Contrast, Stylize and Adapt: Unsupervised Contrastive Learning Framework for Domain Adaptive Semantic Segmentation
Our new code is available at https://github.com/cxa9264/CONFETII.
In the newer version, the two-stage training is eliminated to reduce the training complexity.
To overcome the domain gap between synthetic and real-world datasets, unsupervised domain adaptation methods have been proposed for semantic segmentation. Majority of the previous approaches have attempted to reduce the gap either at the pixel or feature level, disregarding the fact that the two components interact positively. To address this, we present CONtrastive FEaTure and pIxel alignment (CONFETI) for bridging the domain gap at both the pixel and feature levels using a unique contrastive formulation. We introduce well-estimated prototypes by including category-wise cross-domain information to link the two alignments: the pixel-level alignment is achieved using the jointly trained style transfer module with the prototypical semantic consistency, while the feature-level alignment is enforced to cross-domain features with the pixel-to-prototype contrast. Our extensive experiments demonstrate that our method outperforms existing state-of-the-art methods using DeepLabV2.
conda create -n confeti python=3.8
conda activate confeti
pip install -r requirements.txt
Download checkpoints and config files from GoogleDrive or BaiduYun (password: 74gd).
python -m tools.test <cfg pth> <ckpt pth>Download GTA5, Cityscapes datasets and SYNTHIA dataset.
Extract datasets to data folder. The folder structure should look like this:
data
├── cityscapes
│ ├── gtFine
│ ├── leftImg8bit
├── gta5
│ ├── images
│ └── labels
└── synthia
├── GT
└── RGB
Put the style transfer model checkpoints in checkpoints folder. The folder structure should look like this:
checkpoints
└── gta2cs_1080_512_2nd
├── latest_net_G.pth
|── latest_net_D.pth
└── latest_net_F.pth
The model that we provide is the one that has already gone through the first round of training.
- First stage
python run_experiments.py --config configs/confeti/confeti_1st.py --name gta2cs_1080_512 --continue_train- Second stage
python run_experiments.py --config configs/confeti/confeti_2nd.py --name gta2cs_1080_512_2nd --continue_train