Skip to content

Inference in batched mode: all values in certainty is zeros #59

@lllabmaster

Description

@lllabmaster

Hi, i have this problem:

image1.shape, image2.shape : 3, 256, 256

dkm_model = DKMv3_outdoor(device=device)
dkm_model.w_resized = 256
dkm_model.h_resized = 256
dkm_model.upsample_preds = False
warp, certainty = dkm_model.match(image1, image2, batched=True, device=device)

then all values in 'certainty' tensor is zeros (torch.sum(certainty) is 0.0), so this line code "matches, certainty = dkm_model.sample(warp, certainty)" will cause error:
603 expansion_factor = 4 if "balanced" in self.sample_mode else 1
--> 604 good_samples = torch.multinomial(certainty,
605 num_samples = min(expansion_factor*num, len(certainty)),
606 replacement=False)
607 good_matches, good_certainty = matches[good_samples], certainty[good_samples]
608 if "balanced" not in self.sample_mode:

RuntimeError: invalid multinomial distribution (sum of probabilities <= 0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions