import numpy as np 
import pandas as pd
import torch 
import torch.nn as nn
from skimage import io
# image = io.imread(self.image_path[item])
# mask and img learnt from Awsaf's Notebook
class CustomDataset(torch.utils.data.Dataset):
    def __init__(self,image_paths,mask_paths = None,augmentations,preprocessing_fn=None):
        self.image_paths = image_paths
        self.mask_paths = mask_paths
        self.augmentations = augmentations
    def __len__(self):
        return len(self.image_paths)
    
    def __getitem__(self,item):
        image = io.imread(self.image_path[item])
     
        if mask_paths is not None:
            mask = np.load(mask_paths[item])
        
            augmented = self.augmentations(image=image,mask=mask)
            image = augmented["image"]
            mask = augmented["mask"]
            image = np.transpose(image, (2, 0, 1)).astype(np.float32)
            mask = np.transpose(mask, (2, 0, 1)).astype(np.float32)
            
            if preprocessing_fn is not None:
                image = self.preprocessing_fn(image)
            return {
                "image": torch.tensor(image, dtype=torch.float),
                "mask": torch.tensor(mask, dtype=torch.float)
            }
        else:
            augmented = self.augmentations(image=image)
            image = augmented["image"]
            image = np.transpose(image,(2,0,1)).astype(np.float32)
            if preprocessing_fn is not None:
                image = self.preprocessing_fn(image)
            return {
                "image": torch.tensor(image, dtype=torch.float)
            }

File “/tmp/ipykernel_39/3960429903.py”, line 9
def init(self,image_paths,mask_paths = None,augmentations,preprocessing_fn=None):
^
SyntaxError: non-default argument follows default argument