Giter Club home page Giter Club logo

cpsn-osfg's Introduction

CPSN-OSFG.PyTorch

Python PyTorch

A simple PyTorch implementation of CPSN (Coupled Patch Similarity Network) for OSFG (One-Shot Fine-Grained Image Recognition).

Coupled Patch Similarity Network For One-Shot Fine-Grained Image Recognition, ICIP2021

Environment

This code is implemented on PyTorch and the experiments were done on a NVIDIA TITAN RTX GPU. So you may need to install

  • Python==3.x
  • torch==1.1.0 or above
  • torchvision==0.3.0
  • tqdm

Datasets

  • CUB-200-2011.
  • StanfordCar.
    In our paper, we just used the CUB-200-2011 dataset and StanfordCar dataset. Note, if you use these datasets, please cite the corresponding papers.

Usage

This repo contains CPSN with feature extractors using Conv64 / ResNet12 in PyTorch form, see ./models/.

  • resnet: Conv64|ResNet12.
  • nExemplars: number of training examples per novel category.
  • nKnovel: number of novel categories.
  • gpu_devices: gpu id.
  • scale_cls: scale the metric scores.
  • phase: use test or val dataset to early stop.
  • num_classes: number of all training categories.

Train a 5-way 1-shot model based on Conv64 or ResNet12:

python ./train.py --dataset CUB  --resnet 0 --num_classes 100 --nExemplars 1
python ./train.py --dataset CUB  --resnet 1 --num_classes 100 --nExemplars 1

Test the model:

python ./test.py --dataset CUB  --resnet 0 --num_classes 100 --nExemplars 1
python ./test.py --dataset CUB  --resnet 1 --num_classes 100 --nExemplars 1

Citation

If this work is useful in your research, please cite

@inproceedings{tian2021coupled,
  title={Coupled Patch Similarity Network FOR One-Shot Fine-Grained Image Recognition},
  author={Tian, Sheng and Tang, Hao and Dai, Longquan},
  booktitle={2021 IEEE International Conference on Image Processing (ICIP)},
  pages={2478--2482},
  year={2021},
  organization={IEEE}
}

References

This implementation builds upon several open-source codes. Specifically, we have modified and integrated the following codes into this repository:

cpsn-osfg's People

Contributors

cser-tang-hao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

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