learnables / learn2learn

A PyTorch Library for Meta-learning Research
http://learn2learn.net
MIT License
2.59k stars 348 forks source link

unable to retrieve input images after sampling a task #419

Open farida-bint opened 9 months ago

farida-bint commented 9 months ago

Hi,

I tested MAML and Reptile algorithms using mini-imagenet dataset, and the data are sampled using a TasksetDataset,

Question: Is it normal that after the set of tasks are created, the inputs images (the originals) are no longer there? For each batch in the training loop, I tried to plot the samples (images) but I got blank images presenting few points in it.

I wanted to visualize the results (predictions) of each algorithm in a form of : (input image, prediction, label) but got no image.

l2l-pred

ImahnShekhzadeh commented 8 months ago

[...] and the data are sampled using a TasksetDataset

First of all note that there are only the classes Taskset and TaskDataset, with the latter being deprecated in favor of the first.

Question: Is it normal that after the set of tasks are created, the inputs images (the originals) are no longer there?

Not really, no. I just tested it in the script anil_fc100.py.

Maybe you can share your code?

farida-bint commented 8 months ago

Thanks a lot for your reply,

I already used the Taskset option and it didn't change the results. Below is a screenshot of a Colab file I used to check the input images after sampling some tasks from mini-imagenet train data.

Before sampling the tasks, the input images are all ok

before-sampling

After sampling, the images seem unavailable or maybe transformed

code-for-sampling result-after-sampling

ImahnShekhzadeh commented 8 months ago

In general, it is much easier to read code when it is properly formatted in the text msg, take a look here: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks :slightly_smiling_face:

You might be using a wrong order for defining the MetaDataset and the Taskset, take a look here: https://github.com/learnables/learn2learn/blob/master/examples/vision/anil_fc100.py#L80-L91