cc icon indicating copy to clipboard operation
cc copied to clipboard

viz3 = np.vstack((255*tgt_img_viz, 255*depth_viz, 255*mask_viz... in test_mask

Open gagajian opened this issue 4 years ago • 3 comments

Hello, there seems something wrong with "vstack". The codes reports error as follows:

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

Can you help me with this, thanks!

gagajian avatar Oct 27 '19 09:10 gagajian

you should change 'viz3.astype('uint8')' to 'viz3.transpose(1, 2, 0).astype('uint8')', due to the format should be [h, w, 3], not [3, h, w].

JohnnieXDU avatar Apr 14 '20 05:04 JohnnieXDU

you should change 'viz3.astype('uint8')' to 'viz3.transpose(1, 2, 0).astype('uint8')', due to the format should be [h, w, 3], not [3, h, w].

Through this, I also got the issue about typeerror and the black flow images. Do you know the reason? Thanks a lot.

lotus0903 avatar Sep 09 '22 01:09 lotus0903

You need to make sure of the following. Maybe the conventions have changed with pytorch versions.

  1. If you are using the correct dim order HWC or CHW.
  2. If you in the correct range, there is a multiplication by 255 which assumes that the expected range should be 0-255. However if conventions have changed to 0-1 then avoid this multiplication.

anuragranj avatar Sep 09 '22 03:09 anuragranj