I get this error:
RuntimeError: stack expects each tensor to be equal size, but got [3, 530, 500] at entry 0 and [3, 500, 530] at entry 3
image(32bit) and label (4bit) , the same size(500*530), is there anything wrong with my transpose process?
class Resize(object):
“”“Resize image and/or masks.”""
def init(self, imageresize, maskresize):
self.imageresize = imageresize
self.maskresize = maskresize
def call(self, sample):
image, mask = sample[‘image’], sample[‘mask’]
if len(image.shape) == 3:
image = image.transpose(1, 2, 0)
if len(mask.shape) == 3:
mask = mask.transpose(1, 2, 0)
mask = cv2.resize(mask, self.maskresize, cv2.INTER_AREA)
image = cv2.resize(image, self.imageresize, cv2.INTER_AREA)
if len(image.shape) == 3:
image = image.transpose(2, 0, 1)
if len(mask.shape) == 3:
mask = mask.transpose(2, 0, 1)
return {'image': image,
        'mask': mask}