Hanzy1996 / CE-GZSL

Codes for the CVPR 2021 paper: Contrastive Embedding for Generalized Zero-Shot Learning
MIT License
91 stars 22 forks source link
zero-shot-learning

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:

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:

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}
}