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
OpenDAS
vision
Commits
536290df
Commit
536290df
authored
Jan 27, 2020
by
eellison
Committed by
Francisco Massa
Jan 27, 2020
Browse files
use // now that it is supported (#1658)
Co-authored-by:
Francisco Massa
<
fvsmassa@gmail.com
>
parent
70f2e3ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
12 deletions
+1
-12
torchvision/models/detection/roi_heads.py
torchvision/models/detection/roi_heads.py
+1
-12
No files found.
torchvision/models/detection/roi_heads.py
View file @
536290df
...
...
@@ -226,17 +226,6 @@ def _onnx_heatmaps_to_keypoints_loop(maps, rois, widths_ceil, heights_ceil,
return
xy_preds
,
end_scores
# workaround for issue pytorch 27512
def
tensor_floordiv
(
tensor
,
int_div
):
# type: (Tensor, int)
result
=
tensor
/
int_div
# TODO: https://github.com/pytorch/pytorch/issues/26731
floating_point_types
=
(
torch
.
float
,
torch
.
double
,
torch
.
half
)
if
result
.
dtype
in
floating_point_types
:
result
=
result
.
trunc
()
return
result
def
heatmaps_to_keypoints
(
maps
,
rois
):
"""Extract predicted keypoint locations from heatmaps. Output has shape
(#rois, 4, #keypoints) with the 4 rows corresponding to (x, y, logit, prob)
...
...
@@ -280,7 +269,7 @@ def heatmaps_to_keypoints(maps, rois):
pos
=
roi_map
.
reshape
(
num_keypoints
,
-
1
).
argmax
(
dim
=
1
)
x_int
=
pos
%
w
y_int
=
tensor_floordiv
(
(
pos
-
x_int
)
,
w
)
y_int
=
(
pos
-
x_int
)
//
w
# assert (roi_map_probs[k, y_int, x_int] ==
# roi_map_probs[k, :, :].max())
x
=
(
x_int
.
float
()
+
0.5
)
*
width_correction
...
...
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