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
e58d3ccd
"...models/git@developer.sourcefind.cn:OpenDAS/vision.git" did not exist on "9293be7e4dd57a9f156ebb71400ba5971acc4841"
Commit
e58d3ccd
authored
Jun 29, 2020
by
syiming
Browse files
fix coding style
parent
ca0acc9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
research/object_detection/utils/spatial_transform_ops.py
research/object_detection/utils/spatial_transform_ops.py
+6
-6
No files found.
research/object_detection/utils/spatial_transform_ops.py
View file @
e58d3ccd
...
@@ -411,7 +411,7 @@ def multilevel_roi_align(features, boxes, box_levels, output_size,
...
@@ -411,7 +411,7 @@ def multilevel_roi_align(features, boxes, box_levels, output_size,
return
features_per_box
return
features_per_box
def
multilevel_native_crop_and_resize
(
images
,
boxes
,
box_levels
,
def
multilevel_native_crop_and_resize
(
images
,
boxes
,
box_levels
,
crop_size
,
scope
=
None
):
crop_size
,
scope
=
None
):
"""Multilevel native crop and resize.
"""Multilevel native crop and resize.
...
@@ -426,7 +426,7 @@ def multilevel_native_crop_and_resize(images, boxes, box_levels,
...
@@ -426,7 +426,7 @@ def multilevel_native_crop_and_resize(images, boxes, box_levels,
# TODO: consider more efficient way of computing cropped features.
# TODO: consider more efficient way of computing cropped features.
cropped
=
native_crop_and_resize
(
image
,
boxes
,
crop_size
,
scope
)
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
)
cropped_final
=
tf
.
where
(
cond
,
cropped
,
tf
.
zeros_like
(
cropped
))
cropped_final
=
tf
.
where
(
cond
,
cropped
,
tf
.
zeros_like
(
cropped
))
cropped_feature_list
.
append
(
cropped_final
)
cropped_feature_list
.
append
(
cropped_final
)
...
@@ -453,15 +453,15 @@ def native_crop_and_resize(image, boxes, crop_size, scope=None):
...
@@ -453,15 +453,15 @@ def native_crop_and_resize(image, boxes, crop_size, scope=None):
return
tf
.
reshape
(
cropped_regions
,
final_shape
)
return
tf
.
reshape
(
cropped_regions
,
final_shape
)
def
multilevel_matmul_crop_and_resize
(
images
,
boxes
,
box_levels
,
crop_size
,
def
multilevel_matmul_crop_and_resize
(
images
,
boxes
,
box_levels
,
crop_size
,
extrapolation_value
=
0.0
,
scope
=
None
):
extrapolation_value
=
0.0
,
scope
=
None
):
"""Multilevel native crop and resize.
"""Multilevel native crop and resize.
Same as `matmul_crop_and_resize` but crop images according to box levels.
Same as `matmul_crop_and_resize` but crop images according to box levels.
Args:
Args:
images: A list of 4-D tensor of shape
images: A list of 4-D tensor of shape
[batch, image_height, image_width, depth] representing features of
[batch, image_height, image_width, depth] representing features of
different size.
different size.
boxes: A `Tensor` of type `float32` or 'bfloat16'.
boxes: A `Tensor` of type `float32` or 'bfloat16'.
A 3-D tensor of shape `[batch, num_boxes, 4]`. The boxes are specified in
A 3-D tensor of shape `[batch, num_boxes, 4]`. The boxes are specified in
...
@@ -481,7 +481,7 @@ def multilevel_matmul_crop_and_resize(images, boxes, box_levels, crop_size,
...
@@ -481,7 +481,7 @@ def multilevel_matmul_crop_and_resize(images, boxes, box_levels, crop_size,
to be positive.
to be positive.
extrapolation_value: a float value to use for extrapolation.
extrapolation_value: a float value to use for extrapolation.
scope: A name for the operation (optional).
scope: A name for the operation (optional).
Returns:
Returns:
A 5-D tensor of shape `[batch, num_boxes, crop_height, crop_width, depth]`
A 5-D tensor of shape `[batch, num_boxes, crop_height, crop_width, depth]`
"""
"""
...
...
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