face-alignment icon indicating copy to clipboard operation
face-alignment copied to clipboard

Support for Batch Inference

Open Neltherion opened this issue 6 years ago • 5 comments

Hi and Thanks for the great package.

I wanted to ask if there is any support for inferring Landmarks of a batch of images? Each fa.get_landmarks(image) takes a really long time compared to something like DLib's landmark detector even on a GPU and I was hoping I could use batch processing to process a batch of images at once and remedy this issue a bit.

Thanks again.

Neltherion avatar Nov 30 '18 11:11 Neltherion

Hi @Neltherion,

This should definitely alleviate the issue to some extend. The only reason I didn't do this is because the face detector used (SFD) can be quite memory intensive (depending on the image resolution) unlike the face alignment network which is independent of this.

1adrianb avatar Nov 30 '18 11:11 1adrianb

Thanks for the quick answer...

So... Can't we modify the fa.get_landmarks(image) method to accept variable-length inputs (with at least one image and at most n images as a batch)? or even make a new method to prevent backwards compatibility issues,,,

Neltherion avatar Nov 30 '18 15:11 Neltherion

Sure, we can add as an optional paramter the batch size, with the default set to 1

1adrianb avatar Nov 30 '18 19:11 1adrianb

Hi @Neltherion,

did you find any solution for this problem?

AmirSh15 avatar May 10 '19 13:05 AmirSh15

@AmirSh15 Not really. This is a real problem for lots of Face Alignment + Face Detection libraries out there: They don't support batch inference properly!

Neltherion avatar May 10 '19 15:05 Neltherion