Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mednet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
medai
software
mednet
Commits
93df5969
Commit
93df5969
authored
1 year ago
by
ogueler@idiap.ch
Browse files
Options
Downloads
Patches
Plain Diff
initialized tbx11k files
parent
c938869f
No related branches found
No related tags found
2 merge requests
!5
Tbx11k
,
!4
Moved code to lightning
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ptbench/data/tbx11k_simplified/__init__.py
+68
-0
68 additions, 0 deletions
src/ptbench/data/tbx11k_simplified/__init__.py
src/ptbench/data/tbx11k_simplified_RS/__init__.py
+62
-0
62 additions, 0 deletions
src/ptbench/data/tbx11k_simplified_RS/__init__.py
with
130 additions
and
0 deletions
src/ptbench/data/tbx11k_simplified/__init__.py
0 → 100644
+
68
−
0
View file @
93df5969
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""
TBX11K simplified dataset for computer-aided diagnosis.
The TBX11K database has been established to foster research
in computer-aided diagnosis of pulmonary diseases with a special
focus on tuberculosis (aTB). The dataset was specifically
designed to be used with CNNs. It contains 11,000 chest X-ray
images, each of a unique patient. They were labeled by expert
radiologists with 5 - 10+ years of experience. Possible labels
are:
"
healthy
"
,
"
active TB
"
,
"
latent TB
"
, and
"
sick & non-tb
"
.
The version of the dataset used in this benchmark is a simplified.
* Reference: [TBX11K-SIMPLIFIED-2020]_
* Original resolution (height x width or width x height): 4020 x 4892
* Split reference: none
* Protocol ``default``:
* Training samples: 62.5% of TB and healthy CXR (including labels)
* Validation samples: 15.9% of TB and healthy CXR (including labels)
* Test samples: 21.6% of TB and healthy CXR (including labels)
"""
import
importlib.resources
import
os
from
...utils.rc
import
load_rc
from
..dataset
import
JSONDataset
from
..loader
import
load_pil_baw
,
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
"
),
]
_datadir
=
load_rc
().
get
(
"
datadir.tbx11k_simplified
"
,
os
.
path
.
realpath
(
os
.
curdir
))
def
_raw_data_loader
(
sample
):
return
dict
(
data
=
load_pil_baw
(
os
.
path
.
join
(
_datadir
,
sample
[
"
data
"
])),
# type: ignore
label
=
sample
[
"
label
"
],
)
def
_loader
(
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
(
sample
,
_raw_data_loader
)
dataset
=
JSONDataset
(
protocols
=
_protocols
,
fieldnames
=
(
"
data
"
,
"
label
"
),
loader
=
_loader
,
)
"""
TBX11K simplified dataset object.
"""
This diff is collapsed.
Click to expand it.
src/ptbench/data/tbx11k_simplified_RS/__init__.py
0 → 100644
+
62
−
0
View file @
93df5969
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
# SPDX-License-Identifier: GPL-3.0-or-later
"""
Extended TBX11K simplified dataset for computer-aided diagnosis
(extended with DensenetRS predictions)
The TBX11K database has been established to foster research
in computer-aided diagnosis of pulmonary diseases with a special
focus on tuberculosis (aTB). The dataset was specifically
designed to be used with CNNs. It contains 11,000 chest X-ray
images, each of a unique patient. They were labeled by expert
radiologists with 5 - 10+ years of experience. Possible labels
are:
"
healthy
"
,
"
active TB
"
,
"
latent TB
"
, and
"
sick & non-tb
"
.
The version of the dataset used in this benchmark is a simplified.
* Reference: [TBX11K-SIMPLIFIED-2020]_
* Original (released) resolution (height x width or width x height): 512 x 512
* Split reference: none
* Protocol ``default``:
* Training samples: 62.5% of TB and healthy CXR (including labels)
* Validation samples: 15.9% of TB and healthy CXR (including labels)
* Test samples: 21.6% of TB and healthy CXR (including labels)
"""
import
importlib.resources
from
..dataset
import
JSONDataset
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
"
),
]
def
_raw_data_loader
(
sample
):
return
dict
(
data
=
sample
[
"
data
"
],
label
=
sample
[
"
label
"
])
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
"
])
dataset
=
JSONDataset
(
protocols
=
_protocols
,
fieldnames
=
(
"
filename
"
,
"
label
"
,
"
data
"
),
loader
=
_loader
,
)
"""
Extended TBX11K simplified dataset object.
"""
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment