-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
Hello, why is valid_bev.unsqueeze(1) used in f_bev = f_bev.masked_fill(~valid_bev.unsqueeze(1), 0.0) in the exhaustive_voting function, while valid_bev.float()[None] is used in valid_templates = self.template_sampler(valid_bev.float()[None])?
def exhaustive_voting(self, f_bev, f_map, valid_bev, confidence_bev=None):
if self.conf.normalize_features:
f_bev = normalize(f_bev, dim=1)
f_map = normalize(f_map, dim=1)
# Build the templates and exhaustively match against the map.
if confidence_bev is not None:
f_bev = f_bev * confidence_bev.unsqueeze(1)
f_bev = f_bev.masked_fill(~valid_bev.unsqueeze(1), 0.0)
templates = self.template_sampler(f_bev)
with torch.autocast("cuda", enabled=False):
scores = conv2d_fft_batchwise(
f_map.float(),
templates.float(),
padding_mode=self.conf.padding_matching,
)
if self.conf.add_temperature:
scores = scores * torch.exp(self.temperature)
Reweight the different rotations based on the number of valid pixels in each
# template. Axis-aligned rotation have the maximum number of valid pixels.
valid_templates = self.template_sampler(valid_bev.float()[None) > (1 - 1e-4)
num_valid = valid_templates.float().sum((-3, -2, -1))
scores = scores / num_valid[..., None, None]
return scores
Metadata
Metadata
Assignees
Labels
No labels