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
46cea4f6
Commit
46cea4f6
authored
Jun 28, 2020
by
syiming
Browse files
add todo: consider more efficient approach to compute multilevel cropped features
parent
3efe2425
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
research/object_detection/utils/spatial_transform_ops.py
research/object_detection/utils/spatial_transform_ops.py
+3
-2
No files found.
research/object_detection/utils/spatial_transform_ops.py
View file @
46cea4f6
...
@@ -419,12 +419,13 @@ def multilevel_native_crop_and_resize(images, boxes, box_levels,
...
@@ -419,12 +419,13 @@ def multilevel_native_crop_and_resize(images, boxes, box_levels,
Same as `multilevel_matmul_crop_and_resize` but uses tf.image.crop_and_resize.
Same as `multilevel_matmul_crop_and_resize` but uses tf.image.crop_and_resize.
"""
"""
if
box_levels
is
None
:
if
box_levels
is
None
:
return
native_crop_and_resize
(
images
[
0
],
boxes
,
crop_size
,
scope
=
None
)
return
native_crop_and_resize
(
images
[
0
],
boxes
,
crop_size
,
scope
)
cropped_feature_list
=
[]
cropped_feature_list
=
[]
for
level
,
image
in
enumerate
(
images
):
for
level
,
image
in
enumerate
(
images
):
# For each level, crop the feature according to all boxes
# For each level, crop the feature according to all boxes
# set the cropped feature not at this level to 0 tensor.
# set the cropped feature not at this level to 0 tensor.
cropped
=
native_crop_and_resize
(
image
,
boxes
,
crop_size
)
# TODO: consider more efficient way of computing cropped features.
cropped
=
native_crop_and_resize
(
image
,
boxes
,
crop_size
,
scope
)
cond
=
tf
.
tile
(
tf
.
equal
(
box_levels
,
level
)[:,
:,
tf
.
newaxis
],
cond
=
tf
.
tile
(
tf
.
equal
(
box_levels
,
level
)[:,
:,
tf
.
newaxis
],
[
1
,
1
]
+
[
tf
.
math
.
reduce_prod
(
cropped
.
shape
.
as_list
()[
2
:])])
[
1
,
1
]
+
[
tf
.
math
.
reduce_prod
(
cropped
.
shape
.
as_list
()[
2
:])])
cond
=
tf
.
reshape
(
cond
,
cropped
.
shape
)
cond
=
tf
.
reshape
(
cond
,
cropped
.
shape
)
...
...
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