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

Recognition find batched #1351

Merged
merged 4 commits into from
Oct 1, 2024
Merged

Conversation

kremnik
Copy link
Contributor

@kremnik kremnik commented Sep 30, 2024

Tickets

#1332

What has been done

With this PR, the find_batched method was developed as a batched version of the find method. The main difference of that method is using numpy arrays instead of pd.DataFrame and using batched distance calculation instead of element-wise distance calculation. Also, the function returns array of array of dicts (where array[:] is source faces and array[:][:] is founded faces corresponding to each source face) instead of array of DataFrames.

Also, the tests for the find_batched method was developed in the tests/test_find_batched.py.

Based on the experiments conducted on large face databases, which include photos with multiple faces, the find_batched method achieves a speedup of more than 50% compared to the find method.

How to test

make lint && make test

@serengil
Copy link
Owner

this is a comprehensive PR, need to spend some time on it

distances = np.linalg.norm(diff, axis=2) # (M, N)
return distances

def find_distance_batch(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a future PR, we may consider to move find_distance_batch, find_euclidean_distance_batch and find_cosine_distance_batch to the functions in verification.

@serengil
Copy link
Owner

serengil commented Oct 1, 2024

LGTM

@serengil serengil merged commit 4f48d97 into serengil:master Oct 1, 2024
2 checks passed
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