Skip to content

Pangoraw/horospherical

Repository files navigation

Horospherical Learning with Smart Prototypes

Important

🚧 This repository is still in construction.

overview

This repository contains the code for the article "Horospherical Learning with Smart Prototypes" to be published at BMVC2024. The full paper can be found here.

Generating uniform prototypes

In order to generate uniformly distributed prototypes on the hypersphere (i.e. the boundary of the Poincaré ball), we use the same technique as the one used by Ghadimi Atigh et al. and Wang et Isola. which is to optimize a set of points on the hypersphere by maximizing the pairwise distances between points.

C=252 # Number of classes
D=256 # Number of dimensions
EPOCHS=100_000 # Number of epochs

python prototype_learning.py \
    -c $C \
    -d $D \
    -e $EPOCHS \
    -r prototypesuniform_${D}d_${C}c.npy

After some number crunching, it will generate the file prototypesuniform_256d_10c.npy on disk.

Making "smart" prototypes

In order to assign these randomly generated prototypes according to the method presented in the article, one need to have a label hierarchy and a set of prototypes (one for each node in the hierarchy).

DATASET=cub
python gromov_protos.py \
    -d $D \
    --dataset $DATASET \
    --input-protos prototypesuniform_${D}d_${C}c.npy \
    --output-file prototypesgromov_${D}d_200c.npy

Horospherical Learning

The code for the horospherical classifier presented in the article is located in the file horospherical.py.

Experiments

In the paper, several kind of experiments on classification over hierarchical data is performed.

Image Classification

The code for the image classification experiments is located in folder classification/.

The following datasets have been used:

  • CUB200 - should be downloaded and extracted in the data/ folder under the name data/CUB_200_2011/.
  • CIFAR10 - will be automatically downloaded in the data folder.
  • CIFAR100 - will be automatically downloaded in the data folder.

Semantic Segmentation

TO BE RELEASED.

Point-Cloud Segmentation

TO BE RELEASED.

Dependencies

This code depends on the following python packages.

A conda environment is available in the env.yml file to reproduce the same versions.

Citing

If this repository or the article is helpful to your research, considering citing the corresponding article:

@inproceedings{berg2024horospherical,
  title={Horospherical Learning with Smart Prototypes},
  author={Berg, Paul and Michele, Bjoern and Pham, Minh-Tan and Chapel, Laetitia and Courty, Nicolas},
  booktitle={Proceedings of the British Machine Vision Conference (BMVC)},
  year={2024}
}

About

Horospherical Learning with Smart Prototypes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages