-
Notifications
You must be signed in to change notification settings - Fork 1
/
arguments.py
207 lines (192 loc) · 5.64 KB
/
arguments.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import argparse
def get_arguments() -> argparse.Namespace:
parser = argparse.ArgumentParser()
# Inputs
parser.add_argument(
"--prompt", type=str, help="The prompt for the desired editing"
)
parser.add_argument(
"--init_image", type=str,
default="/51.4116, -0.22398, 51.43039, -0.18878_8.png",
help="The path to the source image input"
)
parser.add_argument(
"--mask",
type=str,
default="test.png",
help="The path to the mask to edit with")
parser.add_argument(
'--image_size',
type =int,
default=256
)
parser.add_argument(
"--prompt_h", type=str,
default="A map of commercial region with secondary roads and footway roads and commercial building footprint and office building footprint and pub building footprint.",
help="The prompt for the desired editing"
)
parser.add_argument(
"--prompt_b", type=str,
default="A map of commercial region with secondary roads and footway roads and commercial building footprint and office building footprint and pub building footprint.",
help="The prompt for the desired editing"
)
parser.add_argument(
"--init_image_r", type=str,
default='test.png',
help="The path to the source image input"
)
parser.add_argument(
"--init_image_b", type=str,
default='test.png',
help="The path to the source image input"
)
# Diffusion
parser.add_argument(
"--skip_timesteps",
type=int,
help="How many steps to skip during the diffusion.",
default=25,
)
parser.add_argument(
"--local_clip_guided_diffusion",
help="Indicator for using local CLIP guided diffusion (for baseline comparison)",
action="store_true",
dest="local_clip_guided_diffusion",
)
parser.add_argument(
"--ddim",
help="Indicator for using DDIM instead of DDPM",
action="store_true",
)
# For more details read guided-diffusion/guided_diffusion/respace.py
parser.add_argument(
"--timestep_respacing",
type=str,
help="How to respace the intervals of the diffusion process (number between 1 and 1000).",
default="100",
)
parser.add_argument(
"--model_output_size",
type=int,
help="The resolution of the outputs of the diffusion model",
default=256,
choices=[256, 512],
)
#attributes net
parser.add_argument(
'--lr',
type=float,
help="learning rate",
default=1e-3
)
parser.add_argument(
'--epoch',
type=int,
default=5000,
help='epoch'
)
parser.add_argument(
'--log_dir',
type=str,
default="./log/"
)
parser.add_argument(
'--start_epoch',
type =int,
default=0,
help= 'start epoch, resume'
)
parser.add_argument(\
'--device',
type=str,
default='cuda:0'
)
# Augmentations
parser.add_argument("--aug_num", type=int, help="The number of augmentation", default=8)
# Loss
parser.add_argument(
"--clip_guidance_lambda",
type=float,
help="Controls how much the image should look like the prompt",
default=100,
)
parser.add_argument(
"--range_lambda",
type=float,
help="Controls how far out of range RGB values are allowed to be",
default=50,
)
parser.add_argument(
"--lpips_sim_lambda",
type=float,
help="The LPIPS similarity to the input image",
default=100,
)
parser.add_argument(
"--l2_sim_lambda", type=float, help="The L2 similarity to the input image", default=10000,
)
parser.add_argument(
"--background_preservation_loss",
help="Indicator for using the background preservation loss",
action="store_true",
)
parser.add_argument(
'--reconstruct_lambda',
type=float,
default=100
)
parser.add_argument(
'--target_factor',
type=float,
default=9,
)
parser.add_argument(
'--foorprint_lambda',
type=float,
default=100,
)
# Mask
parser.add_argument(
"--invert_mask",
help="Indicator for mask inversion",
action="store_true",
dest="invert_mask",
)
parser.add_argument(
"--no_enforce_background",
help="Indicator disabling the last background enforcement",
action="store_false",
dest="enforce_background",
)
# Misc
parser.add_argument("--seed", type=int, help="The random seed", default=404)
parser.add_argument("--gpu_id", type=int, help="The GPU ID", default=2)
parser.add_argument("--output_path", type=str, default="valid/")
parser.add_argument(
"-o",
"--output_file",
type=str,
help="The filename to save, must be png",
default="output.png",
)
parser.add_argument("--iterations_num", type=int, help="The number of iterations", default=5)
parser.add_argument(
"--batch_size",
type=int,
help="The number number if images to sample each diffusion process",
default=1,
)
parser.add_argument(
"--vid",
help="Indicator for saving the video of the diffusion process",
action="store_true",
dest="save_video",
)
parser.add_argument(
"--export_assets",
help="Indicator for saving raw assets of the prediction",
action="store_true",
dest="export_assets",
)
args = parser.parse_args()
return args