@@ -161,7 +161,7 @@ def __init__(
161
161
input_nc ,
162
162
output_nc ,
163
163
D_num_downs ,
164
- ngf = 64 ,
164
+ D_ngf = 64 ,
165
165
norm_layer = nn .BatchNorm2d ,
166
166
use_dropout = False ,
167
167
):
@@ -171,7 +171,7 @@ def __init__(
171
171
output_nc (int) -- the number of channels in output images
172
172
D_num_downs (int) -- the number of downsamplings in UNet. For example, # if |num_downs| == 7,
173
173
image of size 128x128 will become of size 1x1 # at the bottleneck
174
- ngf (int) -- the number of filters in the last conv layer, here ngf=64, so inner_nc=64*8=512
174
+ D_ngf (int) -- the number of filters in the last conv layer, here ngf=64, so inner_nc=64*8=512
175
175
norm_layer -- normalization layer
176
176
177
177
We construct the U-Net from the innermost layer to the outermost layer.
@@ -181,8 +181,8 @@ def __init__(
181
181
# construct unet structure
182
182
# add the innermost layer
183
183
unet_block = UnetSkipConnectionBlock (
184
- ngf * 8 ,
185
- ngf * 8 ,
184
+ D_ngf * 8 ,
185
+ D_ngf * 8 ,
186
186
input_nc = None ,
187
187
submodule = None ,
188
188
norm_layer = norm_layer ,
@@ -191,28 +191,36 @@ def __init__(
191
191
# add intermediate layers with ngf * 8 filters
192
192
for i in range (num_downs - 5 ): # add intermediate layers with ngf * 8 filters
193
193
unet_block = UnetSkipConnectionBlock (
194
- ngf * 8 ,
195
- ngf * 8 ,
194
+ D_ngf * 8 ,
195
+ D_ngf * 8 ,
196
196
input_nc = None ,
197
197
submodule = unet_block ,
198
198
norm_layer = norm_layer ,
199
199
use_dropout = use_dropout ,
200
200
)
201
201
# gradually reduce the number of filters from ngf * 8 to ngf
202
202
unet_block = UnetSkipConnectionBlock (
203
- ngf * 4 , ngf * 8 , input_nc = None , submodule = unet_block , norm_layer = norm_layer
203
+ D_ngf * 4 ,
204
+ D_ngf * 8 ,
205
+ input_nc = None ,
206
+ submodule = unet_block ,
207
+ norm_layer = norm_layer ,
204
208
)
205
209
unet_block = UnetSkipConnectionBlock (
206
- ngf * 2 , ngf * 4 , input_nc = None , submodule = unet_block , norm_layer = norm_layer
210
+ D_ngf * 2 ,
211
+ D_ngf * 4 ,
212
+ input_nc = None ,
213
+ submodule = unet_block ,
214
+ norm_layer = norm_layer ,
207
215
)
208
216
unet_block = UnetSkipConnectionBlock (
209
- ngf , ngf * 2 , input_nc = None , submodule = unet_block , norm_layer = norm_layer
217
+ D_ngf , D_ngf * 2 , input_nc = None , submodule = unet_block , norm_layer = norm_layer
210
218
)
211
219
212
220
# add the outermost layer
213
221
self .model = UnetSkipConnectionBlock (
214
222
output_nc ,
215
- ngf ,
223
+ D_ngf ,
216
224
input_nc = input_nc ,
217
225
submodule = unet_block ,
218
226
outermost = True ,
0 commit comments