• Stars
    star
    380
  • Rank 112,098 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tools for generating mini-ImageNet dataset and processing batches

mini-ImageNet Logo

Tools for mini-ImageNet Dataset

LICENSE Python PyPI Downloads CodeFactor Grade

This repo provides python source code for creating mini-ImageNet dataset from ImageNet and the utils for generating batches during training. This repo is related to our work on few-shot learning: Meta-Transfer Learning.

Summary

About mini-ImageNet

The mini-ImageNet dataset was proposed by Vinyals et al. for few-shot learning evaluation. Its complexity is high due to the use of ImageNet images but requires fewer resources and infrastructure than running on the full ImageNet dataset. In total, there are 100 classes with 600 samples of 84×84 color images per class. These 100 classes are divided into 64, 16, and 20 classes respectively for sampling tasks for meta-training, meta-validation, and meta-test.

Please note that the split files in csv_files folder are created by Ravi and Larochelle (GitHub link). Vinyals et al. didn't include their split files for mini-ImageNet when they first released their paper, so Ravi and Larochelle created their own splits. Additional split files are provided here.

Requirements

  • Python 2.7 or 3.x
  • numpy
  • tqdm
  • opencv-python
  • Pillow

Installation

Install via PyPI:

pip install miniimagenettools

Install via GitHub:

git clone https://github.com/yaoyao-liu/mini-imagenet-tools.git

Usage

First, you need to download the image source files from ImageNet website. If you already have it, you may use it directly. Some people report the ImageNet website is not working. Here is an alternative download link. Please carefully read the terms for ImageNet before you download it.

Filename: ILSVRC2012_img_train.tar
Size: 138 GB
MD5: 1d675b47d978889d74fa0da5fadfb00e

Then clone the repo:

git clone https://github.com:y2l/mini-imagenet-tools.git
cd mini-imagenet-tools

To generate mini-ImageNet dataset from tar file:

python mini_imagenet_generator.py --tar_dir [your_path_of_the_ILSVRC2012_img_train.tar]

To generate mini-ImageNet dataset from untarred folder:

python mini_imagenet_generator.py --imagenet_dir [your_path_of_imagenet_folder]

If you want to resize the images to the specified resolution:

python mini_imagenet_generator.py --tar_dir [your_path_of_the_ILSVRC2012_img_train.tar] --image_resize 100

P.S. In default settings, the images will be resized to 84 × 84.

If you don't want to resize the images, you may set --image_resize 0.

To use the MiniImageNetDataLoader class:

from miniimagenettools.mini_imagenet_dataloader import MiniImageNetDataLoader

dataloader = MiniImageNetDataLoader(shot_num=5, way_num=5, episode_test_sample_num=15)

dataloader.generate_data_list(phase='train')
dataloader.generate_data_list(phase='val')
dataloader.generate_data_list(phase='test')

dataloader.load_list(phase='all')

for idx in range(total_train_step):
    episode_train_img, episode_train_label, episode_test_img, episode_test_label = \
        dataloader.get_batch(phase='train', idx=idx)
    ...

Performance

Check the SOTA results for mini-ImageNet on this page.

Download Processed Images

Download jpg files (Thanks for the contribution by @vainaijr)

Download tar files

Acknowledgement

Model-Agnostic Meta-Learning

Optimization as a Model for Few-Shot Learning

Meta-Learning for Semi-Supervised Few-Shot Classification

@ChristopherDaw

More Repositories

1

meta-transfer-learning

TensorFlow and PyTorch implementation of "Meta-Transfer Learning for Few-Shot Learning" (CVPR2019)
Python
663
star
2

class-incremental-learning

PyTorch implementation of AANets (CVPR 2021) and Mnemonics Training (CVPR 2020 Oral)
Python
425
star
3

few-shot-classification-leaderboard

Leaderboards for few-shot image classification on miniImageNet, tieredImageNet, FC100, and CIFAR-FS.
HTML
332
star
4

minimal-light

A simple and elegant Jekyll theme for an academic personal homepage
SCSS
193
star
5

tiered-imagenet-tools

Tools for generating tieredImageNet dataset and processing batches
Python
67
star
6

e3bm

PyTorch implementation of "An Ensemble of Epoch-wise Empirical Bayes for Few-shot Learning" (ECCV 2020)
Python
48
star
7

CL-DETR

PyTorch implementation of "Continual Detection Transformer for Incremental Object Detection" (CVPR 2023)
25
star
8

social-relation-tensorflow

TensorFlow implementation of "A Domain Based Approach to Social Relation Recognition" (CVPR2017)
Python
24
star
9

yaoyao-liu.github.io

My homepage's source code
CSS
11
star
10

online-hyperparameter-optimization

PyTorch implementation of "Online Hyperparameter Optimization for Class-Incremental Learning" (AAAI 2023 Oral)
Python
10
star
11

URL-Redirect-zh

通过Github实现URL转发
HTML
10
star
12

strata-academic

A simple and elegant jekyll theme for academic personal homepage
CSS
9
star
13

POD-AANets

Code for PODNet w/ AANets
Python
9
star
14

meta-transfer-learning-pytorch

6
star
15

fsl-html-source

HTML
3
star
16

jekyll-jemdoc

Light text markup for creating websites - the Jekyll version
CSS
3
star
17

minimal-light-theme-mpi-inf

A simple and elegant Jekyll theme for an MPI Informatics personal homepage
CSS
2
star
18

URL-Redirect

URL Redirect via GitHub
HTML
1
star
19

face-image-generation

1
star
20

README-Syntax

README document syntax guide,i.e. Github Flavored Markdown syntax introduction
1
star
21

homepage

CSS
1
star
22

minimal-light-project-pages

SCSS
1
star