ShafeenTejani / fast-style-transfer

A TensorFlow implementation of real-time style transfer based on the paper 'Perceptual Losses for Real-Time Style Transfer and Super-Resolution' by Johnson et. al
GNU General Public License v3.0
156 stars 51 forks source link

Dimension must equal #8

Open wel3kxial opened 6 years ago

wel3kxial commented 6 years ago

Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/common_shapes.py", line 686, in _call_cpp_shape_fn_impl input_tensors_as_shapes, status) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py", line 473, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimensions must be equal, but are 318 and 320 for 'add_37' (op: 'Add') with input shapes: [4,318,500,3], [4,320,500,3].

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train_network.py", line 148, in main() File "train_network.py", line 123, in main device=device) File "/home/ubuntu/fst/fast-style-transfer/fast_style_transfer.py", line 91, in init self.stylized_image = transform.net(self.input_batch) File "/home/ubuntu/fst/fast-style-transfer/transform.py", line 21, in net output = image + preds File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/math_ops.py", line 907, in binary_op_wrapper return func(x, y, name=name) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_math_ops.py", line 183, in add "Add", x=x, y=y, name=name) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 3162, in create_op compute_device=compute_device) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 3208, in _create_op_helper set_shapes_for_outputs(op) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2427, in set_shapes_for_outputs return _set_shapes_for_outputs(op) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2400, in _set_shapes_for_outputs shapes = shape_func(op) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2330, in call_with_requiring return call_cpp_shape_fn(op, require_shape_fn=True) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn require_shape_fn) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl raise ValueError(err.message) ValueError: Dimensions must be equal, but are 318 and 320 for 'add_37' (op: 'Add') with input shapes: [4,318,500,3], [4,320,500,3].

What should I do please?

taiftahmid commented 5 years ago

Having the same issue. The shapes of 'image' and 'preds' are different: File "/home/ubuntu/fst/fast-style-transfer/transform.py", line 21, in net output = image + preds And hence they cannot be added. @ShafeenTejani any insights will be helpful