tristandeleu / pytorch-meta

A collection of extensions and data-loaders for few-shot learning & meta-learning in PyTorch
https://tristandeleu.github.io/pytorch-meta/
MIT License
1.97k stars 256 forks source link

Addition of validation per batch #151

Closed RobvanGastel closed 2 years ago

RobvanGastel commented 2 years ago

Is there an a possibility to add a validation set to every batch, besides the training and test set? I'm stuck on how to adjust the ClassSplitter class to experiment with adding the validation set.

dataset = omniglot("data", ways=5, shots=5, test_shots=15, meta_train=True, download=True)
dataloader = BatchMetaDataLoader(dataset, batch_size=16, num_workers=4)

for batch in dataloader:
    train_inputs, train_targets = batch["train"]
    val_inputs, val_targets = batch["val"]
    test_inputs, test_targets = batch["test"]
RobvanGastel commented 2 years ago

I figured that the proper approach to do is, is by taking some samples from the training set if possible and use it as validation set. As is done in this paper, ''Neural Voice Cloning with a Few Samples'', https://arxiv.org/abs/1802.06006.