GithubHelp home page GithubHelp logo

leonardo-lyh / glocal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 00why00/glocal

0.0 0.0 0.0 42 KB

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

License: MIT License

Python 100.00%

glocal's Introduction

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.

glocal's People

Contributors

00why00 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.