I have a use case where I get some records JSON records with subject_id, now I want to send the image to Kairos and identify to which of these records(subject_id) the image belongs. Say I need to identify the record from 5 records to which the image belongs. Here, /verify would need 5 API calls to check the confidence of each. On the other hand, /recognize would need 1 API call, but it will match it with all the images from the gallery & return ones with highest confidence.
Given that there are thousands of images enrolled to Kairos in a gallery, which one is more optimal? 5 API calls or 1 API call scanning all the images? Which one would take less time?
In your example you would be best off using the /recognize method. Under the covers, /recognize (one to many matching) is actually performing multiple /verify (one to one matching) calls then aggregating and sorting the results. But you are only charged for the 1 /recognize call and not 5 /verify calls.
We find that most of the latency in any given request is actually sending the image over to the API vs the time the API takes to process your request. Since that time is equal for both /recognize and /verify you won't see a noticeable difference in timing between the 2 calls until you start to have extremely large galleries of faces (50k+).
Source: CTO of Kairos.com