"git@developer.sourcefind.cn:OpenDAS/torchaudio.git" did not exist on "d9bfb708b2238778bcdf8e9e6f82b40ee0883887"
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): ...@@ -86,7 +86,7 @@ class Tester(unittest.TestCase):
owidth = random.randint(5, 12) * 2 owidth = random.randint(5, 12) * 2
result = transforms.Compose([ result = transforms.Compose([
transforms.ToPILImage(), transforms.ToPILImage(),
transforms.Scale((owidth, oheight)), transforms.Scale((oheight, owidth)),
transforms.ToTensor(), transforms.ToTensor(),
])(img) ])(img)
assert result.size(1) == oheight assert result.size(1) == oheight
...@@ -94,7 +94,7 @@ class Tester(unittest.TestCase): ...@@ -94,7 +94,7 @@ class Tester(unittest.TestCase):
result = transforms.Compose([ result = transforms.Compose([
transforms.ToPILImage(), transforms.ToPILImage(),
transforms.Scale([owidth, oheight]), transforms.Scale([oheight, owidth]),
transforms.ToTensor(), transforms.ToTensor(),
])(img) ])(img)
assert result.size(1) == oheight assert result.size(1) == oheight
......
...@@ -165,7 +165,7 @@ class Scale(object): ...@@ -165,7 +165,7 @@ class Scale(object):
Args: Args:
size (sequence or int): Desired output size. If size is a sequence like 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. smaller edge of the image will be matched to this number.
i.e, if height > width, then image will be rescaled to i.e, if height > width, then image will be rescaled to
(size * height / width, size) (size * height / width, size)
...@@ -199,7 +199,7 @@ class Scale(object): ...@@ -199,7 +199,7 @@ class Scale(object):
ow = int(self.size * w / h) ow = int(self.size * w / h)
return img.resize((ow, oh), self.interpolation) return img.resize((ow, oh), self.interpolation)
else: else:
return img.resize(self.size, self.interpolation) return img.resize(self.size[::-1], self.interpolation)
class CenterCrop(object): 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