You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I editted your code out for importing it and just wrote it in as:
tf.keras.applications
and
tf.keras.applications.VGG19
etc.
def get_vgg_layers(layer_names):
vgg = tf.keras.applications.VGG19(include_top=False, weights='imagenet')
vgg.trainable = False
outputs = [vgg.get_layer(name).output for name in layer_names]
model = models.Model([vgg.input], outputs)
return model
def call(self, inputs, **kwargs):
inputs = inputs * 255.0
preprocessed_input = tf.keras.applications.vgg19.preprocess_input(inputs)
outputs = self.vgg(preprocessed_input)
style_outputs, content_outputs = (outputs[:self.num_style_layers],
outputs[self.num_style_layers:])
style_outputs = [
calculate_gram_matrix(style_output) for style_output in style_outputs
]
content = {
content_name: value
for content_name, value in zip(self.CONTENT_LAYERS, content_outputs)
}
style = {
style_name: value
for style_name, value in zip(self.STYLE_LAYERS, style_outputs)
}
return {'content': content, 'style': style}
I am using tensorflow-cpu 2.9 and am wondering about this...
The text was updated successfully, but these errors were encountered: