-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Batching on .extract_faces
to improve performance and utilize GPU in full
#1435
base: master
Are you sure you want to change the base?
Conversation
Do you have a branch in your fork that currently combines all the optimizations you've submitted. I'd like to start using them while the approval process is going whats been the total speedup you've been able to see |
I do. You can check it combines these two PRs with some other small modifications:
Not all of the detectors currently (both in this PR and in the fork) implement batching. In particular, YOLO does. I've found it to be optimal in terms of performance and inference speed. The only problem is installing both torch and tensorflow with GPU, but I've managed to somehow do that. All in all, with the combination of @serengil FYI I would be happy to contribute the aforementioned modifications if we have progress on the PRs. |
I will review this PR this week i hope |
Seems this breaks the unit tests. Must be sorted. |
should be good now |
Nope, still failing. |
You implemented OpenCv, Ssd, Yolo, MtCnn and RetinaFace to accept list inputs What if I send list to YuNet, MediaPipe, FastMtCnn, Dlib or CenterFace? I assume an exception will be thrown, but users should see a meaningful message. |
@galthran-wq you are pushing too many things, would you please inform me when it is ready. |
it is ready now, im usually pushing when it's done I've just fixed what you've noted:
|
is this ready? i can still see my comments not resolved. |
almost, tell me if you think that the batched numpy array test is okay and let's also settle on whether refactoring of current I plan to:
|
…on process_single_image method
To summarize what's changed:
Unfortunately, this didn't fix the batch extraction case on
|
Tickets
#1433
#1101
#1434
What has been done
With this PR,
.extract_faces
is able to accept a list of imagesHow to test
Benchmarking on detecting 50 faces:

For yolov11n, batch size 20 is 59.27% faster than batch size 1.
For yolov11s, batch size 20 is 29.00% faster than batch size 1.
For yolov11m, batch size 20 is 31.73% faster than batch size 1.
For yolov8, batch size 20 is 12.68% faster than batch size 1.