The function that performs style_transfer is quite long so we will present it in sections. Its signature is as follows:
def run_style_transfer(content_path, style_path, number_of_iterations=1000, content_weight=1e3, style_weight=1e-2):
Since we don't want to actually train any layers in our model, just use the output values from the layers as described previously; we set their trainable properties accordingly:
model = get_model() for layer in model.layers: layer.trainable = False
Next, we get the style_features and content_features representations from the layers of our model, using the function previously defined:
style_features, content_features = get_feature_representations(model, content_path, style_path) ...