Skip to content
Snippets Groups Projects
Commit 96811376 authored by Daniel CARRON's avatar Daniel CARRON :b:
Browse files

Moved shenzhen configs to data

parent ea50dcaa
No related branches found
No related tags found
No related merge requests found
Showing
with 21 additions and 302 deletions
...@@ -118,27 +118,27 @@ montgomery_rs_f8 = "ptbench.configs.datasets.montgomery_RS.fold_8" ...@@ -118,27 +118,27 @@ montgomery_rs_f8 = "ptbench.configs.datasets.montgomery_RS.fold_8"
montgomery_rs_f9 = "ptbench.configs.datasets.montgomery_RS.fold_9" montgomery_rs_f9 = "ptbench.configs.datasets.montgomery_RS.fold_9"
# shenzhen dataset (and cross-validation folds) # shenzhen dataset (and cross-validation folds)
shenzhen = "ptbench.data.shenzhen.default" shenzhen = "ptbench.data.shenzhen.default"
shenzhen_rgb = "ptbench.configs.datasets.shenzhen.rgb" shenzhen_rgb = "ptbench.data.shenzhen.rgb"
shenzhen_f0 = "ptbench.configs.datasets.shenzhen.fold_0" shenzhen_f0 = "ptbench.data.shenzhen.fold_0"
shenzhen_f1 = "ptbench.configs.datasets.shenzhen.fold_1" shenzhen_f1 = "ptbench.data.shenzhen.fold_1"
shenzhen_f2 = "ptbench.configs.datasets.shenzhen.fold_2" shenzhen_f2 = "ptbench.data.shenzhen.fold_2"
shenzhen_f3 = "ptbench.configs.datasets.shenzhen.fold_3" shenzhen_f3 = "ptbench.data.shenzhen.fold_3"
shenzhen_f4 = "ptbench.configs.datasets.shenzhen.fold_4" shenzhen_f4 = "ptbench.data.shenzhen.fold_4"
shenzhen_f5 = "ptbench.configs.datasets.shenzhen.fold_5" shenzhen_f5 = "ptbench.data.shenzhen.fold_5"
shenzhen_f6 = "ptbench.configs.datasets.shenzhen.fold_6" shenzhen_f6 = "ptbench.data.shenzhen.fold_6"
shenzhen_f7 = "ptbench.configs.datasets.shenzhen.fold_7" shenzhen_f7 = "ptbench.data.shenzhen.fold_7"
shenzhen_f8 = "ptbench.configs.datasets.shenzhen.fold_8" shenzhen_f8 = "ptbench.data.shenzhen.fold_8"
shenzhen_f9 = "ptbench.configs.datasets.shenzhen.fold_9" shenzhen_f9 = "ptbench.data.shenzhen.fold_9"
shenzhen_f0_rgb = "ptbench.configs.datasets.shenzhen.fold_0_rgb" shenzhen_f0_rgb = "ptbench.data.shenzhen.fold_0_rgb"
shenzhen_f1_rgb = "ptbench.configs.datasets.shenzhen.fold_1_rgb" shenzhen_f1_rgb = "ptbench.data.shenzhen.fold_1_rgb"
shenzhen_f2_rgb = "ptbench.configs.datasets.shenzhen.fold_2_rgb" shenzhen_f2_rgb = "ptbench.data.shenzhen.fold_2_rgb"
shenzhen_f3_rgb = "ptbench.configs.datasets.shenzhen.fold_3_rgb" shenzhen_f3_rgb = "ptbench.data.shenzhen.fold_3_rgb"
shenzhen_f4_rgb = "ptbench.configs.datasets.shenzhen.fold_4_rgb" shenzhen_f4_rgb = "ptbench.data.shenzhen.fold_4_rgb"
shenzhen_f5_rgb = "ptbench.configs.datasets.shenzhen.fold_5_rgb" shenzhen_f5_rgb = "ptbench.data.shenzhen.fold_5_rgb"
shenzhen_f6_rgb = "ptbench.configs.datasets.shenzhen.fold_6_rgb" shenzhen_f6_rgb = "ptbench.data.shenzhen.fold_6_rgb"
shenzhen_f7_rgb = "ptbench.configs.datasets.shenzhen.fold_7_rgb" shenzhen_f7_rgb = "ptbench.data.shenzhen.fold_7_rgb"
shenzhen_f8_rgb = "ptbench.configs.datasets.shenzhen.fold_8_rgb" shenzhen_f8_rgb = "ptbench.data.shenzhen.fold_8_rgb"
shenzhen_f9_rgb = "ptbench.configs.datasets.shenzhen.fold_9_rgb" shenzhen_f9_rgb = "ptbench.data.shenzhen.fold_9_rgb"
# extended shenzhen dataset (with radiological signs) # extended shenzhen dataset (with radiological signs)
shenzhen_rs = "ptbench.configs.datasets.shenzhen_RS.default" shenzhen_rs = "ptbench.configs.datasets.shenzhen_RS.default"
shenzhen_rs_f0 = "ptbench.configs.datasets.shenzhen_RS.fold_0" shenzhen_rs_f0 = "ptbench.configs.datasets.shenzhen_RS.fold_0"
......
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
def _maker(protocol, resize_size=512, cc_size=512, RGB=False):
from torchvision import transforms
from ....data.shenzhen import dataset as raw
from ....data.transforms import ElasticDeformation, RemoveBlackBorders
from .. import make_dataset as mk
post_transforms = []
if RGB:
post_transforms = [
transforms.Lambda(lambda x: x.convert("RGB")),
transforms.ToTensor(),
]
return mk(
[raw.subsets(protocol)],
[
RemoveBlackBorders(),
transforms.Resize(resize_size),
transforms.CenterCrop(cc_size),
],
[ElasticDeformation(p=0.8)],
post_transforms,
)
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 0)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_0")
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 0, RGB)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_0", RGB=True)
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 1)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_1")
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 1, RGB)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_1", RGB=True)
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 2)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_2")
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 2, RGB)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_2", RGB=True)
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 3)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_3")
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 3, RGB)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_3", RGB=True)
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 4)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_4")
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 4, RGB)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_4", RGB=True)
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 5)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_5")
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 5, RGB)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_5", RGB=True)
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 6)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_6")
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 6, RGB)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_6", RGB=True)
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 7)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_7")
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 7, RGB)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_7", RGB=True)
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 8)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_8")
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""Shenzhen dataset for TB detection (cross validation fold 8, RGB)
* Split reference: first 80% of TB and healthy CXR for "train", rest for "test"
* This configuration resolution: 512 x 512 (default)
* See :py:mod:`ptbench.data.shenzhen` for dataset details
"""
from . import _maker
dataset = _maker("fold_8", RGB=True)
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