tensorboard
tensorboard copied to clipboard
make_image: reshape tensor for Grayscale image
PIL.fromarray function cannot handle channel==1. TypeError has occurred.
from PIL import Image
import numpy as np
arr = np.random.rand(100,100,1)
image = Image.fromarray(arr)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 2426, in fromarray
raise TypeError("Cannot handle this data type")
TypeError: Cannot handle this data type
The tensor should be reshaped to 2D.
Signed-off-by: YujiOshima [email protected]