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
ModelZoo
ResNet50_tensorflow
Commits
65f0fa2e
Commit
65f0fa2e
authored
Jun 24, 2017
by
Ben Mabey
Browse files
updates object_detection/eval.py to be python3 compatible
parent
3ae3df73
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
4 deletions
+6
-4
object_detection/evaluator.py
object_detection/evaluator.py
+1
-1
object_detection/utils/metrics.py
object_detection/utils/metrics.py
+2
-1
object_detection/utils/np_box_list.py
object_detection/utils/np_box_list.py
+2
-1
object_detection/utils/visualization_utils.py
object_detection/utils/visualization_utils.py
+1
-1
No files found.
object_detection/evaluator.py
View file @
65f0fa2e
...
...
@@ -154,7 +154,7 @@ def evaluate(create_input_dict_fn, create_model_fn, eval_config, categories,
"""
if
batch_index
>=
eval_config
.
num_visualizations
:
if
'original_image'
in
tensor_dict
:
tensor_dict
=
{
k
:
v
for
(
k
,
v
)
in
tensor_dict
.
iter
items
()
tensor_dict
=
{
k
:
v
for
(
k
,
v
)
in
tensor_dict
.
items
()
if
k
!=
'original_image'
}
try
:
(
result_dict
,
_
)
=
sess
.
run
([
tensor_dict
,
update_op
])
...
...
object_detection/utils/metrics.py
View file @
65f0fa2e
...
...
@@ -17,6 +17,7 @@
from
__future__
import
division
import
numpy
as
np
from
six
import
moves
def
compute_precision_recall
(
scores
,
labels
,
num_gt
):
...
...
@@ -103,7 +104,7 @@ def compute_average_precision(precision, recall):
raise
ValueError
(
"Precision must be in the range of [0, 1]."
)
if
np
.
amin
(
recall
)
<
0
or
np
.
amax
(
recall
)
>
1
:
raise
ValueError
(
"recall must be in the range of [0, 1]."
)
if
not
all
(
recall
[
i
]
<=
recall
[
i
+
1
]
for
i
in
x
range
(
len
(
recall
)
-
1
)):
if
not
all
(
recall
[
i
]
<=
recall
[
i
+
1
]
for
i
in
moves
.
range
(
len
(
recall
)
-
1
)):
raise
ValueError
(
"recall must be a non-decreasing array"
)
recall
=
np
.
concatenate
([[
0
],
recall
,
[
1
]])
...
...
object_detection/utils/np_box_list.py
View file @
65f0fa2e
...
...
@@ -16,6 +16,7 @@
"""Numpy BoxList classes and functions."""
import
numpy
as
np
from
six
import
moves
class
BoxList
(
object
):
...
...
@@ -127,7 +128,7 @@ class BoxList(object):
ymin, and all xmax of boxes are equal or greater than xmin.
"""
if
data
.
shape
[
0
]
>
0
:
for
i
in
x
range
(
data
.
shape
[
0
]):
for
i
in
moves
.
range
(
data
.
shape
[
0
]):
if
data
[
i
,
0
]
>
data
[
i
,
2
]
or
data
[
i
,
1
]
>
data
[
i
,
3
]:
return
False
return
True
object_detection/utils/visualization_utils.py
View file @
65f0fa2e
...
...
@@ -80,7 +80,7 @@ def encode_image_array_as_png_str(image):
PNG encoded image string.
"""
image_pil
=
Image
.
fromarray
(
np
.
uint8
(
image
))
output
=
six
.
String
IO
()
output
=
six
.
Bytes
IO
()
image_pil
.
save
(
output
,
format
=
'PNG'
)
png_string
=
output
.
getvalue
()
output
.
close
()
...
...
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