Git Product home page Git Product logo

ce-gzsl's Introduction

CE-GZSL

Codes for the CVPR 2021 paper: Contrastive Embedding for Generalized Zero-Shot Learning [CVPR2021][arxiv].

Keras implementation [code]. Much appreciation for @webcsm's efforts!

generation_framework

Contrastive Embedding for Generalized Zero-Shot Learning

Dependencies

This codes requires the following:

  • Python 3.6
  • Pytorch 1.2.0
  • scikit-learn

Datasets

Download the dataset (AWA1/AWA2/CUB/FLO/SUN) from the work of Xian et al. (CVPR2017), and save correspongding data into directory ./data/. Here, we provide the semantic descriptor for CUB, which is the 1,024-dimensional class embeddings generated from textual descriptions sent_splits.mat.

Train and Test

Run python CE_GZSL.py with the following args:

  • --dataset: datasets, e.g: CUB.

  • --class_embedding: the semantic descriptors to use, e.g: sent or att.

  • --syn_num: number synthetic features for each class.

  • --batch_size: the number of the instances in a mini-batch.

  • --attSize: size of semantic features.

  • --nz: size of the Gaussian noise.

  • --embedSize: size of embedding h.

  • --outzSize: size of non-liner projection z.

  • --nhF: size of the hidden units comparator network F.

  • --ins_weight: weight of the classification loss when learning G.

  • --cls_weight: weight of the score function when learning G.

  • --ins_temp: temperature in instance-level supervision.

  • --cls_temp: temperature in class-level supervision

  • --manualSeed: manual seed.

  • --nclass_all: number of all classes.

  • --nclass_seen: number of seen classes

For example:

python3.6 CE_GZSL.py --dataset CUB --class_embedding sent --syn_num 100 --batch_size 2048 --attSize 1024 --nz 1024 --embedSize 2048 --outzSize 512 --nhF 2048 --ins_weight 0.001 --cls_weight 0.001 --ins_temp 0.1 --cls_temp 0.1 --manualSeed 3483 --nclass_all 200 --nclass_seen 150

Citation

If you find this useful, please cite:

@InProceedings{Han_2021_CVPR,
    author    = {Han, Zongyan and Fu, Zhenyong and Chen, Shuo and Yang, Jian},
    title     = {Contrastive Embedding for Generalized Zero-Shot Learning},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
    month     = {June},
    year      = {2021},
    pages     = {2371-2381}
}

ce-gzsl's People

Contributors

hanzy1996 avatar

Watchers

James Cloos 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.