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
77aa3ea9
Commit
77aa3ea9
authored
Sep 24, 2021
by
Vishnu Banna
Browse files
address comments
parent
39e122f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
8 deletions
+2
-8
official/vision/beta/projects/yolo/ops/loss_utils.py
official/vision/beta/projects/yolo/ops/loss_utils.py
+2
-8
No files found.
official/vision/beta/projects/yolo/ops/loss_utils.py
View file @
77aa3ea9
...
@@ -536,12 +536,6 @@ def _anchor_free_scale_boxes(encoded_boxes,
...
@@ -536,12 +536,6 @@ def _anchor_free_scale_boxes(encoded_boxes,
# build a scaling tensor to get the offset of th ebox relative to the image
# build a scaling tensor to get the offset of th ebox relative to the image
scaler
=
tf
.
convert_to_tensor
([
height
,
width
,
height
,
width
])
scaler
=
tf
.
convert_to_tensor
([
height
,
width
,
height
,
width
])
scale_down
=
lambda
x
,
y
:
x
/
tf
.
cast
(
y
,
x
.
dtype
)
scale_up
=
lambda
x
,
y
:
x
*
tf
.
cast
(
y
,
x
.
dtype
)
if
darknet
:
scale_down
=
tf
.
grad_pass_through
(
scale_down
)
scale_up
=
tf
.
grad_pass_through
(
scale_up
)
# scale the offsets and add them to the grid points or a tensor that is
# scale the offsets and add them to the grid points or a tensor that is
# the realtive location of each pixel
# the realtive location of each pixel
box_xy
=
(
grid_points
+
pred_xy
)
box_xy
=
(
grid_points
+
pred_xy
)
...
@@ -554,8 +548,8 @@ def _anchor_free_scale_boxes(encoded_boxes,
...
@@ -554,8 +548,8 @@ def _anchor_free_scale_boxes(encoded_boxes,
scaled_box
=
tf
.
concat
([
box_xy
,
box_wh
],
axis
=-
1
)
scaled_box
=
tf
.
concat
([
box_xy
,
box_wh
],
axis
=-
1
)
# properly scaling boxes gradeints
# properly scaling boxes gradeints
scaled_box
=
scale
_up
(
scaled_box
,
strid
e
)
scaled_box
=
scale
d_box
*
tf
.
cast
(
stride
,
scaled_box
.
dtyp
e
)
pred_box
=
scale
_down
(
scaled_box
,
(
scaler
*
stride
)
)
pred_box
=
scale
d_box
/
tf
.
cast
(
scaler
*
stride
,
scaled_box
.
dtype
)
return
(
scaler
,
scaled_box
,
pred_box
)
return
(
scaler
,
scaled_box
,
pred_box
)
...
...
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