Raphael Azot
Raphael Azot

Reputation: 41

Detect multiple Face in one call with Microsoft cognitive Services (Face API)

I want to find a way to made less api call in the Face Api, and I want to know, if it's possible to submit more than one picture in only one Face Detect call ?

By example, sent 10 pictures in the same call.

If not possible with the Face detect call, here is a way to add more than one face in the same Add a Face to a Face List call ?

Thanks a lot

Raph !

Upvotes: 1

Views: 866

Answers (1)

Cristian Canton
Cristian Canton

Reputation: 196

Currently, the Face API by Microsoft Cognitive Services does not support submitting more than one image per call. However, there is a way to get more than one picture processed by call, involving some massaging on the input and output data.

According to the Face API documentation, the largest image size you can process is 4096x4096 pixels. A possible option would be to create a composite image combining multiple images before you submit it to Face API. You can do it in OpenCV and Python (take a look at this previous entry). The result may look like this:

enter image description here

Finally, you will have to do some bookkeeping to figure out the relative face coordinates of each sub-image w.r.t. the composite image you have submitted to Face API. Also, you must take into account the minimum detectable face size of 36x36 pixels: that may help you defining the maximum number of images you can squeeze into a single composite. Here a more extreme case of this technique:

enter image description here

Upvotes: 7

Related Questions