Official Implementation of "Geometric Multimodal Contrastive Representation Learning", ICML 2022.
@article{poklukar2022gmc,
title={Geometric Multimodal Contrastive Representation Learning},
author={Poklukar, Petra and Vasco, Miguel and Yin, Hang and Melo, Francisco S and Paiva, Ana and Kragic, Danica},
journal={arXiv preprint arXiv:2202.03390},
year={2022}
}
conda env create -f gmc.yml
conda activate GMC
poetry install
Additionally, to set up the Delaunay Component Analysis evaluation framework by following the instructions on the official repository.
cd gmc_code/
bash download_unsupervised_dataset.sh
bash download_supervised_dataset.sh
bash download_rl_dataset.sh
This repository contains the code to replicate the experiments presented in the paper within the gmc_code
folder. In every experiment, please set up the corresponding local machine path in ingredients/machine_ingredients.py
file by copying the output of pwd
to the ingredient file (e.g. for the unsupervised experiment):
cd unsupervised/
pwd
# Edit unsupervised/ingredients/machine_ingredients.py
@machine_ingredient.config
def machine_config():
m_path = "copy-output-of-pwd-here"
To replicate the results, download the pretrained models:
cd gmc_code/
bash download_unsupervised_pretrain_models.sh
bash download_supervised_pretrain_models.sh
bash download_rl_pretrain_models.sh
echo "** Train GMC"
python main_unsupervised.py -f with experiment.stage="train_model"
echo "** Train classifier"
python main_unsupervised.py -f with experiment.stage="train_downstream_classfier"
echo "** Evaluate GMC - Classification"
python main_unsupervised.py -f with experiment.evaluation_mods=[0,1,2,3] experiment.stage="evaluate_downstream_classifier"
echo "** Evaluate GMC - DCA"
python main_unsupervised.py -f with experiment.stage="evaluate_dca"
- To evaluate with partial observations, select between
[0], [1], [2], [3]
inexperiment.evaluation_mods
; - The DCA results are saved in the
evaluation/gmc_mhd/log_0/results_dca_evaluation/
folder. For example, geometric alignement of complete and image representations are given in thejoint_m1/DCA_results_version0.log
file.
echo "** Train representation model"
python main_supervised.py -f with experiment.scenario="mosei" experiment.stage="train_model"
echo "** Evaluate GMC - Classification"
python main_supervised.py -f with experiment.scenario="mosei" experiment.evaluation_mods=[0,1,2] experiment.stage="evaluate_downstream_classifier"
echo "** Evaluate GMC - DCA"
python main_supervised.py -f with experiment.scenario="mosei" experiment.stage="evaluate_dca"
- You can use CMU-MOSI dataset for both training and evaluation by setting
experiment.scenario="mosi"
; - To evaluate with partial observations, select between
[0], [1], [2]
inexperiment.evaluation_mods
; - The DCA results are saved in the
evaluation/gmc_mosei/log_0/results_dca_evaluation/
folder. For example, geometric alignement of complete and text representations are given in thejoint_m1/DCA_results_version0.log
file.
echo "** Train representation model"
python main_rl.py -f with experiment.stage="train_model"
echo "** Train controller"
python main_rl.py -f with experiment.stage="train_downstream_controller"
echo "** Evaluate GMC - RL Performance"
python main_rl.py -f with experiment.evaluation_mods=[0,1] experiment.stage="evaluate_downstream_controller"
echo "** Evaluate GMC - DCA"
python main_rl.py -f with experiment.stage="evaluate_dca"
- To evaluate with partial observations, select between
[0], [1]
inexperiment.evaluation_mods
; - The DCA results are saved in the
evaluation/gmc_pendulum/log_0/results_dca_evaluation/
folder. For example, geometric alignement of complete and text representations are given in thejoint_m1/DCA_results_version0.log
file.
For any additional questions, feel free to email `miguel.vasco[at]tecnico.ulisboa.pt".