Can't overwrite Dataset.__init__() method

I am following the Data Loading Tutorial as I am facing a face key point detector problem, but I have an error when executing its code.

If I create the Dataset FaceLandmarksDataset(Dataset) like proposed:

class FaceLandmarksDataset(Dataset):
    ''' Face Pose Detection Dataset '''
    
    def __init__(self, csv, root, transform=None):
        
        self.land_file = pd.read_csv(csv)
        self.root_dir  = root
        self.transform = transform
        
    def __len__(self):
        
        return len(self.land_file)
    
    def __getitem__(self, idx):
        
        img_name = os.path.join(self.root_dir, self.land_file.iloc[idx,0])
        image = io.imread(img_name)
        landmarks = self.land_file.iloc[idx,1:].values.astype('float').reshape(-1, 2)
        sample = {'image': image, 'landmarks': landmarks}
        
        if self.transform: 
            sample = self.transform(sample)
        
        return sample

I get the following error:

TypeError: module.__init__() takes at most 2 arguments (3 given)

Why can’t I customize the init method?

Thanks in advance,
Pablo

How do you create your custom dataset? Where is the error raised exactly?

Just by executing this file so I can create an instance of it.

This is the only code above that in the file:

import os
import numpy as np
import pandas as pd
from skimage import io, transform
import matplotlib.pyplot as plt

import torch
import torch.utils.data as Dataset



# Face Landmarks Pose Estimation
# ------------------------------

def show_landmarks(image, landmarks):
    """Show image with landmarks"""
    plt.imshow(image)
    plt.scatter(landmarks[:, 0], landmarks[:, 1], s=10, marker='.', c='r')