Giter Club home page Giter Club logo

cvpr2022-task-discrepancy-maximization-for-fine-grained-few-shot-classification's Introduction

Task-Discrepancy-Maximization-for-Fine-grained-Few-Shot-Classification

Official PyTorch Repository of "Task Discrepancy Maximization for Fine-grained Few-Shot Classification (CVPR 2022 Oral Paper)"

Update

[2023/11/21] We released an extended version of TDM (called IAM). It is currently under review, and the code will be released after that.

Bug Fix

[2023/01/03] We omitted the random loss, which prevents overfitting, in training. Please add "--noise" to the training code. Sorry for the confusion.

Data Preparation

The following datasets are used in our paper:

CUB_200_2011: Dataset Page

FGVC-Aircraft: Dataset Page

iNaturalist2017 : Dataset Page

Stanford-Cars : Dataset Page

Stanford-Dogs : Dataset Page

Oxford-Pets : Dataset Page

Please proceed with the setting up data by referring to FRN Github.

Pretrained Weights

Here, all the pretrained weights with ProtoNet and FRN are publicized. Pretrained weights

Usage

Requirement

All the requirements to run the code are in requirements.txt You can download requirements by running below script.

pip install -r requirements.txt

Evaluation

To evaluate the code with pretrained weights, we provide an example script below.

Test the ProtoNet 1-shot in CUB_cropped with Conv-4.
(pretrained_weight: /Proto/CUB_fewshot_cropped/TDM/Conv4-1shot/model_Conv-4.pth)

python3 test.py --train_way 5 --train_shot 1 --gpu_num 1 --model Proto --dataset cub_cropped --TDM

Test the ProtoNet 5-shot in CUB_cropped with Conv-4.
(pretrained_weight: /Proto/CUB_fewshot_cropped/TDM/Conv4-5shot/model_Conv-4.pth)

python3 test.py --train_way 5 --train_shot 5 --gpu_num 1 --model Proto --dataset cub_cropped --TDM

Test the FRN 1-shot and 5-shot in CUB_cropped with Conv-4.
(pretrained_weight: /FRN/CUB_fewshot_cropped/TDM/Conv4-5shot/model_Conv-4.pth)

python3 test.py --train_way 5 --train_shot 5 --gpu_num 1 --model FRN --dataset cub_cropped --TDM

Train

We provide scripts for training. Other shell scripts are in the scripts directory.

python3 train.py --model Proto --dataset aircraft --opt sgd --lr 1e-1 --gamma 1e-1 --epoch 400 --stage 3 --val_epoch 20 --weight_decay 5e-4 --nesterov --train_way 30 --train_shot 1 --train_transform_type 0 --test_shot 1 --pre --gpu_num 1

Results

As we mentioned in our supplementary, we found that CTX and DSN show better performances in 1-shot when they are evaluated by models trained with 5-shot episodes. Therefore, we trained all models with 5-shot episodes except ProtoNet because it shows performance degradation.

CUB_cropped

CUB_raw

Aircraft

meta-iNat & tiered meta-iNat

Citation

If you find TDM helpful for your works, please consider citing:

@InProceedings{Lee_2022_CVPR,
    author    = {Lee, SuBeen and Moon, WonJun and Heo, Jae-Pil},
    title     = {Task Discrepancy Maximization for Fine-Grained Few-Shot Classification},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2022},
    pages     = {5331-5340}
}

Contact

If there are any questions, please feel free to contact with the authors: SuBeen Lee ([email protected]) WonJun Moon ([email protected]). Thank you.

cvpr2022-task-discrepancy-maximization-for-fine-grained-few-shot-classification's People

Contributors

leesb7426 avatar wjun0830 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cvpr2022-task-discrepancy-maximization-for-fine-grained-few-shot-classification's Issues

Regarding the fourth formula

By reading your article, the channel wise representativeness score is calculated through variance。But images often have a non Gaussian distribution, is it appropriate to use variance for measurement?

The function of fully connected blocks

Hi. Why use fully connected blocks to transform those two scores to two weights? There are some other easy ways like softmax. How do you design this architecture?
Thanks a lot.

About Formula 4

Hi! What is the meaning of the double vertical symbol in Formula 4, and can you provide an explanation? Is it a European distance?Is this value directly proportional to discrimination?

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.