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
1e1e2dac
Commit
1e1e2dac
authored
1 year ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[tests] Minimal tests for the combined NIH-CXR14 and PadChest database remix
parent
2ce9f658
No related branches found
No related tags found
1 merge request
!6
Making use of LightningDataModule and simplification of data loading
Pipeline
#76828
passed
1 year ago
Stage: qa
Stage: test
Stage: doc
Stage: dist
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_nih_cxr14_padchest.py
+36
-19
36 additions, 19 deletions
tests/test_nih_cxr14_padchest.py
with
36 additions
and
19 deletions
tests/test_nih_cxr14_padchest.py
+
36
−
19
View file @
1e1e2dac
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
# SPDX-FileCopyrightText: Copyright © 2023 Idiap Research Institute <contact@idiap.ch>
#
#
# SPDX-License-Identifier: GPL-3.0-or-later
# SPDX-License-Identifier: GPL-3.0-or-later
"""
Tests for the aggregated NIH CXR14-PadChest dataset.
"""
"""
Tests for the aggregated NIH+CXR14-PadChest dataset.
"""
import
importlib
import
pytest
import
pytest
@pytest.mark.skip
(
reason
=
"
Test need to be updated
"
)
@pytest.mark.parametrize
(
def
test_dataset_consistency
():
"
name,padchest_name,combined_name
"
,
from
ptbench.data.nih_cxr14
import
default
as
nih
[
from
ptbench.data.nih_cxr14_padchest
import
idiap
as
nih_pc
(
"
default
"
,
"
no_tb_idiap
"
,
"
idiap
"
),
from
ptbench.data.padchest
import
no_tb_idiap
as
pc
],
)
def
test_split_consistency
(
name
:
str
,
padchest_name
:
str
,
combined_name
:
str
):
nih_cxr14
=
importlib
.
import_module
(
f
"
.
{
name
}
"
,
"
ptbench.data.nih_cxr14
"
).
datamodule
padchest
=
importlib
.
import_module
(
f
"
.
{
padchest_name
}
"
,
"
ptbench.data.padchest
"
).
datamodule
combined
=
importlib
.
import_module
(
f
"
.
{
combined_name
}
"
,
"
ptbench.data.nih_cxr14_padchest
"
).
datamodule
# Default protocol
CXR14Loader
=
importlib
.
import_module
(
nih_pc_dataset
=
nih_pc
.
dataset
"
.datamodule
"
,
"
ptbench.data.nih_cxr14
"
assert
isinstance
(
nih_pc_dataset
,
dict
)
).
RawDataLoader
nih_dataset
=
nih
.
dataset
PadChestLoader
=
importlib
.
import_module
(
pc_dataset
=
pc
.
dataset
"
.datamodule
"
,
"
ptbench.data.padchest
"
).
RawDataLoader
assert
"
train
"
in
nih_pc_dataset
for
split
in
(
"
train
"
,
"
validation
"
,
"
test
"
):
assert
len
(
nih_pc_dataset
[
"
train
"
])
==
len
(
nih_dataset
[
"
train
"
])
+
len
(
assert
nih_cxr14
.
splits
[
split
][
0
][
0
]
==
combined
.
splits
[
split
][
0
][
0
]
pc_dataset
[
"
train
"
]
assert
isinstance
(
nih_cxr14
.
splits
[
split
][
0
][
1
],
CXR14Loader
)
)
assert
isinstance
(
combined
.
splits
[
split
][
0
][
1
],
CXR14Loader
)
assert
"
validation
"
in
nih_pc_dataset
if
split
!=
"
test
"
:
assert
len
(
nih_pc_dataset
[
"
validation
"
])
==
len
(
# padchest has no test
nih_dataset
[
"
validation
"
]
assert
padchest
.
splits
[
split
][
0
][
0
]
==
combined
.
splits
[
split
][
1
][
0
]
)
+
len
(
pc_dataset
[
"
validation
"
])
assert
isinstance
(
padchest
.
splits
[
split
][
0
][
1
],
PadChestLoader
)
assert
isinstance
(
combined
.
splits
[
split
][
1
][
1
],
PadChestLoader
)
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