Skip to content

Commit

Permalink
Correcting filter size typo (keras-team#288)
Browse files Browse the repository at this point in the history
* Correcting filter size typo

At the "Build the generators" the last layer is said to have `filter size of 1` but actually, it also has `filter size of 7` as the first layer, it has `stride size of 1` what may have caused the typo.

* Missing parameter at "GANMonitor"

At the `GANMonitor` class it is being used hardcoded `4` but there is actually a paramter defined at the `__intit__` `num_img` that could be used there, I think that this was the initial purpose.

* Filter size typo and "GANMonitor" parameter

Filter size typo
 - At the "Build the generators" the last layer is said to have `filter size of 1` but actually, it also has `filter size of 7` as the first layer, it has `stride size of 1` what may have caused the typo.

"GANMonitor" parameter
 - At the `GANMonitor` class it is being used hardcoded `4` but there is actually a parameter defined at the `__intit__` `num_img` that could be used there, I think that this was the initial purpose.

* Filter size typo and "GANMonitor" parameter (.md)

Filter size typo
 - At the "Build the generators" the last layer is said to have `filter size of 1` but actually, it also has `filter size of 7` as the first layer, it has `stride size of 1` what may have caused the typo.

"GANMonitor" parameter
 - At the `GANMonitor` class it is being used hardcoded `4` but there is actually a parameter defined at the `__intit__` `num_img` that could be used there, I think that this was the initial purpose.
  • Loading branch information
dimitreOliveira authored Oct 31, 2020
1 parent c874c5b commit 782069e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions examples/generative/cyclegan.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def upsample(
u128 ====|
|-> 2 upsampling blocks
u64 ====|
c7s1-3 => Last conv block with `tanh` activation, filter size of 1.
c7s1-3 => Last conv block with `tanh` activation, filter size of 7.
```
"""

Expand Down Expand Up @@ -542,7 +542,7 @@ def __init__(self, num_img=4):

def on_epoch_end(self, epoch, logs=None):
_, ax = plt.subplots(4, 2, figsize=(12, 12))
for i, img in enumerate(test_horses.take(4)):
for i, img in enumerate(test_horses.take(self.num_img)):
prediction = self.model.gen_G(img)[0].numpy()
prediction = (prediction * 127.5 + 127.5).astype(np.uint8)
img = (img[0] * 127.5 + 127.5).numpy().astype(np.uint8)
Expand Down
6 changes: 3 additions & 3 deletions examples/generative/ipynb/cyclegan.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
"u128 ====|\n",
" |-> 2 upsampling blocks\n",
"u64 ====|\n",
"c7s1-3 => Last conv block with `tanh` activation, filter size of 1.\n",
"c7s1-3 => Last conv block with `tanh` activation, filter size of 7.\n",
"```"
]
},
Expand Down Expand Up @@ -680,7 +680,7 @@
"\n",
" def on_epoch_end(self, epoch, logs=None):\n",
" _, ax = plt.subplots(4, 2, figsize=(12, 12))\n",
" for i, img in enumerate(test_horses.take(4)):\n",
" for i, img in enumerate(test_horses.take(self.num_img)):\n",
" prediction = self.model.gen_G(img)[0].numpy()\n",
" prediction = (prediction * 127.5 + 127.5).astype(np.uint8)\n",
" img = (img[0] * 127.5 + 127.5).numpy().astype(np.uint8)\n",
Expand Down Expand Up @@ -863,4 +863,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}
4 changes: 2 additions & 2 deletions examples/generative/md/cyclegan.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ R256 ====|
u128 ====|
|-> 2 upsampling blocks
u64 ====|
c7s1-3 => Last conv block with `tanh` activation, filter size of 1.
c7s1-3 => Last conv block with `tanh` activation, filter size of 7.
```


Expand Down Expand Up @@ -566,7 +566,7 @@ class GANMonitor(keras.callbacks.Callback):

def on_epoch_end(self, epoch, logs=None):
_, ax = plt.subplots(4, 2, figsize=(12, 12))
for i, img in enumerate(test_horses.take(4)):
for i, img in enumerate(test_horses.take(self.num_img)):
prediction = self.model.gen_G(img)[0].numpy()
prediction = (prediction * 127.5 + 127.5).astype(np.uint8)
img = (img[0] * 127.5 + 127.5).numpy().astype(np.uint8)
Expand Down

0 comments on commit 782069e

Please sign in to comment.