Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoneType in downsample #59

Open
Freephi opened this issue Jan 24, 2019 · 4 comments
Open

NoneType in downsample #59

Freephi opened this issue Jan 24, 2019 · 4 comments

Comments

@Freephi
Copy link

Freephi commented Jan 24, 2019

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.

@Freephi
Copy link
Author

Freephi commented Jan 24, 2019

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...

@MAGI-Yang
Copy link

MAGI-Yang commented Jan 30, 2019

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.

@elias-1
Copy link

elias-1 commented Aug 20, 2019

@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......

@elias-1
Copy link

elias-1 commented Aug 20, 2019

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants