Giter Club home page Giter Club logo

pointnetvlad-pytorch's People

Contributors

cattaneod avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pointnetvlad-pytorch's Issues

Confusion about NetVLAD and PointNetVLAD

Hi, thanks for your Pytorch implementation of PointNetVLAD.
I'm a new learner. When I read the code, I'm confused at PointNetVLAD:

def forward(self, x):
x = x.transpose(1, 3).contiguous()
x = x.view((-1, self.max_samples, self.feature_size))
activation = torch.matmul(x, self.cluster_weights)
if self.add_batch_norm:
# activation = activation.transpose(1,2).contiguous()
activation = activation.view(-1, self.cluster_size)
activation = self.bn1(activation)
activation = activation.view(-1,
self.max_samples, self.cluster_size)
# activation = activation.transpose(1,2).contiguous()
else:
activation = activation + self.cluster_biases
activation = self.softmax(activation)
activation = activation.view((-1, self.max_samples, self.cluster_size))
a_sum = activation.sum(-2, keepdim=True)
a = a_sum * self.cluster_weights2
activation = torch.transpose(activation, 2, 1)
x = x.view((-1, self.max_samples, self.feature_size))
vlad = torch.matmul(activation, x)
vlad = torch.transpose(vlad, 2, 1)
vlad = vlad - a
vlad = F.normalize(vlad, dim=1, p=2)
vlad = vlad.view((-1, self.cluster_size * self.feature_size))
vlad = F.normalize(vlad, dim=1, p=2)
vlad = torch.matmul(vlad, self.hidden1_weights)
vlad = self.bn2(vlad)
if self.gating:
vlad = self.context_gating(vlad)
return vlad

According to my view:

  • activation at line 59 represents the distribution of each point n belonging to the cluster k. (the weight)
  • a at line 62 represents the learned cluster
  • But what vlad at line 68 means? Where is the residuals and the sum of them according to points n?

Why not the following:

def forward(self, x):
        x = x.transpose(1, 3).contiguous()
        x = x.view((-1, self.max_samples, self.feature_size)) # [B,N,C]
        activation = torch.matmul(x, self.cluster_weights)
        if self.add_batch_norm:
            # activation = activation.transpose(1,2).contiguous()
            activation = activation.view(-1, self.cluster_size)
            activation = self.bn1(activation)
            activation = activation.view(-1,
                                         self.max_samples, self.cluster_size)
            # activation = activation.transpose(1,2).contiguous()
        else:
            activation = activation + self.cluster_biases
        activation = self.softmax(activation)
        activation = activation.view((-1, self.max_samples, self.cluster_size))
        
        a_sum = activation.sum(-2, keepdim=True)
        a = a_sum * self.cluster_weights2 # [B,C,k]
        
       ### ----------------- different-------------------
        N = x.shape[1]
        residual = x.unsqueeze(-1).repeat(1,1,1,self.cluster_size) - \
                          a.unsqueeze(1).repeat(1,N,1,1)  # [B,C,N,k]
        vlad = activation.unsqueeze(2) * residual
        vlad = torch.sum(vlad, dim=1) # [B,C,k]
       ### ----------------- different-------------------

        # intra-normalization and L2 normalize
        vlad = F.normalize(vlad, dim=1, p=2)    
        vlad = vlad.reshape((-1, self.cluster_size*self.feature_size))
        vlad = F.normalize(vlad, dim=1, p=2)

        # compress into a compact output
        vlad = torch.matmul(vlad, self.hidden1_weights)
        vlad = self.bn2(vlad)

        if self.gating:
            vlad = self.context_gating(vlad)

        return vlad

Is there anything wrong with my understanding?
Thanks in advance!

pre trained model

Hi,it is a great work, I want to do a test, can you provide a pre-trained model, thank you!

Missing import config

The import:
import config as cfg
is missing n the generate_training_tuples_baseline.py script, returning an error when defining the dataset directory name in line 10.

Some curiosity about the training process

Hi, I'm a pytorch user and I'm really grateful that you open source this great work. However, I have some questions about the code. My question is, what are these two global variables HARD_NEGATIVES and TRAINING_LATENT_VECTORS in train_pointnetvlad.py? I notice that in the training process, before epoch 5, they won't be used since they are all empty. But after epoch 5 you will generate some latent_vectors via get_latent_vectors. So I wonder if they're something that help the model converge better, since according to its name (HARD_NAGATIVES), I guess you just select some harder negative samples from the training set. In other words, in the early stage of the training process, you just randomly select samples to train, and then after epoch 5 you select the most difficult samples to train the model more efficiently. Am I correct?

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.