Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
Unet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
Kerstin Kaspar
Unet
Commits
5cabb61e
Commit
5cabb61e
authored
3 years ago
by
Kerstin Kaspar
Browse files
Options
Downloads
Patches
Plain Diff
debug
parent
d2f0aada
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
data.py
+7
-4
7 additions, 4 deletions
data.py
train.py
+12
-0
12 additions, 0 deletions
train.py
with
19 additions
and
4 deletions
data.py
+
7
−
4
View file @
5cabb61e
...
@@ -15,19 +15,22 @@ def get_lodopab_ground_truth(data_loc: Union[Path, str],
...
@@ -15,19 +15,22 @@ def get_lodopab_ground_truth(data_loc: Union[Path, str],
indicator:
'
train
'
,
'
test
'
, or
'
validation
'
, or a list of several indicators to define which data is loaded
indicator:
'
train
'
,
'
test
'
, or
'
validation
'
, or a list of several indicators to define which data is loaded
"""
"""
data_loc
=
Path
(
data_loc
)
data_loc
=
Path
(
data_loc
)
indicator
=
list
(
indicator
)
if
type
(
indicator
)
is
not
list
else
indicator
indicator
=
[
indicator
]
if
type
(
indicator
)
is
not
list
else
indicator
data
=
{}
data
=
{}
for
ind
in
indicator
:
for
ind
in
indicator
:
# file_count = len(list(data_loc.glob(f'*{ind}*.hdf5')))
# file_count = len(list(data_loc.glob(f'*{ind}*.hdf5')))
for
i
,
file
in
enumerate
(
data_loc
.
glob
(
f
'
*
{
ind
}
*.hdf5
'
)):
for
i
,
file
in
enumerate
(
data_loc
.
glob
(
f
'
*
ground_truth*
{
ind
}
*.hdf5
'
)):
# load the data and create numpy array
# load the data and create numpy array
with
h5py
.
File
(
file
,
'
r
'
)
as
f
:
with
h5py
.
File
(
file
,
'
r
'
)
as
f
:
i_data
=
f
[
'
data
'
][:]
i_data
=
f
[
'
data
'
][:]
if
i
==
0
:
if
i
==
0
:
data
[
ind
]
=
i_data
data
[
ind
]
=
i_data
else
:
else
:
data
[
ind
].
append
(
i_data
,
axis
=
0
)
np
.
append
(
data
[
ind
],
i_data
,
axis
=
0
)
return
data
if
len
(
indicator
)
>
1
:
return
data
else
:
return
data
[
indicator
[
0
]]
class
LodopabDataset
(
Dataset
):
class
LodopabDataset
(
Dataset
):
...
...
This diff is collapsed.
Click to expand it.
train.py
+
12
−
0
View file @
5cabb61e
...
@@ -13,6 +13,18 @@ cache_files = {
...
@@ -13,6 +13,18 @@ cache_files = {
ground_truth_data_loc
=
'
//hpc.isc.pad.ptb.de/hipcl/daten841/kaspar01/lodopab-ct/
'
ground_truth_data_loc
=
'
//hpc.isc.pad.ptb.de/hipcl/daten841/kaspar01/lodopab-ct/
'
# # cluster
# cache_files = {
# 'train':
# '/oneFS/daten841/kaspar01/lodopab-ct/fbp/cache_lodopab_train_fbp.npy',
# 'validation':
# '/oneFS/daten841/kaspar01/lodopab-ct/fbp/cache_lodopab_validation_fbp.npy',
# 'test':
# '/oneFS/daten841/kaspar01/lodopab-ct/fbp/cache_lodopab_test_fbp.npy'}
#
# ground_truth_data_loc = '/gpfs001/scratch/kaspar01/lodopab-ct/data/'
# auto define the correct device
# auto define the correct device
device
=
"
cuda
"
if
torch
.
cuda
.
is_available
()
else
"
cpu
"
device
=
"
cuda
"
if
torch
.
cuda
.
is_available
()
else
"
cpu
"
print
(
f
"
Using
{
device
}
device.
"
)
print
(
f
"
Using
{
device
}
device.
"
)
...
...
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