Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix score reversal issue when matches are reversed #421

Closed
wants to merge 1 commit into from

Conversation

Joe-CB
Copy link

@Joe-CB Joe-CB commented Sep 5, 2024

Fix score reversal issue when matches are reversed

Issue

In the original implementation, when the matches are reversed (reverse=True), the matches array is flipped, but the corresponding scores array is not. This can cause the scores to mismatch with the reversed matches.

Solution

The proposed change adds a line to flip the scores array in the same way the matches array is flipped when reverse=True.

Code Change

if reverse:
    matches = np.flip(matches, -1)
    scores = np.flip(scores)  # Flip scores to maintain correspondence with matches

@sarlinpe
Copy link
Member

sarlinpe commented Sep 7, 2024

matches is an Nx2-dimensional array. Swapping the images requires swapping the last dimension. scores is an N-dimensional array and doesn't need any swapping. We are swapping the order of the images, not of the points.

@sarlinpe sarlinpe closed this Sep 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants