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

PanakoStrategy Query Logic - allow duplicate fingerprint hash? #37

Open
lucaslawes opened this issue Aug 30, 2022 · 1 comment
Open

Comments

@lucaslawes
Copy link

Possible minor refactoring to improve the recognition rate.

Testing Result
Playing around with whether a duplicate fingerprint hash is processed produced an unexpected improvement in the recognition rate when duplicate fingerprints are not considered. However, this might not suit all use cases for the query algorithm.

Suggestion
Add a boolean flag to allow duplicate fingerprints or not. See pseudocode below:

//query
for(PanakoFingerprint print : prints) {
	long hash = print.hash();
        hashNotADuplicate = // add duplicate logic  
        if(allowDuplicates || hashNotADuplicate) {
	    db.addToQueryQueue(hash);
        }
	printMap.put(hash, print);
}
@JorenSix
Copy link
Owner

JorenSix commented Sep 6, 2022

Hi thanks for the suggestion,

The reason for not allowing duplicate hashes is twofold:

If a hash is common it means (almost by definition) that it does not have much discriminative power. The idea implemented here is that they can be safely ignored.

Another reason is performance: not wasting storage space or computation on hashes with little discriminative power. While some hash collisions are allowed having too many could have an effect on query performance.

However, letting users choose would indeed be a good improvement. For small collections or powerful servers the collisions can perhaps be not that big of a problem. Either using a Set (to avoid duplicates) or an Array (to allow) to store temporary prints could be an idea indeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants