Skip to content

Lucent handles greyscale images in function view incorrectly #38

Description

@neoglez

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions