BinItAI/BetterLoader

data_transforms

MarcanBat2a opened this issue · 8 comments

Hi !
Is it possible to use a data transform dictionary?
Like this :

data_transforms = {   
    'train': transforms.Compose([
        transforms.Resize([224,224]),
        transforms.RandomHorizontalFlip(),
        transforms.ToTensor(),
        transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
    ]),
    'val': transforms.Compose([
        transforms.Resize([224,224]),
        transforms.ToTensor(),
        transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
    ]),
    'test': transforms.Compose([
        transforms.Resize([224,224]),
        transforms.ToTensor(),
        transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
    ]),
}

And do you have an example for the dataset_metadata ?

Hey @MarcanBat2a, thanks for reaching out!
I've opened an issue based on your point about a dictionary for the transform, we'll try and get to it by the weekend (do let us know if you'd be willing to help out with it!)

As for the dataset_metadata, I apologize: this package is still a little lacking in documentation. However, you should find a couple of examples of the same here:

  1. Simple Metadata
  2. Regex Metadata
  3. Collate Metadata

Thank you @raghavmecheri for your reply !
I don't have time at the moment but I would be delighted to be able to participate in my free time

I have an another question :
is it possible to have the number of each class for each phase (train, val and test) ?

Thank you @raghavmecheri for your reply !
I don't have time at the moment but I would be delighted to be able to participate in my free time

Sure, of course! We have a couple of issues open at the moment, and I plan to add a few more when I'm free. @JamesBollas is going to be working on #26 though, so we're good on that front :)

I have an another question :
is it possible to have the number of each class for each phase (train, val and test) ?

I'm not sure what you mean? The dataset_metadata field takes a split key -- is that what you're looking for? More on the same can be found here

@raghavmecheri No, but I managed otherwise.
For information, for each training I create a json file which corresponds to all the input parameters.
So I wanted to know the number of images in my dataloader ["train"] for each class, same thing for dataloader ["val"].

@raghavmecheri No, but I managed otherwise.
For information, for each training I create a json file which corresponds to all the input parameters.
So I wanted to know the number of images in my dataloader ["train"] for each class, same thing for dataloader ["val"].

Got it! You should just be able to check the sizes that you receive from the BetterLoader just like how this example does it :)

@MarcanBat2a We've just released v0.2.2, which closes this issue. PyPi should also install this version by default now.

Thanks for bringing this issue to our attention, do let us know if you have any other ideas to improve BetterLoader! :)