GithubHelp home page GithubHelp logo

shiyuanh / tane Goto Github PK

View Code? Open in Web Editor NEW
24.0 6.0 5.0 48 KB

Code Repository for "Task-Adaptive Negative Envision for Few-Shot Open-Set Recognition"

License: MIT License

Python 100.00%
computer-vision few-shot-open-set-recognition few-shot meta-learning cvpr2022

tane's Introduction

Task-Adaptive Negative Envision for Few-Shot Open-Set Recognition

This is the code repository for "Task-Adaptive Negative Envision for Few-Shot Open-Set Recognition" (accepted by CVPR 2022).

Installation

This repo is tested with Python 3.6, Pytorch 1.8, CUDA 10.1. More recent versions of Python and Pytorch with compatible CUDA versions should also support the code.

Data Preparation

MiniImageNet image data are provided by RFS, available at DropBox. We also provide the word embeddings for the class names here. For TieredImageNet, we use the image data and word embeddings provided by AW3, available at GoogleDrive. Download and put them under your <data_dir>.

Pre-trained models

We provide the pre-trained models for TieredImageNet and MiniImageNet, which can be downloaded here. Save the pre-trained model to <pretrained_model_path>.

Training

An example of training command for 5-way 1-shot FSOR:

python train.py --dataset <dataset> --logroot <log_root>  --data_root <data_dir> \ 
                --n_ways 5  --n_shots 1 \
                --pretrained_model_path <pretrained_model_path> \
                --featype OpenMeta \
                --learning_rate 0.03 \
                --tunefeat 0.0001 \
                --tune_part 4 \
                --cosine \
                --base_seman_calib 1 \
                --train_weight_base 1 \
                --neg_gen_type semang                 

Testing

An example of testing command for 5-way 1-shot FSOR:

python test.py --dataset <dataset>  --data_root <data_dir> \
               --n_ways 5  --n_shots 1 \
               --pretrained_model_path <pretrained_model_path> \
               --featype OpenMeta \
               --test_model_path <test_model_path> \
               --n_test_runs 1000 \
               --seed <seed> 

Pre-training

We also provide the code for the pre-training stage under pretrain folder. An example of running command for pre-training on miniImageNet:

python batch_process.py --featype EntropyRot --learning_rate 0.05

Citation

If you find this repo useful for your research, please consider citing the paper:

@InProceedings{Huang_2022_CVPR,
    author    = {Huang, Shiyuan and Ma, Jiawei and Han, Guangxing and Chang, Shih-Fu},
    title     = {Task-Adaptive Negative Envision for Few-Shot Open-Set Recognition},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2022},
    pages     = {7171-7180}
}

Acknowledgement

Our code and data are based upon RFS and AW3.

tane's People

Contributors

shiyuanh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

tane's Issues

Question about the code

Great work!
I would like to be able to cite your paper in my own work. However, I have encountered some confusion while reading your code.

  1. Equation 6 in the paper does not seem to appear in the code, but instead is a calibration module that also uses the attention mechanism.
  2. Using the example of training command for 5-way 1-shot FSOR does not seem to yield the correct ATT, ATT-G or SEMAN-G results for FSOR. According to the description in the bottom left corner of page 4 of the paper, the agg parameter should be set to mlp instead of avg.
  3. The current code seems to support only a single negative class estimate.

Looking forward to your reply, best wishes!

Request pretrained models

Hi,

I am highly interested in your work, TANE, and want to reproduce the results.
I found out that your links for pre-trained models only include 'archive' directory with some data not the pre-trained model.
Could you check this problem?

Best

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.