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
0f5e6c09
"include/vscode:/vscode.git/clone" did not exist on "9f894c2b36e83e9414b3369f9a4974644d843d8d"
Commit
0f5e6c09
authored
Aug 31, 2021
by
mibaumgartner
Browse files
improved input robustness
parent
2a80e77d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
nndet/io/load.py
nndet/io/load.py
+7
-2
nndet/planning/properties/instance.py
nndet/planning/properties/instance.py
+4
-3
No files found.
nndet/io/load.py
View file @
0f5e6c09
...
@@ -84,8 +84,13 @@ def load_case_from_list(data_files, seg_file=None) -> Tuple[np.ndarray, np.ndarr
...
@@ -84,8 +84,13 @@ def load_case_from_list(data_files, seg_file=None) -> Tuple[np.ndarray, np.ndarr
seg_props_file
=
f
"
{
str
(
seg_file
).
split
(
'.'
)[
0
]
}
.json"
seg_props_file
=
f
"
{
str
(
seg_file
).
split
(
'.'
)[
0
]
}
.json"
if
os
.
path
.
isfile
(
seg_props_file
):
if
os
.
path
.
isfile
(
seg_props_file
):
with
open
(
seg_props_file
,
"r"
)
as
f
:
properties_json
=
load_json
(
seg_props_file
)
properties
.
update
(
json
.
load
(
f
))
# cast instances to correct type
properties_json
[
"instances"
]
=
{
str
(
key
):
int
(
item
)
for
key
,
item
in
properties_json
[
"instances"
].
items
()}
properties
.
update
(
properties_json
)
else
:
else
:
seg_npy
=
None
seg_npy
=
None
return
data_npy
.
astype
(
np
.
float32
),
seg_npy
,
properties
return
data_npy
.
astype
(
np
.
float32
),
seg_npy
,
properties
...
...
nndet/planning/properties/instance.py
View file @
0f5e6c09
...
@@ -279,11 +279,12 @@ def case_ious(boxes: np.ndarray, props: dict) -> Tuple[np.ndarray, Dict[int, np.
...
@@ -279,11 +279,12 @@ def case_ious(boxes: np.ndarray, props: dict) -> Tuple[np.ndarray, Dict[int, np.
class_ious
=
OrderedDict
()
class_ious
=
OrderedDict
()
case_classes
=
list
(
set
(
map
(
int
,
props
[
"instances"
].
values
())))
case_classes
=
list
(
set
(
map
(
int
,
props
[
"instances"
].
values
())))
# boxes are sorted by instance id
case_instances
=
sorted
(
list
(
map
(
int
,
props
[
"instances"
].
keys
())))
case_instances
=
sorted
(
list
(
map
(
int
,
props
[
"instances"
].
keys
())))
for
c
ls
in
case_classes
:
for
_
c
in
case_classes
:
cls_box_indices
=
[
props
[
"instances"
][
str
(
ci
)]
==
c
ls
for
ci
in
case_instances
]
cls_box_indices
=
[
int
(
props
[
"instances"
][
str
(
ci
)]
)
==
_
c
for
ci
in
case_instances
]
class_ious
[
c
ls
]
=
compute_each_iou
(
boxes
[
cls_box_indices
])
class_ious
[
_
c
]
=
compute_each_iou
(
boxes
[
cls_box_indices
])
else
:
else
:
all_ious
=
np
.
array
([])
all_ious
=
np
.
array
([])
class_ious
=
{}
class_ious
=
{}
...
...
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