NotImplemented Error while running ImbalancedDatasetSampler
See original GitHub issueI followed the steps exactly according to the readme file. Yet I am getting a notimplemented error. There’s no explanation for the error as well.
Here’s my code: `from torchvision import transforms from torchsampler import ImbalancedDatasetSampler
batch_size = 128 val_split = 0.2 shuffle_dataset=True random_seed=42
dataset_size = len(melanoma_dataset) indices = list(range(dataset_size)) split = int(np.floor(val_split * dataset_size)) if shuffle_dataset : np.random.seed(random_seed) np.random.shuffle(indices) train_indices, test_indices = indices[split:], indices[:split]
train_loader = torch.utils.data.DataLoader(melanoma_dataset,batch_size=batch_size,sampler=ImbalancedDatasetSampler(melanoma_dataset)) test_loader = torch.utils.data.DataLoader(melanoma_dataset,batch_size=batch_size,sampler=test_sampler)`
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
If anyone reads this, this worked for me:
Edit: I suspect it would be faster to not cast the tensor to numpy, so the following change should do the same within the tensor framework:
If you have an int label, try use this: