I am trying to make data augmentation for my semantic segmentation task but i got this error , could any one help me. this error appear in the line of augmented = aug(image=x, mask=y) I am trying to make data augmentation for my semantic segmentation task but i got this error , could any one help me. this error appear in the line of augmented = aug(image=x, mask=y)
imagesfile = sorted(glob.glob("/content/drive/MyDrive/Colab
Notebooks/BraTS2020_TrainingData/input_data_3channels/images/*"))
masksfile = sorted(glob.glob("/content/drive/MyDrive/Colab
Notebooks/BraTS2020_TrainingData/input_data_3channels/masks/*"))
augment = True
H = 128
W = 128
for x, y in tqdm(zip(imagesfile, masksfile), total=len(imagesfile)):
name = x.split("/")[-1].split(".")
""" Extracting the name and extension of the image and the mask. """
image_name = name[0]
image_extn = name[1]
name = y.split("/")[-1].split(".")
mask_name = name[0]
mask_extn = name[1]
""" Reading image and mask. """
x = cv2.imread(x)
y = cv2.imread(y)
if augment:
aug = CenterCrop(H, W, p=1.0)
augmented = aug(image=x, mask=y)
x1 = augmented["image"]
y1 = augmented["mask"]
aug = RandomRotate90(p=1.0)
augmented = aug(image=x, mask=y)
x2 = augmented['image']
y2 = augmented['mask']
aug = GridDistortion(p=1.0)
augmented = aug(image=x, mask=y)
x3 = augmented['image']
y3 = augmented['mask']
aug = HorizontalFlip(p=1.0)
augmented = aug(image=x, mask=y)
x4 = augmented['image']
y4 = augmented['mask']
aug = VerticalFlip(p=1.0)
augmented = aug(image=x, mask=y)
x5 = augmented['image']
y5 = augmented['mask']
save_images = [x, x1, x2, x3, x4, x5]
save_masks = [y, y1, y2, y3, y4, y5]
else:
save_images = [x]
save_masks = [y]