MCPcopy Create free account
hub / github.com/MetaSLAM/SphereVLAD / train_lcd

Method train_lcd

models/robotLCD.py:74–95  ·  view source on GitHub ↗

[summary] Args: x ([type]): [description]

(self, x)

Source from the content-addressed store, hash-verified

72 self.load_checkpoint(config.WEIGHT.LOAD_ADDRESS)
73
74 def train_lcd(self, x):
75 """[summary]
76 Args:
77 x ([type]): [description]
78 """
79
80 self.model.train()
81 data = torch.cat(x, dim=1)
82 B = data.shape[0]
83 N = data.shape[1]
84 lidar_data = data.view(B*N, -1, data.shape[3], data.shape[4])
85 self.optimizer.zero_grad()
86 feature_lidar = self.model(lidar_data).view(B, N, -1)
87
88 loss_lidar, losses = self.criterion(feature_lidar)
89 if self.neptune is not None:
90 self.neptune['Sphere/training_lidar_loss'].append(loss_lidar.item())
91 self.neptune['Sphere/training_lidar_trip'].append(losses[0].item())
92 self.neptune['Sphere/training_lidar_secd'].append(losses[1].item())
93 loss_lidar.backward()
94 self.optimizer.step()
95 return loss_lidar.item()
96
97 def eval_lcd(self, x):
98 self.model.eval()

Callers 1

trainFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected