Commit ad1dac49 authored by Alykhan Tejani's avatar Alykhan Tejani Committed by Francisco Massa
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
......@@ -86,7 +86,7 @@ class Tester(unittest.TestCase):
owidth = random.randint(5, 12) * 2
result = transforms.Compose([
transforms.ToPILImage(),
transforms.Scale((owidth, oheight)),
transforms.Scale((oheight, owidth)),
transforms.ToTensor(),
])(img)
assert result.size(1) == oheight
......@@ -94,7 +94,7 @@ class Tester(unittest.TestCase):
result = transforms.Compose([
transforms.ToPILImage(),
transforms.Scale([owidth, oheight]),
transforms.Scale([oheight, owidth]),
transforms.ToTensor(),
])(img)
assert result.size(1) == oheight
......
......@@ -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):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment