Hi To everyone.
I have written code related Random Crop function which has to crop images as the mentioned size outlined.However, I need help to complete code according to height, width, left width, and right width.
In order to provide precise idea, I decide to share my code which is need to be concluded as alluded to reference sizes.
class RandomCrop(object):
def init(self, crop_size):
self.crop_size = (crop_size, crop_size)
def call(self, sample):
img = sample[“image”]
gt = sample[“label”]
# This line has to be completed.# → i, j, h, w = transforms.RandomCrop.get_params(img, output_size=self.crop_size)
new_img = transforms.functional.crop(img, i, j, h, w)
new_gt = transforms.functional.crop(gt, i, j, h, w)
return {'image': new_img,
'label': new_gt}