Giter VIP home page Giter VIP logo

bsnet's Introduction

BSNet

Code release for the paper BSNet: Bi-Similarity Network for Few-shot Fine-grained Image Classification. (TIP2020)

Requirements

  • python=3.6
  • PyTorch=1.2+
  • torchvision=0.4.2
  • pillow=6.2.1
  • numpy=1.18.1
  • h5py=1.10.2

Dataset

CUB-200-2011

  • Change directory to ./filelists/CUB
  • run source ./download_CUB.sh

Train

  • method: relationnet|CosineBatch|OurNet.
  • n_shot: number of labeled data in each class (1|5).
  • train_aug: perform data augmentation or not during training.
  • gpu: gpu id.
python ./train.py --dataset CUB  --model Conv4 --method relationnet --n_shot 5 --train_aug --gpu 0
python ./train.py --dataset CUB  --model Conv4 --method CosineBatch --n_shot 5 --train_aug --gpu 0
python ./train.py --dataset CUB  --model Conv4 --method OurNet      --n_shot 5 --train_aug --gpu 0

Save features

python ./save_features.py --dataset CUB  --model Conv4 --method relationnet --n_shot 5 --train_aug --gpu 0
python ./save_features.py --dataset CUB  --model Conv4 --method CosineBatch --n_shot 5 --train_aug --gpu 0
python ./save_features.py --dataset CUB  --model Conv4 --method OurNet      --n_shot 5 --train_aug --gpu 0

Test

python ./test.py --dataset CUB  --model Conv4 --method relationnet --n_shot 5 --train_aug --gpu 0
python ./test.py --dataset CUB  --model Conv4 --method CosineBatch --n_shot 5 --train_aug --gpu 0
python ./test.py --dataset CUB  --model Conv4 --method OurNet      --n_shot 5 --train_aug --gpu 0

results

CUB-200-2011
5-way 5-shot Accuracy (%) 5-way 1-shot Accuracy (%)
Relation Network 77.87 ± 0.64 63.94 ± 0.92
Cosine Network 77.86 ± 0.68 65.04 ± 0.97
BSNet (R&C) 80.99 ± 0.63 65.89 ± 1.00

Citation

If you find this paper useful in your research, please consider citing:

@ARTICLE{9293172,
  author={X. {Li} and J. {Wu} and Z. {Sun} and Z. {Ma} and J. {Cao} and J. -H. {Xue}},
  journal={IEEE Transactions on Image Processing}, 
  title={BSNet: Bi-Similarity Network for Few-shot Fine-grained Image Classification}, 
  year={2021},
  volume={30},
  number={},
  pages={1318-1331},
  doi={10.1109/TIP.2020.3043128}}

References

Our code is based on Chen's contribution. Specifically, except for our core design, cosine network and BSNet, everything else (e.g. backbone, dataset, relation network, evaluation standards, hyper-parameters)are built on and integrated in https://github.com/wyharveychen/CloserLookFewShot.

Contact

Thanks for your attention! If you have any suggestion or question, you can leave a message here or contact us directly:

bsnet's People

Contributors

spraise avatar dongliangchang 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.