Giter Site home page Giter Site logo

Comments (3)

tristandeleu avatar tristandeleu commented on August 16, 2024

The datasets in Torchmeta are responsible for creating the episodes, so there is currently no way to create a non-episodic version of the dataset (as in iterating over the images without creating episodes). That's why it doesn't behave well with the standard PyTorch DataLoader class out of the box. However the data is there, so there should be a way to add a wrapper around the dataset to convert it to a non-episodic dataset. I will give that a try, thanks for the suggestion!

from pytorch-meta.

renesax14 avatar renesax14 commented on August 16, 2024

The datasets in Torchmeta are responsible for creating the episodes, so there is currently no way to create a non-episodic version of the dataset (as in iterating over the images without creating episodes). That's why it doesn't behave well with the standard PyTorch DataLoader class out of the box. However the data is there, so there should be a way to add a wrapper around the dataset to convert it to a non-episodic dataset. I will give that a try, thanks for the suggestion!

If I wrapped the meta-set with a normal pytorch dataloader do what I want?

from pytorch-meta.

tristandeleu avatar tristandeleu commented on August 16, 2024

Not exactly, because the standard PyTorch DataLoader uses certain defaults which is not quite compatible with PyTorch datasets. See #76 (comment).

On master, you can now use the NonEpisodicWrapper to wrap a Torchmeta dataset into something which will be compatible with the defaults in DataLoader. For example

from torchmeta.datasets.helpers import miniimagenet
from torchmeta.utils.data import NonEpisodicWrapper

from torch.utils.data import DataLoader

dataset = miniimagenet('data', ways=5, shots=5, meta_train=True, download=True)
dataset = NonEpisodicWrapper(dataset)

dataloader = DataLoader(dataset, batch_size=16, shuffle=True, num_workers=4)


for inputs, targets in dataloader:
    print(f'inputs.shape = {inputs.shape}')  # inputs.shape = torch.Size([16, 3, 84, 84])

    targets, class_augmentations = targets
    print(f'targets = {targets}')  # targets = ('n03400231', 'n04258138', 'n03888605', 'n04389033', 'n03400231', 'n04243546', 'n02823428', 'n02105505', 'n03908618', 'n02747177', 'n02101006', 'n01770081', 'n03476684', 'n02687172', 'n02966193', 'n04435653')
    print(f'class_augmentations = {class_augmentations}')  # class_augmentations = tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
    break

from pytorch-meta.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.