• Stars
    star
    111
  • Rank 314,510 (Top 7 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PyTorch CZSL framework containing GQA, the open-world setting, and the CGE and CompCos methods.

Compositional Zero-Shot Learning

This is the official PyTorch code of the CVPR 2021 works Learning Graph Embeddings for Compositional Zero-shot Learning and Open World Compositional Zero-Shot Learning. The code provides the implementation of the methods CGE, CompCos together with other baselines (e.g. SymNet, AoP, TMN, LabelEmbed+,RedWine). It also provides train and test for the Open World CZSL setting and the new C-GQA benchmark.

Important note: the C-GQA dataset has been updated (see this issue) and the code will automatically download the new version. The results of all models for the updated benchmark can be found in the Co-CGE and KG-SP papers.

Check also:

  • Co-CGE and its repo if you are interested in a stronger OW-CZSL model and a faster OW evaluation code.
  • KG-SP and its repo if you are interested in the partial CZSL setting and a simple but effective OW model.

Setup

  1. Clone the repo

  2. We recommend using Anaconda for environment setup. To create the environment and activate it, please run:

    conda env create --file environment.yml
    conda activate czsl
  1. Go to the cloned repo and open a terminal. Download the datasets and embeddings, specifying the desired path (e.g. DATA_ROOT in the example):
    bash ./utils/download_data.sh DATA_ROOT
    mkdir logs

Training

Closed World. To train a model, the command is simply:

    python train.py --config CONFIG_FILE

where CONFIG_FILE is the path to the configuration file of the model. The folder configs contains configuration files for all methods, i.e. CGE in configs/cge, CompCos in configs/compcos, and the other methods in configs/baselines.

To run CGE on MitStates, the command is just:

    python train.py --config configs/cge/mit.yml

On UT-Zappos, the command is:

    python train.py --config configs/cge/utzappos.yml

Open World. To train CompCos (in the open world scenario) on MitStates, run:

    python train.py --config configs/compcos/mit/compcos.yml

To run experiments in the open world setting for a non-open world method, just add --open_world after the command. E.g. for running SymNet in the open world scenario on MitStates, the command is:

    python train.py --config configs/baselines/mit/symnet.yml --open_world

Note: To create a new config, all the available arguments are indicated in flags.py.

Test

Closed World. To test a model, the code is simple:

    python test.py --logpath LOG_DIR

where LOG_DIR is the directory containing the logs of a model.

Open World. To test a model in the open world setting, run:

    python test.py --logpath LOG_DIR --open_world

To test a CompCos model in the open world setting with hard masking, run:

    python test.py --logpath LOG_DIR_COMPCOS --open_world --hard_masking

References

If you use this code, please cite

@inproceedings{naeem2021learning,
  title={Learning Graph Embeddings for Compositional Zero-shot Learning},
  author={Naeem, MF and Xian, Y and Tombari, F and Akata, Zeynep},
  booktitle={34th IEEE Conference on Computer Vision and Pattern Recognition},
  year={2021},
  organization={IEEE}
}

and

@inproceedings{mancini2021open,
  title={Open World Compositional Zero-Shot Learning},
  author={Mancini, M and Naeem, MF and Xian, Y and Akata, Zeynep},
  booktitle={34th IEEE Conference on Computer Vision and Pattern Recognition},
  year={2021},
  organization={IEEE}
}

Note: Some of the scripts are adapted from AttributeasOperators repository. GCN and GCNII implementations are imported from their respective repositories. If you find those parts useful, please consider citing:

@inproceedings{nagarajan2018attributes,
  title={Attributes as operators: factorizing unseen attribute-object compositions},
  author={Nagarajan, Tushar and Grauman, Kristen},
  booktitle={Proceedings of the European Conference on Computer Vision (ECCV)},
  pages={169--185},
  year={2018}
}

More Repositories

1

ReNO

[NeurIPS 2024] ReNO: Enhancing One-step Text-to-Image Models through Reward-based Noise Optimization
Python
69
star
2

UncerGuidedI2I

Uncertainty Guided Progressive GANs for Medical Image Translation
Jupyter Notebook
50
star
3

BayesCap

(ECCV 2022) BayesCap: Bayesian Identity Cap for Calibrated Uncertainty in Frozen Neural Networks
Jupyter Notebook
46
star
4

LanguageGuidance_for_DML

This repository contains the code for our CVPR 2022 paper on "Integrating Language Guidance into Vision-based Deep Metric Learning".
Python
37
star
5

AVCA-GZSL

This repository contains the code for our CVPR 2022 paper on "Audio-visual Generalised Zero-shot Learning with Cross-modal Attention and Language"
Python
32
star
6

ACVC

Official PyTorch implementation of CVPRW 2022 paper "Attention Consistency on Visual Corruptions for Single-Source Domain Generalization"
Python
28
star
7

fomo_in_flux

Code and benchmark for the paper: "A Practitioner's Guide to Continual Multimodal Pretraining" [NeurIPS'24]
28
star
8

ImageSelect

Code for the paper "If at First You Don't Succeed, Try, Try Again: Faithful Diffusion-based Text-to-Image Generation by Selection"
Python
27
star
9

ProbVLM

ProbVLM: Probabilistic Adapter for Frozen Vision-Language Models
Python
26
star
10

UncertaintyAwareCycleConsistency

Building blocks for uncertainty-aware cycle consistency presented at NeurIPS'21.
Python
25
star
11

TCAF-GZSL

This repository contains the code for our ECCV 2022 paper "Temporal and cross-modal attention for audio-visual zero-shot learning"
Python
24
star
12

DataDream

[ECCV 2024] Official repository for "DataDream: Few-shot Guided Dataset Generation"
Python
22
star
13

CLEVR-X

CLEVR-X: A Visual Reasoning Dataset for Natural Language Explanations
Python
20
star
14

ImageFreeZSL

Python
16
star
15

EgoCVR

[ECCV 2024] EgoCVR: An Egocentric Benchmark for Fine-Grained Composed Video Retrieval
Python
16
star
16

Vision_by_Language

[ICLR 2024] Official repository for "Vision-by-Language for Training-Free Compositional Image Retrieval"
Python
16
star
17

sketch-primitives

ECCV 2022: Abstracting Sketches through Simple Primitives
Python
14
star
18

NonIsotropicProxyDML

This repository contains the code for our CVPR 2022 paper on "Non-isotropy Regularization for Proxy-based Deep Metric Learning".
Python
13
star
19

Probabilistic_Deep_Metric_Learning

This repository contains the code for our ECCV 2022 paper on our "Non-isotropic Probabilistic Take on Proxy-based Deep Metric Learning".
Python
12
star
20

KG-SP

PyTorch code of our KG-SP method for Compositional Zero-Shot Learning
Python
11
star
21

WaffleCLIP

Official repository for our paper "Waffling around for Performance: Visual Classification with Random Words and Broad Concepts"
Python
10
star
22

AVDIFF-GFSL

This repository contains the code for our DAGM GCPR 2023 paper "Text-to-feature diffusion for audio-visual few-shot learning"
Python
8
star
23

Spurious_CM_Retrieval

Official PyTorch implementation of CVPR 2023 MULA Workshop paper "Exposing and Mitigating Spurious Correlations for Cross-Modal Retrieval"
7
star
24

rdtc

PyTorch implementation of Learning Decision Trees Recurrently Through Communication (RDTC)
Python
5
star
25

CCL

Code on Paper [CVPR2021]Distilling Audio-Visual Knowledge by Compositional Contrastive Learning
Python
5
star
26

Deep-Graph-Persistence

Code for the paper "Addressing caveats of neural persistence with deep graph persistence".
Python
4
star
27

concept_realignment

Official PyTorch implementation of "Improving Intervention Efficacy via Concept Realignment in Concept Bottleneck Models" (ECCV 2024)
Python
4
star
28

APN

This is a PyTorch implementation of the paper "Attribute Prototype Network for Zero-Shot Learning".
Python
3
star
29

co-cge

Python
2
star
30

Fantastic_Gains

Official repository for "Fantastic Gains and Where to Find Them: On the Existence and Prospect of General Knowledge Transfer between Any Pretrained Model" [ICLR 2024 spotlight]
2
star