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
8c700f86
Unverified
Commit
8c700f86
authored
Dec 05, 2019
by
Francisco Massa
Committed by
GitHub
Dec 05, 2019
Browse files
Minor torchscript fixes for Mask R-CNN (#1639)
parent
8b4de1cb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
torchvision/models/detection/generalized_rcnn.py
torchvision/models/detection/generalized_rcnn.py
+1
-1
torchvision/ops/poolers.py
torchvision/ops/poolers.py
+1
-1
No files found.
torchvision/models/detection/generalized_rcnn.py
View file @
8c700f86
...
...
@@ -64,7 +64,7 @@ class GeneralizedRCNN(nn.Module):
images
,
targets
=
self
.
transform
(
images
,
targets
)
features
=
self
.
backbone
(
images
.
tensors
)
if
isinstance
(
features
,
torch
.
Tensor
):
features
=
OrderedDict
([(
0
,
features
)])
features
=
OrderedDict
([(
'0'
,
features
)])
proposals
,
proposal_losses
=
self
.
rpn
(
images
,
features
,
targets
)
detections
,
detector_losses
=
self
.
roi_heads
(
features
,
proposals
,
images
.
image_sizes
,
targets
)
detections
=
self
.
transform
.
postprocess
(
detections
,
images
.
image_sizes
,
original_image_sizes
)
...
...
torchvision/ops/poolers.py
View file @
8c700f86
...
...
@@ -139,7 +139,7 @@ class MultiScaleRoIAlign(nn.Module):
size
=
feature
.
shape
[
-
2
:]
possible_scales
=
torch
.
jit
.
annotate
(
List
[
float
],
[])
for
s1
,
s2
in
zip
(
size
,
original_size
):
approx_scale
=
float
(
s1
)
/
s2
approx_scale
=
float
(
s1
)
/
float
(
s2
)
scale
=
2
**
float
(
torch
.
tensor
(
approx_scale
).
log2
().
round
())
possible_scales
.
append
(
scale
)
assert
possible_scales
[
0
]
==
possible_scales
[
1
]
...
...
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