Skip to content

Commit 34e245c

Browse files
author
Simon Karlsson
authored
Merge pull request #14 from DavidAbramian/master
Fix PatchGAN size in CycleGAN
2 parents fc349ab + 7ea3b66 commit 34e245c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

CycleGAN/CycleGAN.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ def __init__(self, lr_D=2e-4, lr_G=2e-4, image_shape=(304, 256, 1),
245245
#===============================================================================
246246
# Architecture functions
247247

248-
def ck(self, x, k, use_normalization):
249-
x = Conv2D(filters=k, kernel_size=4, strides=2, padding='same')(x)
248+
def ck(self, x, k, use_normalization, stride):
249+
x = Conv2D(filters=k, kernel_size=4, strides=stride, padding='same')(x)
250250
# Normalization is not done on the first discriminator layer
251251
if use_normalization:
252252
x = self.normalization(axis=3, center=True, epsilon=1e-5)(x, training=True)
@@ -308,13 +308,13 @@ def modelDiscriminator(self, name=None):
308308
# Specify input
309309
input_img = Input(shape=self.img_shape)
310310
# Layer 1 (#Instance normalization is not used for this layer)
311-
x = self.ck(input_img, 64, False)
311+
x = self.ck(input_img, 64, False, 2)
312312
# Layer 2
313-
x = self.ck(x, 128, True)
313+
x = self.ck(x, 128, True, 2)
314314
# Layer 3
315-
x = self.ck(x, 256, True)
315+
x = self.ck(x, 256, True, 2)
316316
# Layer 4
317-
x = self.ck(x, 512, True)
317+
x = self.ck(x, 512, True, 1)
318318
# Output layer
319319
if self.use_patchgan:
320320
x = Conv2D(filters=1, kernel_size=4, strides=1, padding='same')(x)

0 commit comments

Comments
 (0)