Skip to content
Snippets Groups Projects
Commit f5934965 authored by ogueler@idiap.ch's avatar ogueler@idiap.ch
Browse files

removed unnecessary functions

parent 7a149452
No related branches found
No related tags found
2 merge requests!5Tbx11k,!4Moved code to lightning
......@@ -27,20 +27,20 @@ The version of the dataset used in this benchmark is a simplified.
import importlib.resources
from ..dataset import JSONDataset
from ..loader import make_delayed, make_delayed_bbox
from ..loader import make_delayed
_protocols = [
importlib.resources.files(__name__).joinpath("default.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_0.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_1.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_2.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_3.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_4.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_5.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_6.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_7.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_8.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_9.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_0.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_1.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_2.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_3.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_4.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_5.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_6.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_7.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_8.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_9.json.bz2"),
]
......@@ -48,38 +48,15 @@ def _raw_data_loader(sample):
return dict(data=sample["data"], label=sample["label"])
def _raw_data_loader_bbox(sample):
return dict(
data=sample["data"],
label=sample["label"],
bboxes=sample["bboxes"],
)
def _loader(context, sample):
# "context" is ignored in this case - database is homogeneous
# we returned delayed samples to avoid loading all images at once
return make_delayed(sample, _raw_data_loader, key=sample["filename"])
def _loader_bbox(context, sample):
# "context" is ignored in this case - database is homogeneous
# we return delayed samples to avoid loading all images at once
return make_delayed_bbox(
sample, _raw_data_loader_bbox, key=sample["filename"]
)
dataset = JSONDataset(
protocols=_protocols,
fieldnames=("filename", "label", "data"),
loader=_loader,
)
dataset_with_bboxes = JSONDataset(
protocols=_protocols,
fieldnames=("filename", "label", "data", "bboxes"),
loader=_loader_bbox,
)
"""Extended TBX11K simplified dataset object."""
......@@ -27,20 +27,20 @@ The version of the dataset used in this benchmark is a simplified.
import importlib.resources
from ..dataset import JSONDataset
from ..loader import make_delayed, make_delayed_bbox
from ..loader import make_delayed
_protocols = [
importlib.resources.files(__name__).joinpath("default.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_0.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_1.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_2.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_3.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_4.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_5.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_6.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_7.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_8.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_9.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_0.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_1.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_2.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_3.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_4.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_5.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_6.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_7.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_8.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_9.json.bz2"),
]
......@@ -48,38 +48,16 @@ def _raw_data_loader(sample):
return dict(data=sample["data"], label=sample["label"])
def _raw_data_loader_bbox(sample):
return dict(
data=sample["data"],
label=sample["label"],
bboxes=sample["bboxes"],
)
def _loader(context, sample):
# "context" is ignored in this case - database is homogeneous
# we returned delayed samples to avoid loading all images at once
return make_delayed(sample, _raw_data_loader, key=sample["filename"])
def _loader_bbox(context, sample):
# "context" is ignored in this case - database is homogeneous
# we return delayed samples to avoid loading all images at once
return make_delayed_bbox(
sample, _raw_data_loader_bbox, key=sample["filename"]
)
dataset = JSONDataset(
protocols=_protocols,
fieldnames=("filename", "label", "data"),
loader=_loader,
)
dataset_with_bboxes = JSONDataset(
protocols=_protocols,
fieldnames=("filename", "label", "data", "bboxes"),
loader=_loader_bbox,
)
"""Extended TBX11K simplified dataset object."""
......@@ -27,20 +27,20 @@ The version of the dataset used in this benchmark is a simplified.
import importlib.resources
from ..dataset import JSONDataset
from ..loader import make_delayed, make_delayed_bbox
from ..loader import make_delayed
_protocols = [
importlib.resources.files(__name__).joinpath("default.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_0.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_1.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_2.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_3.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_4.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_5.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_6.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_7.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_8.json.bz2"),
# importlib.resources.files(__name__).joinpath("fold_9.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_0.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_1.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_2.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_3.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_4.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_5.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_6.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_7.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_8.json.bz2"),
importlib.resources.files(__name__).joinpath("fold_9.json.bz2"),
]
......@@ -48,38 +48,16 @@ def _raw_data_loader(sample):
return dict(data=sample["data"], label=sample["label"])
def _raw_data_loader_bbox(sample):
return dict(
data=sample["data"],
label=sample["label"],
bboxes=sample["bboxes"],
)
def _loader(context, sample):
# "context" is ignored in this case - database is homogeneous
# we returned delayed samples to avoid loading all images at once
return make_delayed(sample, _raw_data_loader, key=sample["filename"])
def _loader_bbox(context, sample):
# "context" is ignored in this case - database is homogeneous
# we return delayed samples to avoid loading all images at once
return make_delayed_bbox(
sample, _raw_data_loader_bbox, key=sample["filename"]
)
dataset = JSONDataset(
protocols=_protocols,
fieldnames=("filename", "label", "data"),
loader=_loader,
)
dataset_with_bboxes = JSONDataset(
protocols=_protocols,
fieldnames=("filename", "label", "data", "bboxes"),
loader=_loader_bbox,
)
"""Extended TBX11K simplified dataset object."""
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