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
8c958554
Unverified
Commit
8c958554
authored
May 05, 2020
by
Ashish Malhotra
Committed by
GitHub
May 05, 2020
Browse files
Add docs to clarify aspect ratio definition. (#2185)
parent
e1a30427
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
torchvision/models/detection/rpn.py
torchvision/models/detection/rpn.py
+3
-1
No files found.
torchvision/models/detection/rpn.py
View file @
8c958554
...
...
@@ -37,7 +37,8 @@ class AnchorGenerator(nn.Module):
image sizes.
The module support computing anchors at multiple sizes and aspect ratios
per feature map.
per feature map. This module assumes aspect ratio = height / width for
each anchor.
sizes and aspect_ratios should have the same number of elements, and it should
correspond to the number of feature maps.
...
...
@@ -74,6 +75,7 @@ class AnchorGenerator(nn.Module):
# TODO: https://github.com/pytorch/pytorch/issues/26792
# For every (aspect_ratios, scales) combination, output a zero-centered anchor with those values.
# (scales, aspect_ratios) are usually an element of zip(self.scales, self.aspect_ratios)
# This method assumes aspect ratio = height / width for an anchor.
def
generate_anchors
(
self
,
scales
,
aspect_ratios
,
dtype
=
torch
.
float32
,
device
=
"cpu"
):
# type: (List[int], List[float], int, Device) # noqa: F821
scales
=
torch
.
as_tensor
(
scales
,
dtype
=
dtype
,
device
=
device
)
...
...
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