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

Performance improvements for copy-move detection #16

Merged
merged 2 commits into from
Jul 16, 2020

Conversation

AlexRiina
Copy link
Contributor

I was looking through the code to understand what the individual parameters meant and saw a few things that looked like they could be tweaked for faster performance. I'm sure there are ways of doing the clustering in an even better way, but here's a quick attempt. On my sample image, the entire if self.clusters is None loop started at 84s and after this change takes 13s.

The first change I made was calculating all of the distances between matching keypoints. The previous loop structure meant that something like len(matches)^2 distances were calculated out for the original matches.

I also pre-filtered down the list of matches to only the ones where the distance between the point was above min_dist instead of handling that in both the i and j loops.

The final change at master...AlexRiina:master#diff-e06009cb5a3aa444ce736838cd58dd9cR237 prevents cases where a0 and a1 are really close and a0 and b1 are really close but a1 and b1 are not really close. I think goal of that loop is to pair a0 with either a1 or b1 and b0 with the other and the highlighted case is when b0 is not paired.

@GuidoBartoli GuidoBartoli merged commit cf8a8b0 into GuidoBartoli:master Jul 16, 2020
@GuidoBartoli
Copy link
Owner

Very nice, I merged into master and cleaned up the code, many thanks for investigating it! 👌

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.

None yet

2 participants