Batching on `.extract_faces` to improve GPU utilization and throughput
Tickets
https://github.com/serengil/retinaface/issues/105
What has been done
With this PR, .extract_faces can accept a list of images and processed them in a batch
How to test
make lint && make test
several problems:
- currently input images have to be of the same size (hence resize in the test), otherwise it raises an uninformative error. maybe do the same resizing in the
.extract_faces, but I am not quite sure if it would hurt performance - I am not yet unable to reproduce a performance improvement in colab, but here is what my local 4090 says when processing 1k images:
Batch Size: 1, Total Time: 101.9
Batch Size: 10, Total Time: 61.3
Batch Size: 20, Total Time: 59.9
I'll update on this
@serengil what do you think?
several problems:
- currently input images have to be of the same size (hence resize in the test), otherwise it raises an uninformative error. maybe do the same resizing in the
.extract_faces, but I am not quite sure if it would hurt performance- I am not yet unable to reproduce a performance improvement in colab, but here is what my local 4090 says when processing 1k images:
Batch Size: 1, Total Time: 101.9 Batch Size: 10, Total Time: 61.3 Batch Size: 20, Total Time: 59.9I'll update on this
@serengil what do you think?
IMO, batch should not be supported at all :) You should raise a ticket first to discuss this.
why not if it improves performance without hurting anything else (I hope)?
why not if it improves performance without hurting anything else (I hope)?
My personal opinion, I will not close this because of the time you spend
accept a list of images and processed them in a batch
Second attempt :) https://github.com/serengil/retinaface/pull/55