Coder Social home page Coder Social logo

vit_cdfsl's Introduction

Vision Transformers for Cross-domain Few-shot Learning

This code was adapted from the following repositories:

  1. Meta-Dataset
  2. Vision Transformers
  3. Selecting Universal Representations

Install requirements

setup.sh

Get pretrained ViT-B16 model

cd checkpoints/pretrained_ckpts/
!wget https://storage.googleapis.com/vit_models/imagenet21k/ViT-B_16.npz

Prepare meta-dataset following these instructions

Fine tune ViT on new dataset:

-Extract datasets to ./data folder. Set model configs and fine-tune.

-Currently supports fine tuning on CIFAR-10, CIFAR-100, Omniglot, Aircraft, Textures dataset.

-To fine-tune on other datasets add Dataloaders in utils/data_utils.py

python train.py --model_config=vit_configs/dtd_224.gin 

Evaluate single feature extractor on tasks from Meta-Dataset:

python eval_vit.py --testsets dtd  --trainset 'dtd' --img_size 224

Evaluate ViT with Selecting Universal Representations on Meta-Dataset:

python eval_vit_sur.py --testsets cu_birds  --trainset 'imagenet dtd' --img_size 224 --num_tasks 100

Visualize attention maps on image

python visualize_attention.py --test_img data/test_imgs/dog.jpg

vit_cdfsl's People

Contributors

manogna-s avatar

Stargazers

 avatar  avatar  avatar  avatar Li Xiang avatar

Watchers

Howard H. Tang avatar  avatar

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.