Giter VIP home page Giter VIP logo

fsl_clip's Introduction

Few Shot Learning with CLIP

Fast Prototype of a Few Shot Learning approach using CLIP as visual feature extractor.

  • To Train the models and visualize results please refer to the file FSL Case Study.ipynb (Jupyter-Notebook).

Steps to reproduce the results:

Install

Create conda environment

$ conda create -n clip python=3.6

Activate the environment:

$ conda activate clip  

Install Open AI CLIP dependencies:

$ conda install --yes -c pytorch pytorch=1.7.1 torchvision cudatoolkit=10.2
$ pip install ftfy regex tqdm
$ pip install git+https://github.com/openai/CLIP.git

Check if all dependencies are met comparing to the environment.yml file provided.

Data

Create the folder ./data/coco_crops_few_shot

Place inside the folder the train and test splits. Inside each split folder there must be folders with the name of the class of the images that it contain.

Create the json files required to train/eval the model:

$ python preproc_data.py

Weights

Weights for the pretrained models can be downloaded from:

Fine-tuned ResNet pre-trained in ImageNet: https://drive.google.com/file/d/1OJAYp39uHxQ7kAWvF4B019z_Ns1fR3F2/view?usp=sharing

Fine-Tuned ViT/16 Image Encoder pre-trained with CLIP: https://drive.google.com/file/d/1VUDLb_YDkaZMawkONV5q41sutrUCfJSn/view?usp=sharing

Please create a folder ./models Copy the weights inside this folder.

Training

To train the pre-trained ViT/16 from CLIP, please run:

$ python train_clip.py

TODO: Add arguments of the hyperparams for the training/eval process

fsl_clip's People

Contributors

andrespmd 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.