Skip to content

log_images fails with new versions of scipy #27

Open
@davidlibland

Description

@davidlibland

log_images relies on scipy.misc.toimage which was deprecated in scipy v1.0.0 and removed in v1.2.0. (cf. https://docs.scipy.org/doc/scipy-1.1.0/reference/generated/scipy.misc.toimage.html#scipy.misc.toimage)

Scipy documentation suggests using Pillow's Image.fromarray directly. The following changes to tensorboard_logger.py resolve the issue for me:

line 157 change:

            # Change the following:
            scipy.misc.toimage(img).save(s, format="png")
            # to:
            Image.fromarray(img).save(s, format="png")

line 12 change:

# Remove this import:
import scipy.misc
# Replace it with:
from PIL import Image

I would be happy to issue a PR with this fix.

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