Skip to content

option for LoadImage to be compatible with torchvision save_image #6007

Closed
@wyli

Description

@wyli

Is your feature request related to a problem? Please describe.
for 2d natural images the current loader is not consistent with the common computer vision conversion:

import numpy as np
import torchvision

import monai
from monai.transforms import LoadImage

monai.apps.utils.download_url("https://monai.io/assets/img/MONAI-logo_color.png")

img = LoadImage(image_only=True, ensure_channel_first=True)("MONAI-logo_color.png")  # PILReader
torchvision.utils.save_image(img, "MONAI-logo_color_torchvision.png", normalize=True)

the output MONAI-logo_color_torchvision.png is transposed compared with MONAI-logo_color.png

would be great to add an option to the PIL-backend reader LoadImage(reader="PILReader") to support this use case.

see also

cc @holgerroth

Metadata

Metadata

Assignees

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