-
Notifications
You must be signed in to change notification settings - Fork 3
/
csHR2acdcHR_ciss.py
94 lines (93 loc) · 3.67 KB
/
csHR2acdcHR_ciss.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Licensed under the CC BY-NC 4.0 license (https://creativecommons.org/licenses/by-nc/4.0/)
# Default CISS configuration for Cityscapes->ACDC
_base_ = [
'../_base_/default_runtime.py',
# DAFormer network architecture
'../_base_/models/daformer_sepaspp_mitb5.py',
# Cityscapes->ACDC High-Resolution Data Loading with FDA-based stylization
'../_base_/datasets/uda_cityscapesHR_to_acdcHR_1024x1024_fda.py',
# Training with labels on source dataset, pseudo-labels on target dataset and feature invariance losses on both datasets
'../_base_/uda/dacs_a999_fdthings_ciss_src_ceorig_inv_trg_ceorigorig_invorigorigstylizedstylized.py',
# AdamW Optimizer
'../_base_/schedules/adamw.py',
# Linear Learning Rate Warmup with Subsequent Linear Decay
'../_base_/schedules/poly10warm.py'
]
# Random Seed
seed = 0
# CISS Configuration
model = dict(
type='HRDAEncoderDecoder',
decode_head=dict(
type='HRDAHead',
# Use the DAFormer decoder for each scale.
single_scale_head='DAFormerHead',
# Learn a scale attention for each class channel of the prediction.
attention_classwise=True,
# Set the detail loss weight $\lambda_d=0.1$.
hr_loss_weight=0.1),
# Use the full resolution for the detail crop and half the resolution for
# the context crop.
scales=[1, 0.5],
# Use a relative crop size of 0.5 (=512/1024) for the detail crop.
hr_crop_size=[512, 512],
# Use LR features for the Feature Distance as in the original DAFormer.
feature_scale=0.5,
# Make the crop coordinates divisible by 8 (output stride = 4,
# downscale factor = 2) to ensure alignment during fusion.
crop_coord_divisible=8,
# Use overlapping slide inference for detail crops for pseudo-labels.
hr_slide_inference=True,
# Use overlapping slide inference for fused crops during test time.
test_cfg=dict(
mode='slide',
batched_slide=True,
stride=[512, 512],
crop_size=[1024, 1024]))
uda = dict(
# FDA-based stylization.
stylization='fda',
stylize=dict(
inv_loss=dict(
# Feature invariance loss weights set to 50 for source Cityscapes domain and 20 for target ACDC domain.
weight=50.0,
weight_target=20.0
)
)
)
data = dict(
train=dict(
# Rare Class Sampling
rare_class_sampling=dict(
min_pixels=3000, class_temp=0.01, min_crop_ratio=2.0)),
# Use several separate threads/workers for data loading to account for on-the-fly stylization.
workers_per_gpu=16,
# Keep batch size the same as in HRDA.
samples_per_gpu=2)
# Optimizer Hyperparameters
optimizer_config = None
optimizer = dict(
lr=6e-05,
paramwise_cfg=dict(
custom_keys=dict(
head=dict(lr_mult=10.0),
pos_block=dict(decay_mult=0.0),
norm=dict(decay_mult=0.0))))
n_gpus = 1
gpu_model = 'NVIDIAA100_PCIE_80GB'
runner = dict(type='IterBasedRunner', max_iters=40000)
# Logging Configuration
checkpoint_config = dict(by_epoch=False, interval=40000, max_keep_ckpts=1)
evaluation = dict(interval=4000, metric='mIoU', distributed_eval=False, pre_eval=False)
# Meta Information for Result Analysis
name = 'csHR2acdcHR_ciss_s0'
exp = 'basic'
name_dataset = 'cityscapesHR2acdcHR_1024x1024'
name_architecture = 'hrda1-512-0.1_daformer_sepaspp_sl_mitb5'
name_encoder = 'mitb5'
name_decoder = 'hrda1-512-0.1_daformer_sepaspp_sl'
name_uda = 'dacs_a999_fdthings_ciss_src_ceorig_inv_trg_ceorigorig_invorigorigstylizedstylized_rcs0.01-2.0'
name_opt = 'adamw_6e-05_pmTrue_poly10warm_1x2_40k'
first_run = True
resume_from = None
# For the other configurations used in the paper, please refer to experiments.py