lucent
lucent copied to clipboard
Lucent handles greyscale images in function view incorrectly
When rendering and visualizing greyscale images not inline, i.e., with show_inline=False
, PIL throws following error:
TypeError: Cannot handle this data type: (1, 1, 1), |u1
The problem is that Lucent passes a tensor of shape [H, W, C]
with C=1
and range from 0-225
to PIL, but PIL can handle only two-dimensional tensors with integer values.
This Stackoverflow answer provides more information.
Solution: Lucent should check if shape is [H, W, C=1]
and reduce to [H, W]
. Alternatively, introduce a param, e.g, greycale=True
in the view function.