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

added buffalo_l model to deepface #1439

Merged
merged 24 commits into from
Mar 1, 2025
Merged

Conversation

Raghucharan16
Copy link
Contributor

Tickets

#1187

What has been done

With this PR, buffao_l model will be added to deepface's face recognition models. I ran the face-recognition-how.py for testing the buffalo_l model.

How to test

python tests/face-recognition-how.py

@serengil
Copy link
Owner

thresholds are missing for various distance metrics for this model here - https://github.com/serengil/deepface/blob/master/deepface/modules/verification.py#L409

@Raghucharan16
Copy link
Contributor Author

@serengil made the necessary changes could you review once

@serengil
Copy link
Owner

serengil commented Feb 20, 2025

@serengil made the necessary changes could you review once

@Raghucharan16 Added my review already

@Raghucharan16
Copy link
Contributor Author

My bad will do that.

@serengil
Copy link
Owner

Yes, took care of those and updated the code.

I cannot see the changes in the PR - https://github.com/serengil/deepface/pull/1439/files

@Raghucharan16 Raghucharan16 reopened this Feb 20, 2025
@Raghucharan16
Copy link
Contributor Author

Hey @serengil they have provided only google drive links for the model but i doubt this may work or not. what can we do for model's path? push it to somewhere in github?

@serengil
Copy link
Owner

Hey @serengil they have provided only google drive links for the model but i doubt this may work or not. what can we do for model's path? push it to somewhere in github?

Still you can download it with gdown as https://github.com/serengil/deepface/blob/master/deepface/models/face_detection/Yolo.py#L31

@serengil
Copy link
Owner

oh ok but how come it got worked on my local machine?

interestingly, it was working fine for me in the first run.

@serengil
Copy link
Owner

@serengil I got 10/10 linting score and yet it got failed? need to to do anything about bullitins.EXCEPTIONS and BASE_ EXCEPTIONS?

add this

pylint: disable=line-too-long

@serengil
Copy link
Owner

I found a bug

from deepface import DeepFace

model_name = "Buffalo_L"
ndim = 512

is_verified = DeepFace.verify(
    img1_path = "dataset/img1.jpg",
    img2_path = "dataset/img2.jpg",
    model_name = model_name,
)

img_paths = ["dataset/img1.jpg", "dataset/img2.jpg", "dataset/couple.jpg"]
batch_results = DeepFace.represent(
    img_path=img_paths,
    model_name=model_name,)

assert isinstance(batch_results, list)
assert len(batch_results) == len(img_paths)
for batch_result in batch_results:
    assert isinstance(batch_result, list)
    for result in batch_result:
        assert isinstance(result, dict)
        assert isinstance(result["embedding"], list)
        assert len(result["embedding"]) == ndim

This is because preprocess in Buffalo_L.py is being called with (4, 112, 112, 3) shaped numpy array but the following code block ignores them all.

if len(img.shape) == 4:
    img = img[0]

@Raghucharan16 Raghucharan16 requested a review from serengil March 1, 2025 07:46
@serengil
Copy link
Owner

serengil commented Mar 1, 2025

Failed at linting

************* Module deepface.models.facial_recognition.Buffalo_L
deepface/models/facial_recognition/Buffalo_L.py:67:0: C0301: Line too long (105/100) (line-too-long)
deepface/models/facial_recognition/Buffalo_L.py:95:0: C0304: Final newline missing (missing-final-newline)

please run make lint before pushing something

Copy link
Contributor Author

@Raghucharan16 Raghucharan16 left a comment

Choose a reason for hiding this comment

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

I think everything seems fine. let me know if any corrections are needed

Copy link
Owner

@serengil serengil left a comment

Choose a reason for hiding this comment

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

LGTM

@serengil serengil merged commit 2d31f57 into serengil:master Mar 1, 2025
2 checks passed
@Raghucharan16
Copy link
Contributor Author

@serengil Thanking you for maintaining this cool project. Now i guess you may need to add the new model (buffalo_L) to readme 😅Looking forward to collaborate with you again..

@serengil
Copy link
Owner

serengil commented Mar 1, 2025

@serengil Thanking you for maintaining this cool project. Now i guess you may need to add the new model (buffalo_L) to readme 😅Looking forward to collaborate with you again..

Will do

Meanwhile, you can create a PR to update readme

@Raghucharan16
Copy link
Contributor Author

@serengil Thanking you for maintaining this cool project. Now i guess you may need to add the new model (buffalo_L) to readme 😅Looking forward to collaborate with you again..

Will do

Meanwhile, you can create a PR to update readme

Oh sure...will do that..

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