Hi~
I find one question in train/cityscapes-fcn/train.py:
short_size = int(min(args['input_size']) / 0.875)
train_joint_transform = joint_transforms.Compose([
joint_transforms.Scale(short_size),
joint_transforms.RandomCrop(args['input_size']),
joint_transforms.RandomHorizontallyFlip()
])
And this is the code of function _joint_transforms.Scale(shortsize):
class Scale(object):
def init(self, size):
self.size = size
def __call__(self, img, mask):
assert img.size == mask.size
w, h = img.size
if (w >= h and w == self.size) or (h >= w and h == self.size):
return img, mask
if w > h:
ow = self.size
oh = int(self.size * h / w)
return img.resize((ow, oh), Image.BILINEAR), mask.resize((ow, oh), Image.NEAREST)
else:
oh = self.size
ow = int(self.size * w / h)
return img.resize((ow, oh), Image.BILINEAR), mask.resize((ow, oh), Image.NEAREST)
for example: the image size is 512256, and args['input_size'] =(256,512)
Dose that mean resize the image to 292146(2568/7=292, 256292/512=146)? And after that function joint_transforms.RandomCrop resize it back to 256*512.
Why should we do such thing?
Hi~ I find one question in train/cityscapes-fcn/train.py: short_size = int(min(args['input_size']) / 0.875) train_joint_transform = joint_transforms.Compose([ joint_transforms.Scale(short_size), joint_transforms.RandomCrop(args['input_size']), joint_transforms.RandomHorizontallyFlip() ]) And this is the code of function _joint_transforms.Scale(shortsize):
class Scale(object): def init(self, size): self.size = size
for example: the image size is 512256, and args['input_size'] =(256,512) Dose that mean resize the image to 292146(2568/7=292, 256292/512=146)? And after that function joint_transforms.RandomCrop resize it back to 256*512. Why should we do such thing?