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
2fcec25b
Commit
2fcec25b
authored
1 year ago
by
Daniel CARRON
Browse files
Options
Downloads
Patches
Plain Diff
Removed TBDataset, using Runtime or Cached datasets instead
parent
d5b173b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#75312
canceled
1 year ago
Stage: qa
Stage: test
Stage: doc
Stage: dist
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ptbench/data/dataset.py
+0
-44
0 additions, 44 deletions
src/ptbench/data/dataset.py
src/ptbench/data/shenzhen/default.py
+10
-9
10 additions, 9 deletions
src/ptbench/data/shenzhen/default.py
with
10 additions
and
53 deletions
src/ptbench/data/dataset.py
+
0
−
44
View file @
2fcec25b
...
...
@@ -367,50 +367,6 @@ class RuntimeDataset(torch.utils.data.Dataset):
return
len
(
self
.
_samples
)
class
TBDataset
(
torch
.
utils
.
data
.
Dataset
):
def
__init__
(
self
,
json_protocol
,
protocol
,
subset
,
raw_data_loader
,
transforms
,
cache_samples
=
False
,
):
self
.
json_protocol
=
json_protocol
self
.
subset
=
subset
self
.
raw_data_loader
=
raw_data_loader
self
.
transforms
=
transforms
self
.
cache_samples
=
cache_samples
self
.
_samples
=
json_protocol
.
subsets
(
protocol
)[
self
.
subset
]
# Dict entry with relative path to files
for
s
in
self
.
_samples
:
s
[
"
name
"
]
=
s
[
"
data
"
]
if
self
.
cache_samples
:
logger
.
info
(
f
"
Caching
{
self
.
subset
}
samples
"
)
for
sample
in
tqdm
(
self
.
_samples
):
sample
[
"
data
"
]
=
self
.
transforms
(
self
.
raw_data_loader
(
sample
[
"
data
"
])
)
def
__getitem__
(
self
,
idx
):
if
self
.
cache_samples
:
return
self
.
_samples
[
idx
]
else
:
sample
=
self
.
_samples
[
idx
].
copy
()
sample
[
"
data
"
]
=
self
.
transforms
(
self
.
raw_data_loader
(
sample
[
"
data
"
])
)
return
sample
def
__len__
(
self
):
return
len
(
self
.
_samples
)
def
get_samples_weights
(
dataset
):
"""
Compute the weights of all the samples of the dataset to balance it
using the sampler of the dataloader.
...
...
This diff is collapsed.
Click to expand it.
src/ptbench/data/shenzhen/default.py
+
10
−
9
View file @
2fcec25b
...
...
@@ -14,7 +14,7 @@ from clapper.logging import setup
from
torchvision
import
transforms
from
..base_datamodule
import
BaseDataModule
from
..dataset
import
JSONProtocol
,
TB
Dataset
from
..dataset
import
CachedDataset
,
JSONProtocol
,
Runtime
Dataset
from
..shenzhen
import
_protocols
,
_raw_data_loader
from
..transforms
import
ElasticDeformation
,
RemoveBlackBorders
...
...
@@ -59,43 +59,44 @@ class DefaultModule(BaseDataModule):
fieldnames
=
(
"
data
"
,
"
label
"
),
)
if
self
.
_cache_samples
:
dataset
=
CachedDataset
else
:
dataset
=
RuntimeDataset
if
not
self
.
_has_setup_fit
and
stage
==
"
fit
"
:
self
.
train_dataset
=
TBD
ataset
(
self
.
train_dataset
=
d
ataset
(
json_protocol
,
self
.
_protocol
,
"
train
"
,
_raw_data_loader
,
self
.
_build_transforms
(
is_train
=
True
),
cache_samples
=
self
.
_cache_samples
,
)
self
.
validation_dataset
=
TBD
ataset
(
self
.
validation_dataset
=
d
ataset
(
json_protocol
,
self
.
_protocol
,
"
validation
"
,
_raw_data_loader
,
self
.
_build_transforms
(
is_train
=
False
),
cache_samples
=
self
.
_cache_samples
,
)
self
.
_has_setup_fit
=
True
if
not
self
.
_has_setup_predict
and
stage
==
"
predict
"
:
self
.
train_dataset
=
TBD
ataset
(
self
.
train_dataset
=
d
ataset
(
json_protocol
,
self
.
_protocol
,
"
train
"
,
_raw_data_loader
,
self
.
_build_transforms
(
is_train
=
False
),
cache_samples
=
self
.
_cache_samples
,
)
self
.
validation_dataset
=
TBD
ataset
(
self
.
validation_dataset
=
d
ataset
(
json_protocol
,
self
.
_protocol
,
"
validation
"
,
_raw_data_loader
,
self
.
_build_transforms
(
is_train
=
False
),
cache_samples
=
self
.
_cache_samples
,
)
self
.
_has_setup_predict
=
True
...
...
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