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
fe973cee
Commit
fe973cee
authored
Aug 02, 2018
by
Ryan Peach
Committed by
Francisco Massa
Aug 02, 2018
Browse files
Removed the +1 and divide by 2 to allow for random offset padding (#564)
parent
be68e244
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
torchvision/transforms/transforms.py
torchvision/transforms/transforms.py
+2
-2
No files found.
torchvision/transforms/transforms.py
View file @
fe973cee
...
...
@@ -445,10 +445,10 @@ class RandomCrop(object):
# pad the width if needed
if
self
.
pad_if_needed
and
img
.
size
[
0
]
<
self
.
size
[
1
]:
img
=
F
.
pad
(
img
,
(
int
((
1
+
self
.
size
[
1
]
-
img
.
size
[
0
]
)
/
2
)
,
0
),
self
.
fill
,
self
.
padding_mode
)
img
=
F
.
pad
(
img
,
(
self
.
size
[
1
]
-
img
.
size
[
0
],
0
),
self
.
fill
,
self
.
padding_mode
)
# pad the height if needed
if
self
.
pad_if_needed
and
img
.
size
[
1
]
<
self
.
size
[
0
]:
img
=
F
.
pad
(
img
,
(
0
,
int
((
1
+
self
.
size
[
0
]
-
img
.
size
[
1
])
/
2
))
,
self
.
fill
,
self
.
padding_mode
)
img
=
F
.
pad
(
img
,
(
0
,
self
.
size
[
0
]
-
img
.
size
[
1
]),
self
.
fill
,
self
.
padding_mode
)
i
,
j
,
h
,
w
=
self
.
get_params
(
img
,
self
.
size
)
...
...
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