diff --git a/src/ptbench/config/data/nih_cxr14/datamodule.py b/src/ptbench/config/data/nih_cxr14/datamodule.py index 9875985f106fa4db9b90e82c0e6021c516f3e388..69f044eb701c58392e5b671db1853c03393ff08c 100644 --- a/src/ptbench/config/data/nih_cxr14/datamodule.py +++ b/src/ptbench/config/data/nih_cxr14/datamodule.py @@ -89,8 +89,10 @@ class RawDataLoader(_BaseRawDataLoader): basename, ) - # N.B.: NIH CXR-14 images are encoded as color PNGs + # N.B.: some NIH CXR-14 images are encoded as color PNGs with an alpha + # channel. Most, are grayscale PNGs image = PIL.Image.open(os.path.join(self.datadir, file_path)) + image = image.convert("L") # required for some images tensor = to_tensor(image) # use the code below to view generated images