Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yaoyuping
nnDetection
Commits
263cdb19
Commit
263cdb19
authored
Jul 20, 2021
by
mibaumgartner
Browse files
copy props
parent
849bc626
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
scripts/nnunet/nnunet_import.py
scripts/nnunet/nnunet_import.py
+13
-10
No files found.
scripts/nnunet/nnunet_import.py
View file @
263cdb19
...
@@ -228,18 +228,17 @@ def import_single_case(logits_source: Path,
...
@@ -228,18 +228,17 @@ def import_single_case(logits_source: Path,
properties_file
=
logits_source
.
parent
/
f
"
{
case_name
}
.pkl"
properties_file
=
logits_source
.
parent
/
f
"
{
case_name
}
.pkl"
probs
=
np
.
load
(
str
(
logits_source
))[
"softmax"
]
probs
=
np
.
load
(
str
(
logits_source
))[
"softmax"
]
if
properties_file
.
is_file
():
properties_dict
=
load_pickle
(
properties_file
)
properties_dict
=
load_pickle
(
properties_file
)
bbox
=
properties_dict
.
get
(
'crop_bbox'
)
bbox
=
properties_dict
.
get
(
'crop_bbox'
)
shape_original_before_cropping
=
properties_dict
.
get
(
'original_size_of_raw_data'
)
shape_original_before_cropping
=
properties_dict
.
get
(
'original_size_of_raw_data'
)
if
bbox
is
not
None
:
if
bbox
is
not
None
:
tmp
=
np
.
zeros
((
probs
.
shape
[
0
],
*
shape_original_before_cropping
))
tmp
=
np
.
zeros
((
probs
.
shape
[
0
],
*
shape_original_before_cropping
))
for
c
in
range
(
3
):
for
c
in
range
(
3
):
bbox
[
c
][
1
]
=
np
.
min
((
bbox
[
c
][
0
]
+
probs
.
shape
[
c
+
1
],
shape_original_before_cropping
[
c
]))
bbox
[
c
][
1
]
=
np
.
min
((
bbox
[
c
][
0
]
+
probs
.
shape
[
c
+
1
],
shape_original_before_cropping
[
c
]))
tmp
[:,
bbox
[
0
][
0
]:
bbox
[
0
][
1
],
bbox
[
1
][
0
]:
bbox
[
1
][
1
],
bbox
[
2
][
0
]:
bbox
[
2
][
1
]]
=
probs
tmp
[:,
bbox
[
0
][
0
]:
bbox
[
0
][
1
],
bbox
[
1
][
0
]:
bbox
[
1
][
1
],
bbox
[
2
][
0
]:
bbox
[
2
][
1
]]
=
probs
probs
=
tmp
probs
=
tmp
res
=
instance_results_from_seg
(
probs
,
res
=
instance_results_from_seg
(
probs
,
aggregation
=
aggregation
,
aggregation
=
aggregation
,
...
@@ -445,6 +444,10 @@ if __name__ == '__main__':
...
@@ -445,6 +444,10 @@ if __name__ == '__main__':
for
cid
in
case_ids
:
for
cid
in
case_ids
:
copy_and_ensemble_test
(
cid
,
nnunet_dirs
,
nnunet_prediction_dir
)
copy_and_ensemble_test
(
cid
,
nnunet_dirs
,
nnunet_prediction_dir
)
# copy properties
for
p
in
[
p
for
p
in
nnunet_dir
.
iterdir
()
if
p
.
name
.
endswith
(
".pkl"
)]:
shutil
.
copyfile
(
p
,
nnunet_prediction_dir
/
p
.
name
)
postprocessing_settings
=
load_pickle
(
nndet_unet_dir
/
"postprocessing.pkl"
)
postprocessing_settings
=
load_pickle
(
nndet_unet_dir
/
"postprocessing.pkl"
)
target_dir
=
nndet_unet_dir
/
"test_predictions"
target_dir
=
nndet_unet_dir
/
"test_predictions"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment