UnFlow
UnFlow copied to clipboard
NoneType in downsample
Hi, I get following error:
Traceback (most recent call last):
File "eval_gui.py", line 338, in <module>
tf.app.run()
File "/home/teamCV/venv/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 126, in run
_sys.exit(main(argv))
File "eval_gui.py", line 328, in main
result, image_names = _evaluate_experiment(name, input_fn, data_input)
File "eval_gui.py", line 131, in _evaluate_experiment
params=params, augment=False, return_flow=True)
File "/home/teamCV/UnFlow/src/e2eflow/core/unsupervised.py", line 101, in unsupervised_loss
mask_s = downsample(border_mask, 4)
File "/home/teamCV/UnFlow/src/e2eflow/core/util.py", line 23, in downsample
if height%2 == 0 and width%2 == 0:
TypeError: unsupported operand type(s) for %: 'NoneType' and 'int'
While running run.py as well as eval_gui.py. I tried all different datasets, tried to train all possible models, and tried it with the pre-trained models provided from you. I'm using a Ubuntu 18.04 machine with python 3.5.6/3.6.7 and cuda-9.0. I tried cudnn7.1 and cudnn7.0, tensorflow-gpu 1.12 and 1.7 (installed with pip inside a virtualenv).
The input tensor of the core/util/downsampler method seems to be 'None', but I don't know why. Do you have any idea why or what could cause this error message?
Any help is appreciated! Thank you.
I fixed the error by hardcoding the height and width to the input image size in core/util/downsampler if the extracted height is None. But I don't think that's how it should work...
I also met this problem and I found this guy provide a solution in his fork. https://github.com/bryanyzhu/UnFlow It works on me but I am not sure if that should be the right way.
@MAGI-Yang Can you share the solution here? I found the repo is not existing now. Besides, for the problem, I found tensorflow with version 1.12 could infer the shape of the tensor built by the tf.shape. but the tensorflow with version 1.7 can not do this. I wonder if this is the reason why this error occurs? Strangely, the author could run the code......
with tensorflow v1.7
import tensorflow as tf a= tf.ones([2,2]) b=tf.shape(a) b <tf.Tensor 'Shape:0' shape=(2,) dtype=int32> c=tf.ones([b[0], b[1]]) c <tf.Tensor 'ones_1:0' shape=(?, ?) dtype=float32>
with tensorflow v1.12
import tensorflow as tf a= tf.ones([2,2]) b=tf.shape(a) c=tf.ones([b[0], b[1]]) c <tf.Tensor 'ones_1:0' shape=(2, 2) dtype=float32>