yaoyao-liu/tiered-imagenet-tools

I ran the mini_imagenet_generator.py and only the floder tiered_imagenet generated

lampardwk opened this issue · 10 comments

Thank you for sharing such great work. I'm new to it and it helps me a lot. I ran the tiered_imagenet_generator.py and only the floder tiered_imagenet generated. This folder contains trian, val, and test. Further, the processed_images directory is not created. Can I sample images directly from each of the three folders in tiered_imagenet directory to generate the NwayKshot task for train,val,test ? In my code, the MiniImagenet dataset also takes this form.

Hi,

Thanks for your interest in our work!

This project will not directly generate N-way K-shot tasks. You may use a dataloader like this one to load images from train, val, and test folders to generate tasks during meta-training and meta-testing.

Thank you very much for your timely reply!Sorry to bother you again, I ran the tiered_imagenet_generator.py and only the floder tiered_imagenet generated(about 4G), Can I use dataloader you said directly on this folder generate N-way K-shot tasks in my project? But the processed tieredimagenet datasets you provide is about 18G.

Hi,

When running the project, the tasks will only be generated when they are used, and they won't be stored on the disk.

The whole tieredImageNet is about 19.4G. Maybe the dataset you generated is not completed. You may directly download tireredImageNet with this link.

I got it. Thank you for your generous help!

@yaoyao-liu Sorry to bother you again, I am using miniImagenet and Tieredimagenet data sets to perform pre-training in few shot learning algorithm(for example,MAML). I saw your other excellent article about the miniImagenet dataset pre-training process. For instance, there are totally 64 classes in the training split of miniimagenet and each class contains 600 samples used to pre-train a 64-class classifier,then the feature extractor is learned. In the next meta-train process, fixed feature Extractor only updates the weight of the last full connection layer. There are some problems with both pre-training and meta-train using the same 'train' in miniImagenet?

I don't fully understand your question. Could you please make it more specific?

If you wonder why we use the same samples for pre-training and meta-training phase, the answer is as follows,
It is because of the benchmark we use. If we use miniImageNet, we are not allowed to use other samples to train the model except for the samples in the meta-train set of miniImageNet. In real-world applications, you can pre-train the model on a larger dataset, e.g., ImageNet and than meta-train the model on your own meta-train set.

Thank you for your quick reply!I don't know if I'm right. In my opinion,if use the same samples for pre-training and meta-training phase, think of pre-training as a special case of NwayKshot,(N=64, K=600), feature extractor obtained in this way is definitely better(because more way and more shot). It's like adding more samples artificially. Is it against the original purpose(few shot)?And in meta-train,the sampled images have been used in pre-training. Is that not a very rigorous way?

All the meta-learning-based methods for few-shot classification are based on transfer learning. That means we can use all the samples and their labels for the source domain (meta-train set). ''Few-shot'' means we only have a few labeled data for the target domain (meta-test set). So it is not against the original purpose for few-shot classification. The original purpose of meta-learning-based methods is using many-shot labeled data (e.g. ImageNet) to improve the performance for novel class data with a few labeled samples (e.g. medical images).

We use the same samples for pre-training and meta-training because we're only allowed to access limited data and we need to make most of them. We won't do the same thing in real-world applications.

I agree that the current benchmark for few-shot classification is not optimal. But if you hope to compare your results with all previous papers, you need to follow that. Of course, you can propose your own benchmark protocol, but you need to re-implement the previous methods in the same protocol for fair comparison.

Thank you for your patient reply! That was a wonderful explanation! I got it. Then, During each iteration of pre-training, shall we input all images in all categories into the network at once or sampling a certain number of images from all images produces a batch?

For the details of the pre-training phase, you may follow this repo.