Hello, I am getting this error “TypeError: ‘numpy.float64’ object cannot be interpreted as an integer” when trying to iterate through my DataLoader.
class MyFramesDataset(Dataset):
    
    def __init__(self, paths, labels, num_frames, transform=None):
        self.video_path = paths
        self.num_of_frames = num_frames
        self.labels = labels
        self.transform = transform

    def __len__(self):
        return(len(self.video_path))
    
    def __getitem__(self, index):
        '''
        Generates one sample of data.
        '''
        label = self.labels[index]
        num_frames = self.num_of_frames[index]  

        X = []
        # Read frames of video specified from video_path 
        for i in range(num_frames):
            image = Image.open(os.path.join(video_path, 'frame{:04d}.jpg'.format(i))).convert('RGB')
            if self.transform:
                image = self.transform(image)
            X.append(image)
            
        X = torch.stack(X, dim=0)
        y = torch.LongTensor(label)    
        return X, y  

transforms = transforms.Compose([
    transforms.Resize(256),
    transforms.CenterCrop(224),
    transforms.ToTensor(),
    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
])

batch_size = 16
train_frame_dataset = MyFramesDataset(train_paths, train_labels, train_num_frames, transforms)
train_dataloader = DataLoader(train_frame_dataset, batch_size, shuffle=False)

for batch_idx, (X, y) in enumerate(train_dataloader):
    print(batch_idx)
    print(X,y)

the error I am getting is: help790×578 76.3 KB