I am trying to use pre trained VGG16 with SRGAN and grayscale images when I use the VGG16 in this way:
def build_vgg():
input_shape = (256, 256, 3)
# Load a pre-trained VGG19 model trained on 'Imagenet' dataset
vgg = VGG19(weights="imagenet",include_top=False,
input_shape=input_shape)
vgg.trainable = False
return Model(inputs=vgg.inputs, outputs=vgg.layers[10].output)
my model work without any problem and gave grayscale images but when trying to frees the layers of VGG16 and train some layes like this code:
def build_vgg():
"""
Build the VGG network to extract image features
"""
input_shape = (256, 256, 3)
vgg = VGG19(weights='imagenet', include_top=False, input_shape=input_shape)
# Set the layers to be frozen
for layer in vgg.layers[:8]:
layer.trainable = False
# Set the layers to be trainable
for layer in vgg.layers[8:]:
layer.trainable = True
output_layer = vgg.get_layer('block5_conv4').output
input_layer = vgg.input
print(vgg.summary())
model = Model(input_layer, output_layer)
return model
The generated images be like have blue filter and some time brown filter or all generated images in blue. why this happen and how can I fine tune the VGG16 with gray images??