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
e7d0d0ec
"git@developer.sourcefind.cn:jerrrrry/infinicore.git" did not exist on "c74dfaeade9816b03eef6c0748e2939d03110cb2"
Commit
e7d0d0ec
authored
Jun 21, 2021
by
mibaumgartner
Browse files
fix seg2det script
parent
b5df69f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
scripts/convert_seg2det.py
scripts/convert_seg2det.py
+8
-2
No files found.
scripts/convert_seg2det.py
View file @
e7d0d0ec
...
@@ -35,6 +35,7 @@ from nndet.io import get_case_ids_from_dir, load_json, save_json
...
@@ -35,6 +35,7 @@ from nndet.io import get_case_ids_from_dir, load_json, save_json
from
nndet.io.transforms.instances
import
get_bbox_np
from
nndet.io.transforms.instances
import
get_bbox_np
from
nndet.io.itk
import
copy_meta_data_itk
,
load_sitk
,
load_sitk_as_array
from
nndet.io.itk
import
copy_meta_data_itk
,
load_sitk
,
load_sitk_as_array
from
nndet.utils.config
import
compose
from
nndet.utils.config
import
compose
from
nndet.utils.check
import
env_guard
def
prepare_detection_label
(
case_id
:
str
,
def
prepare_detection_label
(
case_id
:
str
,
...
@@ -103,7 +104,8 @@ def prepare_detection_label(case_id: str,
...
@@ -103,7 +104,8 @@ def prepare_detection_label(case_id: str,
sitk
.
WriteImage
(
seg_itk
,
str
(
label_dir
/
f
"
{
case_id
}
_orig.nii.gz"
))
sitk
.
WriteImage
(
seg_itk
,
str
(
label_dir
/
f
"
{
case_id
}
_orig.nii.gz"
))
if
__name__
==
'__main__'
:
@
env_guard
def
main
():
"""
"""
This script converts a semantic segmentation dataset into an instance
This script converts a semantic segmentation dataset into an instance
segmentation dataset by using connected components on the labels.
segmentation dataset by using connected components on the labels.
...
@@ -148,7 +150,7 @@ if __name__ == '__main__':
...
@@ -148,7 +150,7 @@ if __name__ == '__main__':
action
=
'store_true'
,
action
=
'store_true'
,
)
)
parser
.
add_argument
(
'--num_processes'
,
type
=
int
,
default
=
4
,
required
=
False
,
parser
.
add_argument
(
'--num_processes'
,
type
=
int
,
default
=
4
,
required
=
False
,
help
=
"Number of processes to use for conversion."
)
help
=
"Number of processes to use for conversion.
Default 4.
"
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
tasks
=
args
.
tasks
tasks
=
args
.
tasks
...
@@ -212,3 +214,7 @@ if __name__ == '__main__':
...
@@ -212,3 +214,7 @@ if __name__ == '__main__':
save_json
(
ranking
,
splitted_dir
/
f
"volume_ranking_
{
postfix
}
.json"
)
save_json
(
ranking
,
splitted_dir
/
f
"volume_ranking_
{
postfix
}
.json"
)
else
:
else
:
logger
.
info
(
f
"Did not find dir
{
label_dir
}
for volume ranking"
)
logger
.
info
(
f
"Did not find dir
{
label_dir
}
for volume ranking"
)
if
__name__
==
'__main__'
:
main
()
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