mboudiaf / pytorch-meta-dataset

A non-official 100% PyTorch implementation of META-DATASET benchmark for few-shot classification
59 stars 9 forks source link

Normalize should map image tensors in the range -1 to 1 to be compatible with Meta-Dataset #2

Closed jfb54 closed 3 years ago

jfb54 commented 3 years ago

Instead of the ImageNet friendly normalize transform:

normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])

use the following:

normalize = transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])

as Meta-Dataset guarantees that all images will be normalized in the range -1 to 1.

mboudiaf commented 3 years ago

Indeed, the transforms that I've put in my example don't scrupulously follow the ones from the original dataset. This should not make a big difference though. Still, I will modify to follow those at https://github.com/google-research/meta-dataset/blob/a38e8cea0f60e3aa1edb4424f5574c10e355f3d4/meta_dataset/data/decoder.py#L74

jfb54 commented 3 years ago

Awesome. Thanks!