Skip to content

Batch Inference Code on Transformers #171

@PeiYingjun

Description

@PeiYingjun

Hi! When running batch inference code, the order of the returned matching_scores is incorrect. For example, if the input batch order is (0, 1, 2), the returned result might be (0, 2, 1). This is due do the early stopping mechanism of Transformers Layers in the paper, which shuffles the batch index. Yet the code of recovering the batch index is incorrect.

Here is the Bug-Fixed code.
at modeling_lightglue.py, lin639
idx_map = {early_stops_indices[i].item(): i for i in range(early_stops_indices.size()[0])} # debug
idx_new = [idx_map[i] for i in range(early_stops_indices.size()[0])] # debug
matches, matching_scores, final_pruned_keypoints_indices, final_pruned_keypoints_iterations = (
tensor[idx_new] # tensor[early_stops_indices], debug
for tensor in [
matches,
matching_scores,
final_pruned_keypoints_indices,
final_pruned_keypoints_iterations,]
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions