Skip to content

wayne980/Hyperbolic_ZSL

 
 

Repository files navigation

Hyperbolic ZSL

This is the PyTorch implementation of paper: Hyperbolic Visual Embedding Learning for Zero-Shot Recognition (CVPR 2020)

framework

Using Our Code

git clone git@github.com:ShaoTengLiu/Hyperbolic_ZSL.git
cd Hyperbolic_ZSL/code

Hyperbolic_ZSL/code is the default root directory.

Environment Requirements

  • 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

Data Preparation

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

Quick Start

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

Acknowledgement

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.

Code refactoring is still continuing

About

Hyperbolic Visual Embedding Learning for Zero-Shot Recognition (CVPR 2020)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 96.1%
  • Python 3.9%
  • Shell 0.0%
  • CSS 0.0%
  • Makefile 0.0%
  • PowerShell 0.0%