From 521d18ea11cd95d89e90fa002fab3a3efd02ad5d Mon Sep 17 00:00:00 2001 From: Tiago Freitas Pereira <tiagofrepereira@gmail.com> Date: Fri, 13 Jul 2018 15:04:34 +0200 Subject: [PATCH] Improved the --help --- bob/learn/tensorflow/script/style_transfer.py | 61 ++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/bob/learn/tensorflow/script/style_transfer.py b/bob/learn/tensorflow/script/style_transfer.py index 50e5c003..1cece002 100644 --- a/bob/learn/tensorflow/script/style_transfer.py +++ b/bob/learn/tensorflow/script/style_transfer.py @@ -98,10 +98,69 @@ def style_transfer(content_image_path, output_path, style_image_paths, content_weight, style_weight, denoise_weight, content_end_points, style_end_points, scopes, pure_noise, **kwargs): """ - Trains neural style transfer from + Trains neural style transfer using the approach presented in: Gatys, Leon A., Alexander S. Ecker, and Matthias Bethge. "A neural algorithm of artistic style." arXiv preprint arXiv:1508.06576 (2015). + \b + + If you want run a style transfer using InceptionV2 as basis folo + + Below follow a CONFIG template + + CONFIG.PY + ``` + + from bob.extension import rc + + from bob.learn.tensorflow.network import inception_resnet_v2_batch_norm + architecture = inception_resnet_v2_batch_norm + + checkpoint_dir = rc["bob.bio.face_ongoing.idiap_casia_inception_v2_centerloss_rgb"] + + style_end_points = ["Conv2d_1a_3x3", "Conv2d_2b_3x3", "Conv2d_3b_1x1", "Conv2d_4a_3x3"] + + content_end_points = ["Bottleneck", "PreLogitsFlatten"] + + scopes = {"InceptionResnetV2/":"InceptionResnetV2/"} + + ``` + \b + + Then run:: + + $ bob tf style <content-image> <output-image> --style-image-paths <style-image> CONFIG.py + + + You can also provide a list of images to encode the style using the config file as in the example below. + + CONFIG.PY + ``` + + from bob.extension import rc + + from bob.learn.tensorflow.network import inception_resnet_v2_batch_norm + architecture = inception_resnet_v2_batch_norm + + checkpoint_dir = rc["bob.bio.face_ongoing.idiap_casia_inception_v2_centerloss_rgb"] + + style_end_points = ["Conv2d_1a_3x3", "Conv2d_2b_3x3", "Conv2d_3b_1x1", "Conv2d_4a_3x3"] + + content_end_points = ["Bottleneck", "PreLogitsFlatten"] + + scopes = {"InceptionResnetV2/":"InceptionResnetV2/"} + + style_image_paths = ["STYLE_1.png", + "STYLE_2.png"] + + ``` + + Then run:: + + $ bob tf style <content-image> <output-image> CONFIG.py + + \b \b + """ # Reading and converting to the tensorflow format -- GitLab