Few-shot Image Classification: Just Use a Libraryof Pre-trained Feature Extractors and a Simple Classifier: paper
Accepted at ICCV 2021
-
ILSVRC2012: Register at ImageNet and request for a username and an access key to download ILSRVC-2012 data set.
-
CUB-200-2011 Birds: Birds
-
FGVC-Aircraft: Aircraft
-
FC100: FC100
-
Omniglot: Omniglot
-
Texture: Texture
-
Traffic Sign: Traffic Sign
-
FGCVx Fungi: Fungi Annotations
-
Quick Draw: Quick Draw
- Use gsutil to download the data:
gsutil -m cp gs://quickdraw_dataset/full/numpy_bitmap/*.npy data/quickdraw
- Convert numpy files to jpeg images using this conversion code
- VGG Flower: VGG Flower, Labels
python extract_pretrained_features.py <path_to_data> -f <result_folder> -b <batch_size> --gpu <gpu_ID>
- Single library classifier example:
python classifier_single.py data/aircraft --model resnet18 --nway 5 --kshot 1 --kquery 15 --num_epochs 200 --n_problems 600 --hidden_size 512 --lr 0.001 --gamma 0.2
- Full library classifier example:
python classifier_full_library.py data/aircraft --nway 20 --kshot 5 --kquery 15 --num_epochs 100 --n_problems 600 --hidden_size 512 --lr 0.0005 --gamma 0.1
- data_path: path to the folder containing all images:
data/<dataset>
- --model: model name for single classifier (Resnet18, Densenet121, etc.)
- --gpu: GPU ID to be used
- Hyperparameters
- --lr: learning rate for the classifier:
0.001
- --kshot: number of images from each class in training set:
1
- --kquery: number of images from each class in test set:
15
- --nway: number of classes per task:
5
- --hidden_size: hidden state size for the classifier:
1024
- --num_epochs: number of training epochs:
100
- --n_problems: number of tasks used for testing:
600
- --gamma: L2 regularization constant:
0.5
- --linear: Use for a linear NN architecture (no hidden layer)
- --nol2: Use to get rid of L2 regularization
- --soft: Use for soft bagging when applying ensemble method, otherwise hard bagging
- --lr: learning rate for the classifier: