oscarknagg / few-shot

Repository for few-shot learning machine learning projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

the size of output of the MatchingNetwork.encoder

hwijeen opened this issue · comments

Hi, thank you for a well-packed blog post and implementation on meta-learning!

I have a question about the implementation of the matching network.

I see that you don't resize Omniglot image, and let an example has a size of 105x105.
This results in the runtime error in the following line, because the input size of LSTM is 64,but the size of 'embedding' is 2304(after self.encoder). The size becomes 64 if the original image is resized to 28x28.

support, _, _ = model.g(support.unsqueeze(1))

This implementation also resizes Omniglot into 28 * 28.

Do you not get this runtime error with the current version of the code? Should I resize image in this part?

def __getitem__(self, item):

In fact this implementation does resize the image however its done in a pre-processing step.

img = transform.resize(img, output_shape, anti_aliasing=True)

The scripts/prepare_omniglot.py script takes the zip files of the raw Omniglot dataset, resizes them to 28x28 and creates new classes by 90, 180 and 270 degree rotations as in the original research.The OmniglotDataset class simply reads the pre-processed images. Did you use this script to perform the pre-processing?

A quick fix would be to add instance = skimage.transform.resize(instance, (28, 28), anti_aliasing=True)) to the __getitem__ method as you suggested.

I didn't run prepare_omniglot script. Thanks for your reply!