Giter Club home page Giter Club logo

pretrainedfulllibrary_fewshot's Introduction

Few-shot Image Classification: Just Use a Libraryof Pre-trained Feature Extractors and a Simple Classifier: paper

Accepted at ICCV 2021

Use the following links to download the data:

  1. ILSVRC2012: Register at ImageNet and request for a username and an access key to download ILSRVC-2012 data set.

  2. CUB-200-2011 Birds: Birds

  3. FGVC-Aircraft: Aircraft

  4. FC100: FC100

  5. Omniglot: Omniglot

  6. Texture: Texture

  7. Traffic Sign: Traffic Sign

  8. FGCVx Fungi: Fungi Annotations

  9. Quick Draw: Quick Draw

  • Use gsutil to download the data:
gsutil -m cp gs://quickdraw_dataset/full/numpy_bitmap/*.npy data/quickdraw
  1. VGG Flower: VGG Flower, Labels

Extracting Pretrained Library Features (PyTorch):

python extract_pretrained_features.py <path_to_data> -f <result_folder> -b <batch_size> --gpu <gpu_ID>

Few-shot training and testing:

  • 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

Selected arguments

  • 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.