Skip to content

[Bug Report] TypeError in SuperTML: Image.fromarray requires uint8 #16

@wntrsnw130

Description

@wntrsnw130

Hi,

I encountered a TypeError when using SuperTML with feature_importance=True.

Description:
I think the error occurs because np.zeros creates an array of floats (float64) by default, but PIL.Image.fromarray(..., 'RGB') expects an integer type (usually uint8). This causes a crash during the initialization of the image canvas.

Error Trace:

TypeError: Cannot handle this data type: (1, 1, 3), <f8
File ".../TINTOlib/supertml.py", line 137, in __event2img
    img = Image.fromarray(np.zeros([self.image_pixels, self.image_pixels, 3]), 'RGB')

Proposed Fix:
In TINTOlib/supertml.py, line 137, explicitly specify the dtype as np.uint8:

# Old (Error)
img = Image.fromarray(np.zeros([self.image_pixels, self.image_pixels, 3]), 'RGB')

# New (Fix)
img = Image.fromarray(np.zeros([self.image_pixels, self.image_pixels, 3], dtype=np.uint8), 'RGB')

I manually applied this fix in my local environment and it solved the issue. Thanks!

I am an undergraduate student currently using this library for my thesis research on tabular-to-image algorithms. Thank you for your great work on this tool!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions