forked from open-mmlab/mmagic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
singan_balloons.py
45 lines (39 loc) · 1.18 KB
/
singan_balloons.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
_base_ = ['./singan_fish.py']
# MODEL
num_scales = 8 # start from zero
generator_steps = 3
discriminator_steps = 3
iters_per_scale = 2000
# NOTE: add by user, e.g.:
# test_pkl_data = './work_dirs/singan_pkl/singan_balloons_20210406_191047-8fcd94cf.pkl' # noqa
test_pkl_data = None
model = dict(
num_scales=num_scales,
generator=dict(num_scales=num_scales),
discriminator=dict(num_scales=num_scales),
test_pkl_data=test_pkl_data)
# DATA
pipeline = [
dict(
type='PackEditInputs',
keys=[f'real_scale{i}' for i in range(num_scales)] + ['input_sample'])
]
data_root = './data/singan/balloons.png'
train_dataloader = dict(dataset=dict(data_root=data_root, pipeline=pipeline))
# HOOKS
custom_hooks = [
dict(
type='PickleDataHook',
output_dir='pickle',
interval=-1,
after_run=True,
data_name_list=['noise_weights', 'fixed_noises', 'curr_stage']),
dict(
type='GenVisualizationHook',
interval=5000,
fixed_input=True,
vis_kwargs_list=dict(type='SinGAN', name='balloons'))
]
# TRAINING
total_iters = (num_scales + 1) * iters_per_scale * discriminator_steps
train_cfg = dict(max_iters=total_iters)