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
ba65cc7e
Commit
ba65cc7e
authored
Jul 28, 2020
by
Kaushik Shivakumar
Browse files
fix tests
parent
322d4444
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
research/object_detection/core/region_similarity_calculator.py
...rch/object_detection/core/region_similarity_calculator.py
+4
-0
research/object_detection/core/region_similarity_calculator_test.py
...bject_detection/core/region_similarity_calculator_test.py
+11
-11
No files found.
research/object_detection/core/region_similarity_calculator.py
View file @
ba65cc7e
...
@@ -47,6 +47,10 @@ class RegionSimilarityCalculator(six.with_metaclass(ABCMeta, object)):
...
@@ -47,6 +47,10 @@ class RegionSimilarityCalculator(six.with_metaclass(ABCMeta, object)):
boxlist1: BoxList holding N boxes.
boxlist1: BoxList holding N boxes.
boxlist2: BoxList holding M boxes.
boxlist2: BoxList holding M boxes.
scope: Op scope name. Defaults to 'Compare' if None.
scope: Op scope name. Defaults to 'Compare' if None.
groundtruth_labels: a Tensor of shape [num_boxes, num_classes]
containing groundtruth labels.
predicted_labels: a Tensor of shape [num_boxes, num_classes]
containing predicted labels.
Returns:
Returns:
a (float32) tensor of shape [N, M] with pairwise similarity score.
a (float32) tensor of shape [N, M] with pairwise similarity score.
...
...
research/object_detection/core/region_similarity_calculator_test.py
View file @
ba65cc7e
...
@@ -95,18 +95,18 @@ class RegionSimilarityCalculatorTest(test_case.TestCase):
...
@@ -95,18 +95,18 @@ class RegionSimilarityCalculatorTest(test_case.TestCase):
def
test_detr_similarity
(
self
):
def
test_detr_similarity
(
self
):
def
graph_fn
():
def
graph_fn
():
corners1
=
tf
.
constant
([[
4.0
,
3
.0
,
7.0
,
5
.0
],
[
5.0
,
6.0
,
10.0
,
7
.0
]])
corners1
=
tf
.
constant
([[
5
.0
,
7.0
,
7
.0
,
9
.0
]])
corners2
=
tf
.
constant
([[
3
.0
,
4
.0
,
6
.0
,
8
.0
],
[
14
.0
,
1
4
.0
,
15
.0
,
1
5
.0
]
,
corners2
=
tf
.
constant
([[
5
.0
,
7
.0
,
7
.0
,
9
.0
],
[
5
.0
,
1
1
.0
,
7
.0
,
1
3
.0
]
])
[
0.0
,
0.0
,
20
.0
,
2
0.0
]])
groundtruth_labels
=
tf
.
constant
([[
1
.0
,
0.0
]])
groundtruth
_labels
=
tf
.
constant
([[]])
predicted
_labels
=
tf
.
constant
([[
0.0
,
1000.0
],
[
1000.0
,
0.0
]])
boxes1
=
box_list
.
BoxList
(
corners1
)
boxes1
=
box_list
.
BoxList
(
corners1
)
boxes2
=
box_list
.
BoxList
(
corners2
)
boxes2
=
box_list
.
BoxList
(
corners2
)
iou
_similarity_calculator
=
region_similarity_calculator
.
Iou
Similarity
()
detr
_similarity_calculator
=
region_similarity_calculator
.
DETR
Simil
i
arity
()
iou
_similarity
=
iou
_similarity_calculator
.
compare
(
boxes1
,
boxes2
)
detr
_similarity
=
detr
_similarity_calculator
.
compare
(
boxes1
,
boxes2
,
None
,
groundtruth_labels
,
predicted_labels
)
return
iou
_similarity
return
detr
_similarity
exp_output
=
[[
2.0
/
16.0
,
0
,
6.0
/
400.0
],
[
1
.0
/
1
6
.0
,
0.0
,
5.0
/
40
0.0
]]
exp_output
=
[[
2.0
,
-
2.0
/
3
.0
+
1.0
-
2
0.0
]]
iou
_output
=
self
.
execute
(
graph_fn
,
[])
sim
_output
=
self
.
execute
(
graph_fn
,
[])
self
.
assertAllClose
(
iou
_output
,
exp_output
)
self
.
assertAllClose
(
sim
_output
,
exp_output
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
tf
.
test
.
main
()
tf
.
test
.
main
()
\ No newline at end of file
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