ftokarev / tf-adain Goto Github PK
View Code? Open in Web Editor NEWTensorFlow implementation of the paper "Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization" by Xun Huang and Serge Belongie
License: MIT License
TensorFlow implementation of the paper "Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization" by Xun Huang and Serge Belongie
License: MIT License
Hi,
Could you please provide an example on how to use a trained model on our own dataset?
I am taking the following steps:
Thank you in advance.
Could you provide the last checkpoint please to resume it in training process ?
19/5000
I have encountered this error when I run test.py with cpu:
ValueError: Cannot feed value of shape (2, 3, 380, 600) for Tensor 'Placeholder:0', which has shape '(?, ?, ?, 3)'
Hi,
In test.py
in CPU mode the call to prepare_image
line (178 and 179) returns wrong image shape due to wrong data_format
.
To fix just pass the data_format
para:
style_image = prepare_image(style_image, True, data_format)
content_image = prepare_image(content_image, True, data_format)
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1356, in _do_call
return fn(*args)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1341, in _run_fn
options, feed_dict, fetch_list, target_list, run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1429, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU
[[{{node vgg/pool1/MaxPool}}]]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 274, in
style_transfer(**vars(args))
File "test.py", line 181, in style_transfer
image: style_image[np.newaxis,:]
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 950, in run
run_metadata_ptr)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1173, in _run
feed_dict_tensor, options, run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1350, in _do_run
run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1370, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU
[[node vgg/pool1/MaxPool (defined at /tmp/tmpsb0fdgud.py:30) ]]
Errors may have originated from an input operation.
Input Source operations connected to node vgg/pool1/MaxPool:
vgg/conv1_2/Relu (defined at /tmp/tmp649k6325.py:74)
Original stack trace for 'vgg/pool1/MaxPool':
File "test.py", line 274, in
style_transfer(**vars(args))
File "test.py", line 83, in style_transfer
decoder_weights if decoder_in_h5 else None, alpha, data_format=data_format)
File "test.py", line 216, in build_graph
vgg = build_vgg(image, w, data_format=data_format)
File "/home/nd/workspace/workspace_lsh/tf-adain/adain/nn.py", line 54, in build_vgg
activation=tf.nn.relu, trainable=False, data_format=data_format)
File "/home/nd/workspace/workspace_lsh/tf-adain/adain/nn.py", line 102, in build_net
data_format=data_format)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 324, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/layers/pooling.py", line 311, in max_pooling2d
return layer.apply(inputs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/engine/base_layer.py", line 1479, in apply
return self.call(inputs, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/layers/base.py", line 537, in call
outputs = super(Layer, self).call(inputs, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/engine/base_layer.py", line 634, in call
outputs = call_fn(inputs, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/autograph/impl/api.py", line 146, in wrapper
), args, kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/autograph/impl/api.py", line 450, in converted_call
result = converted_f(*effective_args, **kwargs)
File "/tmp/tmpsb0fdgud.py", line 30, in tf__call
outputs = ag.converted_call('pool_function', self, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (inputs,), {'ksize': pool_shape, 'strides': strides, 'padding': ag__.converted_call('upper', self.padding, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (), None), 'data_format': ag__.converted_call('convert_data_format', conv_utils, ag__.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (self.data_format, 4), None)})
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/autograph/impl/api.py", line 356, in converted_call
return _call_unconverted(f, args, kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/autograph/impl/api.py", line 253, in _call_unconverted
return f(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/nn_ops.py", line 3756, in max_pool
name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_nn_ops.py", line 5672, in max_pool
data_format=data_format, name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/util/deprecation.py", line 507, in new_func
return func(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 3616, in create_op
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2005, in init
self._traceback = tf_stack.extract_stack()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.