Skip to content
/ Glocal Public

[CVPR 2023] Glocal Energy-based Learning for Few-Shot Open-Set Recognition

License

Notifications You must be signed in to change notification settings

00why00/Glocal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Glocal Energy-based learning

Official implementation of Glocal Energy-based Learning for Few Shot Open-Set Recognition (accepted by CVPR 2023).

[Paper] [BibTex]

Requirements

This repo is tested with Python 3.10, Pytorch 1.13, CUDA 11.6. More recent versions of Python and Pytorch with compatible CUDA versions should also support the code.

Getting Start

1. Prepare Dataset

Dataset Source can be downloaded here.

Download them and move datasets under data folder.

2. Prepare Pretrain Weights

Download pretrain weights here and move them under initialization folder.

3. Running

Just run main.py for training and testing

For example, to train and test the 5-way 1-shot/5-shot setting on MiniImageNet:

python main.py --gpu 0 --max_epoch 100 --attention --energy --energy_loss --open_loss --lr 0.0001 --energy_method sum --pixel_wise --distance pixel_sim --pixel_conv --init_weights [/path/to/pretrained/weights] --dataset MiniImageNet --shot [number of shots] --ahead_combine --top_k [number of k]

to train and test the 5-way 1-shot/5-shot setting on TieredImageNet:

python main.py --gpu 0 --max_epoch 200 --attention --energy --energy_loss --open_loss --lr 0.0002 --energy_method sum --pixel_wise --distance pixel_sim --pixel_conv --init_weights [/path/to/pretrained/weights] --dataset TieredImageNet --shot [number of shots] --ahead_combine --top_k [number of k]

to train and test the 5-way 1-shot/5-shot setting on CIFAR-FS:

python main.py --gpu 0 --max_epoch 100 --attention --energy --energy_loss --open_loss --lr 0.0001 --energy_method sum --pixel_wise --distance pixel_sim --pixel_conv --init_weights [/path/to/pretrained/weights] --dataset CIFAR-FS --shot [number of shots] --ahead_combine --top_k [number of k]

to train and test the 5-way 1-shot/5-shot setting on CIFAR-FS without pixel branch:

python main.py --gpu 0 --max_epoch 100 --attention --energy --energy_loss --open_loss --lr 0.0001 --energy_method sum --init_weights [/path/to/pretrained/weights] --dataset CIFAR-FS --shot [number of shots]

Citation

@InProceedings{Wang_2023_CVPR,
    author    = {Wang, Haoyu and Pang, Guansong and Wang, Peng and Zhang, Lei and Wei, Wei and Zhang, Yanning},
    title     = {Glocal Energy-Based Learning for Few-Shot Open-Set Recognition},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2023},
    pages     = {7507-7516}
}

Acknowledgement

Part of the code is modified from FEAT, SnaTCHer, TANE and RFDNet.

About

[CVPR 2023] Glocal Energy-based Learning for Few-Shot Open-Set Recognition

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages