eric-yyjau/pytorch-superpoint

The original SuperpointNet training don't work

Opened this issue · 1 comments

When I try to train a original SuperpointNet(without batch normal), but the training results will not converge. Is there any parameter I need to modified?
image


Here is my code:

# Shared Encoder.
self.conv1a = torch.nn.Conv2d(1, c1, kernel_size=3, stride=1, padding=1)
self.conv1b = torch.nn.Conv2d(c1, c1, kernel_size=3, stride=1, padding=1)
self.conv2a = torch.nn.Conv2d(c1, c2, kernel_size=3, stride=1, padding=1)
self.conv2b = torch.nn.Conv2d(c2, c2, kernel_size=3, stride=1, padding=1)
self.conv3a = torch.nn.Conv2d(c2, c3, kernel_size=3, stride=1, padding=1)
self.conv3b = torch.nn.Conv2d(c3, c3, kernel_size=3, stride=1, padding=1)
self.conv4a = torch.nn.Conv2d(c3, c4, kernel_size=3, stride=1, padding=1)
self.conv4b = torch.nn.Conv2d(c4, c4, kernel_size=3, stride=1, padding=1)
# Detector Head.
self.convPa = torch.nn.Conv2d(c4, c5, kernel_size=3, stride=1, padding=1)
self.convPb = torch.nn.Conv2d(c5, det_h, kernel_size=1, stride=1, padding=0)
# Descriptor Head.
self.convDa = torch.nn.Conv2d(c4, c5, kernel_size=3, stride=1, padding=1)
self.convDb = torch.nn.Conv2d(c5, d1, kernel_size=1, stride=1, padding=0)

def forward(self, x,):
# Shared Encoder.
x = self.relu(self.conv1a(x))
x = self.relu(self.conv1b(x))
x,ind1 = self.pool(x)
x = self.relu(self.conv2a(x))
x = self.relu(self.conv2b(x))
x,ind2 = self.pool(x)
x = self.relu(self.conv3a(x))
x = self.relu(self.conv3b(x))
x,ind3= self.pool(x)
x = self.relu(self.conv4a(x))
x = self.relu(self.conv4b(x))
# Detector Head.
cPa = self.relu(self.convPa(x))
semi = self.convPb(cPa)

  # Descriptor Head.
  cDa = self.relu(self.convDa(x))
  desc = self.convDb(cDa)
  dn = torch.norm(desc, p=2, dim=1) # Compute the norm.
  desc = desc.div(torch.unsqueeze(dn, 1)) # Divide by norm to normalize.
  out={'semi': semi, 'desc': desc}
  return out

add one