Skip to content
Snippets Groups Projects
Commit 3cbd7d9e authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[data.montgomery.loader] Use load_pil() instead of load_pil_baw() since...

[data.montgomery.loader] Use load_pil() instead of load_pil_baw() since Montgomery images are already in grayscale PNG (not black-and-white!)
parent 01e6d0b4
No related branches found
No related tags found
1 merge request!6Making use of LightningDataModule and simplification of data loading
...@@ -10,11 +10,11 @@ This configuration: ...@@ -10,11 +10,11 @@ This configuration:
* Raw data input (on disk): * Raw data input (on disk):
* PNG images 12 bit grayscale * PNG images 8 bit grayscale
* resolution: 4020 x 4892 px or 4892 x 4020 px * resolution: 4020 x 4892 px or 4892 x 4020 px
* Output image: * Output image:
* Transforms: * Transforms:
* Load raw PNG with :py:mod:`PIL` * Load raw PNG with :py:mod:`PIL`
...@@ -25,7 +25,7 @@ This configuration: ...@@ -25,7 +25,7 @@ This configuration:
* Final specifications * Final specifications
* Fixed resolution: 512 x 512 px * Fixed resolution: 512 x 512 px
* Color RGB encoding * Grayscale (single channel), 8 bits
""" """
import os import os
...@@ -33,7 +33,7 @@ import os ...@@ -33,7 +33,7 @@ import os
import torchvision.transforms import torchvision.transforms
from ...utils.rc import load_rc from ...utils.rc import load_rc
from ..image_utils import RemoveBlackBorders, load_pil_baw from ..image_utils import RemoveBlackBorders, load_pil
from ..typing import RawDataLoader as _BaseRawDataLoader from ..typing import RawDataLoader as _BaseRawDataLoader
from ..typing import Sample from ..typing import Sample
...@@ -87,9 +87,7 @@ class RawDataLoader(_BaseRawDataLoader): ...@@ -87,9 +87,7 @@ class RawDataLoader(_BaseRawDataLoader):
sample sample
The sample representation The sample representation
""" """
tensor = self.transform( tensor = self.transform(load_pil(os.path.join(self.datadir, sample[0])))
load_pil_baw(os.path.join(self.datadir, sample[0]))
)
return tensor, dict(label=sample[1], name=sample[0]) # type: ignore[arg-type] return tensor, dict(label=sample[1], name=sample[0]) # type: ignore[arg-type]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment