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

Channel axis dimension is not valid. #17

Open
wonbeomjang opened this issue Aug 6, 2019 · 1 comment
Open

Channel axis dimension is not valid. #17

wonbeomjang opened this issue Aug 6, 2019 · 1 comment

Comments

@wonbeomjang
Copy link

Hi. I get an error while running test.py on torchversion1.0. I can't run test.py because of scipy.misc.imsave. The input of imsave should be WHC, but in the present code, input value is given to CWH. So, I'm making an error in the imsave function.

in my case, I change imsave code

disp = (255*tensor2array(torch.from_numpy(output_disp_n), max_value=args.nlabel, colormap='bone'))
imsave(output_dir/'{:04d}_disp{}'.format(i,'.png'), disp)

to

disp = (255*tensor2array(torch.from_numpy(output_disp_n), max_value=args.nlabel, colormap='bone')).astype(np.uint8).transpose((1, 2, 0))
imsave(output_dir/'{:04d}_disp{}'.format(i,'.png'), disp)

thank you

@sunghoonim
Copy link
Owner

Hi.
It sometimes happens when the (I guess opencv) version is different.
So I wrote the transpose code with comment (Line49 in utils.py files).

In my version, the current version works.

Thank you for letting us know.
It might be helpful for users facing the same problem.

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

2 participants