Skip to content
Snippets Groups Projects
Commit 0913ace4 authored by Maxime DELITROZ's avatar Maxime DELITROZ
Browse files

[data.image_utils.py] replaced load_pil_baw by load_pil_grayscale. Updated the...

[data.image_utils.py] replaced load_pil_baw by load_pil_grayscale. Updated the docstring and call in the rest of the package accordingly
parent f23e66b9
No related branches found
No related tags found
1 merge request!6Making use of LightningDataModule and simplification of data loading
Pipeline #76544 failed
......@@ -20,7 +20,7 @@ import os
from ...utils.rc import load_rc
from .. import make_dataset
from ..dataset import JSONDataset
from ..loader import load_pil_baw, make_delayed
from ..loader import load_pil_grayscale, make_delayed
_protocols = [
importlib.resources.files(__name__).joinpath("fold_0.json.bz2"),
......@@ -40,7 +40,7 @@ _datadir = load_rc().get("datadir.hivtb", os.path.realpath(os.curdir))
def _raw_data_loader(sample):
return dict(
data=load_pil_baw(os.path.join(_datadir, sample["data"])),
data=load_pil_grayscale(os.path.join(_datadir, sample["data"])),
label=sample["label"],
)
......
......@@ -96,8 +96,8 @@ def load_pil(path: str | pathlib.Path) -> PIL.Image.Image:
return PIL.Image.open(path)
def load_pil_baw(path: str | pathlib.Path) -> PIL.Image.Image:
"""Loads a sample data.
def load_pil_grayscale(path: str | pathlib.Path) -> PIL.Image.Image:
"""Loads a sample data in grayscale mode ("L").
Parameters
----------
......@@ -116,7 +116,7 @@ def load_pil_baw(path: str | pathlib.Path) -> PIL.Image.Image:
def load_pil_rgb(path: str | pathlib.Path) -> PIL.Image.Image:
"""Loads a sample data.
"""Loads a sample data in RGB mode ("RGB").
Parameters
----------
......
......@@ -19,7 +19,7 @@ import os
from ...utils.rc import load_rc
from .. import make_dataset
from ..dataset import JSONDataset
from ..loader import load_pil_baw, make_delayed
from ..loader import load_pil_grayscale, make_delayed
_protocols = [
importlib.resources.files(__name__).joinpath("default.json.bz2"),
......@@ -40,7 +40,7 @@ _datadir = load_rc().get("datadir.indian", os.path.realpath(os.curdir))
def _raw_data_loader(sample):
return dict(
data=load_pil_baw(os.path.join(_datadir, sample["data"])),
data=load_pil_grayscale(os.path.join(_datadir, sample["data"])),
label=sample["label"],
)
......
......@@ -20,7 +20,7 @@ import os
from ...utils.rc import load_rc
from .. import make_dataset
from ..dataset import JSONDataset
from ..loader import load_pil_baw, make_delayed
from ..loader import load_pil_grayscale, make_delayed
_protocols = [
importlib.resources.files(__name__).joinpath("fold_0.json.bz2"),
......@@ -40,7 +40,7 @@ _datadir = load_rc().get("datadir.tbpoc", os.path.realpath(os.curdir))
def _raw_data_loader(sample):
return dict(
data=load_pil_baw(os.path.join(_datadir, sample["data"])),
data=load_pil_grayscale(os.path.join(_datadir, sample["data"])),
label=sample["label"],
)
......
......@@ -28,7 +28,7 @@ import os
from ...utils.rc import load_rc
from ..dataset import JSONDataset
from ..loader import load_pil_baw, make_delayed, make_delayed_bbox
from ..loader import load_pil_grayscale, make_delayed, make_delayed_bbox
_protocols = [
importlib.resources.files(__name__).joinpath("default.json.bz2"),
......@@ -51,14 +51,14 @@ _datadir = load_rc().get(
def _raw_data_loader(sample):
return dict(
data=load_pil_baw(os.path.join(_datadir, sample["data"])), # type: ignore
data=load_pil_grayscale(os.path.join(_datadir, sample["data"])), # type: ignore
label=sample["label"],
)
def _raw_data_loader_bbox(sample):
return dict(
data=load_pil_baw(os.path.join(_datadir, sample["data"])), # type: ignore
data=load_pil_grayscale(os.path.join(_datadir, sample["data"])), # type: ignore
label=sample["label"],
bboxes=sample["bboxes"],
)
......
......@@ -28,7 +28,7 @@ import os
from ...utils.rc import load_rc
from ..dataset import JSONDataset
from ..loader import load_pil_baw, make_delayed, make_delayed_bbox
from ..loader import load_pil_grayscale, make_delayed, make_delayed_bbox
_protocols = [
importlib.resources.files(__name__).joinpath("default.json.bz2"),
......@@ -51,14 +51,14 @@ _datadir = load_rc().get(
def _raw_data_loader(sample):
return dict(
data=load_pil_baw(os.path.join(_datadir, sample["data"])), # type: ignore
data=load_pil_grayscale(os.path.join(_datadir, sample["data"])), # type: ignore
label=sample["label"],
)
def _raw_data_loader_bbox(sample):
return dict(
data=load_pil_baw(os.path.join(_datadir, sample["data"])), # type: ignore
data=load_pil_grayscale(os.path.join(_datadir, sample["data"])), # type: ignore
label=sample["label"],
bboxes=sample["bboxes"],
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment