Age estimation v1
Once you've set up your organisation account on the Yoti Hub, you’re ready to start integrating.
There is one step to follow to integrate the Age estimation service:
- Create a request
This service allows you to use lower image quality.
Image Requirements
The image requirements to use our services are:
Condition | Age estimation |
---|---|
Quantity | Only one single face in the image. |
Image type | Yoti only accepts JPEG’s encoded as a base64 image |
Image resolution | The minimum face dimensions we accept is 96 x 96 pixels |
Colour | The image must be colour (RGB). Yoti does not accept black and white or filtered images. |
Size | Base64 body must be below 100KB (~70KB JPEG) |
There’s a tradeoff between estimation accuracy and camera quality / light conditions, false-negative errors such as face not detected or spoofing attempt detected may be higher than expected due to one or more of the following factors:
Condition | Description |
---|---|
Lighting | Provide UX and guidance to the user. Jump to User experience for more information. |
Face positioning | Guide the users to place their face in the middle of the photo you are capturing. A near frontal pose with no obstruction to the facial features. The minimum inter ocular distance is 120 pixels. |
Camera angle | Please try to get a face-on photo of the user to get the best result. The camera’s field of view is too small to provide suitable context around the facial image captured. |
Camera type | The API does not work on infrared cameras. To ensure the best performance we are happy to support your testing when evaluating camera options. |
Image cropping | Further image cropping can also reduce the context around the facial image captured. This can negatively impact the ability of the algorithm to compare to other ‘normal’ images in its learned model. |
Glare / Blur | Insufficient anti-glare capabilities of either the lens or the glass will make it harder for the anti-spoofing to accurately detect edges around faces. This can negatively impact the ability of the algorithm to compare to other ‘normal’ images in its learned model. |
Zoom | Optical zoom effects can reduce the context around the facial image captured. This can negatively impact the ability of the algorithm to compare to other ‘normal’ images in its learned model. A distorted lens structure, such as a ‘fish-eye’ lens which is not how the AI model has been trained. |
Image compression | Too much image compression is applied to the captured image which creates ‘artefacts’ and inaccuracies in the image (ideally no more than 90% compression). This can negatively impact the ability of the algorithm to compare to other ‘normal’ images in its learned model. |
Create a request
After completing the Yoti onboarding, you will need to complete authentication for the API by using the Yoti SDK to simplify the process for requesting to Yoti. The Yoti SDKs are available via popular dependency management systems. Further details can be found on the pages of the specific projects.
npm install -S -E yoti
Once you have added the Yoti SDK dependency to your project, you can use it to build and send your request. See the code snippets below for examples.
Endpoint | Description |
---|---|
https://api.yoti.com/api/v1/age-verification | Use Age estimation only. |
const { RequestBuilder, Payload } = require('yoti');
const request = new RequestBuilder()
.withBaseUrl('https://api.yoti.com/api/v1/age-verification')
.withPemFilePath('<YOTI_KEY_FILE_PATH>')
.withEndpoint('/checks')
.withPayload(new Payload(data))
.withMethod('POST')
.withHeader('X-Yoti-Auth-Id', '<YOTI_CLIENT_SDK_ID>')
.build();
//get Yoti response
const response = request.execute();
This JSON string will be the data
parameter in the withPayload
above code snippet.
{
"data": "/9j/4AAQSkZJRgABAgAAAQABAAD/2wAcHNXCKigjEaYH51Me1Zy1Za0P/Z....",
}
If integrating into a non-browser client, we recommend you contact us through our support form for additional support.
Terminal integrations
Optionally, additional headers may be provided to the request to allow Yoti to track error responses coming from a particular machine. This would typically be used in a non-browser client scenario, such as an ePOS terminal where each individual machine must be registered by the business.
In order to do this, the following headers should be applied:
Header | Description |
---|---|
Terminal-Id | Unique ID per machine. Mandatory for non-browser integrations. |
Session-Id | May be provided to demonstrate multiple attempts are from a single user transaction. |
Example responses
The response received from the API will be below:
The uncertainty value is a confidence score. Yoti recommends rejecting any response with an uncertainty greater than 6.0. Typically this indicates a problem with image capture. This should only be treated as a quality score.
{
"pred_age": 29.7475,
"uncertainty": 2.04677
}
Error codes
Error code | Description |
---|---|
1 | Image too big |
2 | Unable to decode image (not a jpeg or wrong base64 string) |
4 | No face detected |
6 | Image not present |
7 | Generic bad request |
8 | No image detected |
9 | Internal server error |