cc
cc copied to clipboard
the output images' format should be changed from CHW to HWC
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)))
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
.
okay. this is due to version changes in torchvision. Can you send a pull request for the fix? Thanks so much.
I'm getting rid of some features in old versions of pytorch . so maybe a few days later~
Okay. Thank you so much :)
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?
hot can be found here: https://matplotlib.org/3.1.1/gallery/color/colormap_reference.html and can be used by modifying this line: https://github.com/anuragranj/cc/blob/master/utils.py#L34
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
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~