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

the output images' format should be changed from CHW to HWC #10

Open
nightmaredimple opened this issue Jun 13, 2019 · 8 comments
Open

Comments

@nightmaredimple
Copy link

Tensors in pytorch are formatted in CHW(BCHW) by default, so if you wanna output the results of depth,flow and mask, you should change them into HWC format.
such as:
test_flow.py line 180

row1_viz_im = Image.fromarray((255*row1_viz).astype('uint8'))
row2_viz_im = Image.fromarray((row2_viz).astype('uint8'))

this will raise TypeError("Cannot handle this data type")
you should transpose/permute the format into HWC like this below:

row1_viz_im = Image.fromarray((255*row1_viz).astype('uint8').transpose((1,2,0)))
row2_viz_im = Image.fromarray((row2_viz).astype('uint8').transpose((1,2,0)))

@nightmaredimple
Copy link
Author

Due to the problem above, when testing masks' output, the results of flow are totally black. Besides, the colormap of hot needs to be defined in utils/COLORMAPS.

@anuragranj
Copy link
Owner

okay. this is due to version changes in torchvision. Can you send a pull request for the fix? Thanks so much.

@nightmaredimple
Copy link
Author

I'm getting rid of some features in old versions of pytorch . so maybe a few days later~

@anuragranj
Copy link
Owner

Okay. Thank you so much :)

@ChenjieWang
Copy link

Due to the problem above, when testing masks' output, the results of flow are totally black. Besides, the colormap of hot needs to be defined in utils/COLORMAPS.

Do you know how to define the colormap of hot in utils/COLORMAPS please?

@anuragranj
Copy link
Owner

@swrdZWJ
Copy link

swrdZWJ commented Sep 11, 2019

I have the same problem with you. Do you solve the problem correctly and how to modify the code in 'test_mask.py' and 'utils.py'?

viz3_im = Image.fromarray(viz3.astype('uint8'))
TypeError: Cannot handle this data type

Thank you (^_^) @anuragranj @ChenjieWang

@lotus0903
Copy link

Due to the problem above, when testing masks' output, the results of flow are totally black. Besides, the colormap of hot needs to be defined in utils/COLORMAPS.

I wonder how to solve the black problem. Thanks a lot~

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

5 participants