This is the PyTorch implementation of paper: Hyperbolic Visual Embedding Learning for Zero-Shot Recognition (CVPR 2020)
git clone git@github.com:ShaoTengLiu/Hyperbolic_ZSL.git
cd Hyperbolic_ZSL/code
Hyperbolic_ZSL/code is the default root directory.
- anaconda is recommended
- PyTorch version 1.0 or higher
- At least one GPU with adequate memory
- python 3.7 (python 2 may be possible with modifications)
Use environment.yml for quick start.
conda env create -f environment.yml
Generate data and put them in these folders:
- ../data/train/img: pretrained feature from ResNet of ImageNet
- ../data/val/img: pretrained feature from ResNet of ImageNet
- ../data/train/label: pretrained word embedding from chosen word model
- ../data/val/label: pretrained word embedding from chosen word model
One can run our code via
CUDA_VISIBLE_DEVICES=1 python devise_hype.py \
--word_model poincare \
--model_folder model_path \
--loss_path loss_path \
--dimension 300
- model_path: the folder to save models
- loss_path: the .jpg tp save loss curve
To run DeViSE in Euclidean space via
CUDA_VISIBLE_DEVICES=2 python devise.py \
--word_model glove \
--model_folder model_path \
--loss_path loss_path \
--dimension 600
Tools for computation in Riemannian geometry are not developed by us. One can extend his model to hyperbolic space with these tools. Thanks to these good repos.
-
hyrnn can be found in hyrnn
-
geoopt can be found in geoopt
-
poincare_glove can be found in poincare_glove
-
poincare-embeddings can be found in poincare-embeddings
Code refactoring is still continuing