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
ad1dac49
Commit
ad1dac49
authored
Sep 16, 2017
by
Alykhan Tejani
Committed by
Francisco Massa
Sep 16, 2017
Browse files
make size param of CenterCrop and RandomCrop (w,h) not (h,w) (#256)
make size param of Scale (h,w) not (w,h)
parent
aa08088e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
test/test_transforms.py
test/test_transforms.py
+2
-2
torchvision/transforms.py
torchvision/transforms.py
+2
-2
No files found.
test/test_transforms.py
View file @
ad1dac49
...
...
@@ -86,7 +86,7 @@ class Tester(unittest.TestCase):
owidth
=
random
.
randint
(
5
,
12
)
*
2
result
=
transforms
.
Compose
([
transforms
.
ToPILImage
(),
transforms
.
Scale
((
o
width
,
oheight
)),
transforms
.
Scale
((
o
height
,
owidth
)),
transforms
.
ToTensor
(),
])(
img
)
assert
result
.
size
(
1
)
==
oheight
...
...
@@ -94,7 +94,7 @@ class Tester(unittest.TestCase):
result
=
transforms
.
Compose
([
transforms
.
ToPILImage
(),
transforms
.
Scale
([
o
width
,
oheight
]),
transforms
.
Scale
([
o
height
,
owidth
]),
transforms
.
ToTensor
(),
])(
img
)
assert
result
.
size
(
1
)
==
oheight
...
...
torchvision/transforms.py
View file @
ad1dac49
...
...
@@ -165,7 +165,7 @@ class Scale(object):
Args:
size (sequence or int): Desired output size. If size is a sequence like
(
w
,
h
), output size will be matched to this. If size is an int,
(
h
,
w
), output size will be matched to this. If size is an int,
smaller edge of the image will be matched to this number.
i.e, if height > width, then image will be rescaled to
(size * height / width, size)
...
...
@@ -199,7 +199,7 @@ class Scale(object):
ow
=
int
(
self
.
size
*
w
/
h
)
return
img
.
resize
((
ow
,
oh
),
self
.
interpolation
)
else
:
return
img
.
resize
(
self
.
size
,
self
.
interpolation
)
return
img
.
resize
(
self
.
size
[::
-
1
]
,
self
.
interpolation
)
class
CenterCrop
(
object
):
...
...
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