Skip to content

Commit 0c0888e

Browse files
authored
Fixed inconsistant use of filters by implementing generator filter variable.
Variable "self.df" was being correctly used to specify the number of filters in discriminator's layers. But the corresponding variable for the generator's layers "self.gf" was unimplemented and thus was an unused variable. In this update I simply changed the function residual_block() to use the variable self.gf to correctly specify the number of filters in the blocks as intended.
1 parent 2ccd7cd commit 0c0888e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

srgan/srgan.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ def build_vgg(self):
117117

118118
def build_generator(self):
119119

120-
def residual_block(layer_input):
120+
def residual_block(layer_input, filters):
121121
"""Residual block described in paper"""
122-
d = Conv2D(64, kernel_size=3, strides=1, padding='same')(layer_input)
122+
d = Conv2D(filters, kernel_size=3, strides=1, padding='same')(layer_input)
123123
d = Activation('relu')(d)
124124
d = BatchNormalization(momentum=0.8)(d)
125-
d = Conv2D(64, kernel_size=3, strides=1, padding='same')(d)
125+
d = Conv2D(filters, kernel_size=3, strides=1, padding='same')(d)
126126
d = BatchNormalization(momentum=0.8)(d)
127127
d = Add()([d, layer_input])
128128
return d
@@ -144,7 +144,7 @@ def deconv2d(layer_input):
144144
# Propogate through residual blocks
145145
r = residual_block(c1)
146146
for _ in range(self.n_residual_blocks - 1):
147-
r = residual_block(r)
147+
r = residual_block(r, self.gf)
148148

149149
# Post-residual block
150150
c2 = Conv2D(64, kernel_size=3, strides=1, padding='same')(r)

0 commit comments

Comments
 (0)