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
4a2e1975
Commit
4a2e1975
authored
Jun 29, 2020
by
syiming
Browse files
Add unit test for multilevel_matmul_crop_and_resize
parent
46cea4f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
research/object_detection/utils/spatial_transform_ops_test.py
...arch/object_detection/utils/spatial_transform_ops_test.py
+32
-0
No files found.
research/object_detection/utils/spatial_transform_ops_test.py
View file @
4a2e1975
...
@@ -512,6 +512,38 @@ class MatMulCropAndResizeTest(test_case.TestCase):
...
@@ -512,6 +512,38 @@ class MatMulCropAndResizeTest(test_case.TestCase):
crop_output
=
self
.
execute
(
graph_fn
,
[
image
,
boxes
])
crop_output
=
self
.
execute
(
graph_fn
,
[
image
,
boxes
])
self
.
assertAllClose
(
crop_output
,
expected_output
)
self
.
assertAllClose
(
crop_output
,
expected_output
)
def
testMultilevelMatMulCropAndResize
(
self
):
def
graph_fn
(
image1
,
image2
,
boxes
,
box_levels
):
return
spatial_ops
.
multilevel_matmul_crop_and_resize
([
image1
,
image2
],
boxes
,
box_levels
,
crop_size
=
[
2
,
2
])
image
=
[
np
.
array
([[[[
1
,
0
],
[
2
,
0
],
[
3
,
0
]],
[[
4
,
0
],
[
5
,
0
],
[
6
,
0
]],
[[
7
,
0
],
[
8
,
0
],
[
9
,
0
]]],
[[[
1
,
0
],
[
2
,
0
],
[
3
,
0
]],
[[
4
,
0
],
[
5
,
0
],
[
6
,
0
]],
[[
7
,
0
],
[
8
,
0
],
[
9
,
0
]]]],
dtype
=
np
.
float32
),
np
.
array
([[[[
1
,
0
],
[
2
,
1
],
[
3
,
2
]],
[[
4
,
3
],
[
5
,
4
],
[
6
,
5
]],
[[
7
,
6
],
[
8
,
7
],
[
9
,
8
]]],
[[[
1
,
0
],
[
2
,
1
],
[
3
,
2
]],
[[
4
,
3
],
[
5
,
4
],
[
6
,
5
]],
[[
7
,
6
],
[
8
,
7
],
[
9
,
8
]]]],
dtype
=
np
.
float32
)]
boxes
=
np
.
array
([[[
1
,
1
,
0
,
0
],
[.
5
,
.
5
,
0
,
0
]],
[[
0
,
0
,
1
,
1
],
[
0
,
0
,
.
5
,
.
5
]]],
dtype
=
np
.
float32
)
box_levels
=
np
.
array
([[
0
,
1
],
[
1
,
1
]],
dtype
=
np
.
int32
)
expected_output
=
[[[[[
9
,
0
],
[
7
,
0
]],
[[
3
,
0
],
[
1
,
0
]]],
[[[
5
,
4
],
[
4
,
3
]],
[[
2
,
1
],
[
1
,
0
]]]],
[[[[
1
,
0
],
[
3
,
2
]],
[[
7
,
6
],
[
9
,
8
]]],
[[[
1
,
0
],
[
2
,
1
]],
[[
4
,
3
],
[
5
,
4
]]]]]
crop_output
=
self
.
execute
(
graph_fn
,
[
*
image
,
boxes
,
box_levels
])
self
.
assertAllClose
(
crop_output
,
expected_output
)
class
NativeCropAndResizeTest
(
test_case
.
TestCase
):
class
NativeCropAndResizeTest
(
test_case
.
TestCase
):
...
...
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