Giter Club home page Giter Club logo

hyperbolic-image-embeddings's Issues

Calculating Hyperbolicity bug in delta.py?

I have tried to reproduce your hyperbolicity experiments with the cifar10 dataset, using the code in delta.py. I have stumbled across a potential error. In the paper you calculate the relative Hyperbolicity of a dataset by doing the following calculation:

δrel(X) = 2δ(X) / diam(X)

However, in the delta.py δ(X) is not multiplied by 2, giving incorrect results:
delta_rel = delta_hyp(distmat) / diam

When I multiply by 2 it seems to work and I can reproduce the cifar10 hyperbolicity score:

delta_rel = (2 * delta_hyp(distmat)) / diam

Is this change correct?

Can't achieve the accuracy as reported in the paper.

I followed the instruction to run this code, but I can't achieve the accuracy as reported in the paper. As shown in instructions, python train_protonet.py --gpu 0 --hyperbolic --dataset MiniImageNet --dim 1024 --lr 0.001 --c 0.05 --gamma 0.2 --step_size 10 was used at my experiments, the accuracy can only achieve 43.92%, it is a lot behind 51.57% that shown in the paper.

Hyperbolic CNN

Thanks for sharing your great work! Since the hyperbolic neural network is pretty well-defined and I imagine building convolution layers won't be too difficult (correct me if I'm wrong), I was wondering if you guys experimented with building a fully hyperbolic CNN? Can you please share your thoughts regarding that?

A typo on the main plot and poincare_mean implementation

in
https://github.com/KhrulkovV/hyperbolic-image-embeddings/blob/master/hyptorch/pmath.py#L426
you use
https://github.com/KhrulkovV/hyperbolic-image-embeddings/blob/master/hyptorch/pmath.py#L106
but should

def lorenz_factor(x, *, c=1.0, dim=-1, keepdim=False):
    """

    Parameters
    ----------
    x : tensor
        point on Klein disk
    c : float
        negative curvature
    dim : int
        dimension to calculate Lorenz factor
    keepdim : bool
        retain the last dim? (default: false)

    Returns
    -------
    tensor
        Lorenz factor
    """
    return 1 / torch.sqrt(1 - c * x.pow(2).sum(dim=dim, keepdim=keepdim))

Also the comment on
image
And the point HypAvg(x, y) should probably be HypAvg(x, y, z). HypAvg(x, y) should correspond to pmath.geodesic(.5, x, y)

Visualization of the feature embeddings in the hyperbolic space

Hi Valentin,

Thanks for your excellent work and codes. I am very interested in the hyperbolic space, and would like to know how to visualize feature embeddings in the hyperbolic space (as shown in the Fig. 1 of your paper). I didn't find the codes for the feature visualization. Can you please release the codes?

Thanks a lot.

Xiaohan

is it a bug in HyperbolicMLR?

Thanks a lot for sharing your repo. I am new to hyperbolic neural networks, and I learned a lot from your repo.
While i am reading the code of examples/mnist.py, i am curious about why ToPoincare is only applied for x which is calculated by a neural network, whereas, ToPoincare is not applied for p_val in HyperbolicMLR.

p_vals_poincare = pmath.expmap0(self.p_vals, c=c)

consider that they are both need a expmap0 to map them from $R^2$ to $D^2$, won't p_val get a wrong gradient?

The values of '_mobius_add(-x, y, c).norm(dim=-1, p=2, keepdim=keepdim)' are ones

Hi. This is a very interesting and inspiring work. I just use your code to my dataset for computing feature distance. I found that all the values of '_mobius_add(-x, y, c).norm(dim=-1, p=2, keepdim=keepdim' of the line 207 of './hyptorch/pmath.py' tend to be 1. Did you meet the same issue like this or have any suggestions? Thanks.

Poincare distance to origin

Thanks a lot for sharing the repo! In your paper, you presented a nice visualization showing the distribution of hyperbolic distances of embeddings (MNIST vs. Omniglot). I'm wondering from which stage did you obtain the embeddings to calculate those distances?

My guess is the output of the line below. Can you please confirm this is indeed the case?

Thanks!

Reproducing Results

Hello authors,

Sorry to add another issue about this -- I've read everything in the existing (closed) issues, but I'm still having problems reproducing the results.

Here are is what I ran and what I got for CUB 1s5w (conv4):

# CUB 1s5w (conv4) 0.6402 +- 0.002
python train_protonet.py \
  --dataset CUB \
  --shot 1 \
  --lr 0.001 \
  --step 50 \
  --gamma 0.8 \
  --c 0.05 \
  --model convnet \
  --hyperbolic \
  --not-riemannian \
  --dim 1600

### OUTPUT ###
batch 9998: 62.48(49.33)
batch 9999: 62.47(54.67)
batch 10000: 62.47(54.67)
Val Best Acc 0.6809, Test Acc 0.6247
Test Acc 0.6247 + 0.0024

Here are is what I ran and what I got for MiniImageNet 1s5w (conv4):

# MiniImageNet 1s5w (conv4) 0.5443 +- 0.002
python train_protonet.py \
  --dataset MiniImageNet \
  --way 30 \
  --shot 1 \
  --lr 0.005 \
  --step 80 \
  --gamma 0.5 \
  --c 0.01 \
  --model convnet \
  --hyperbolic \
  --not-riemannian \
  --dim 1600

### OUTPUT ###
batch 9998: 52.15(44.00)
batch 9999: 52.15(60.00)
batch 10000: 52.15(42.67)
Val Best Acc 0.5362, Test Acc 0.5215
Test Acc 0.5215 + 0.0020

Reported results and reproduced results

Hi authors, many thanks for your released code, it helps me better to understand your excellent work. A question is that reported results in your paper on the MiniImagenet dataset 1-shot 5-way using 4 Cov is 54.43, while I got less than 40 using your code. Maybe there are some mistakes in my operations, could you tell me some crucial steps when carrying out this code? Thanks very much!

Code to calculate the hyperbolicity of image datasets

Hi! Excellent work! Thank you for releasing the codebase. I wanted to know how to calculate the hyperbolicity of the image datasets (section 3.1 in the paper). I can see a delta.py file in the codebase but no instructions on how to use this. Any help would be appreciated. Thanks in advance!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.