Service Pipelines
Image API can submit the processing result from one service as input to another service. Thus, you can get enriched data with the composition of results and build pipelines of services depending on your tasks.
The first service in the pipeline should be a service with face detection function. It processes the image and submits the detection result to the next service in the pipeline as input. The face detection function is performed in face-detector-face-fitter, face-detector-template-extractor, face-detector-liveness-estimator.
For example, to estimate liveness, age, gender and emotions from a face image, you can build a pipeline of the following services:
An image is sent to face-detector-liveness-estimator service. The processing result (face detection and liveness check result) is passed as input data to age-estimator service, where the age value is added to the result. Then the obtained enriched data is sent to the gender-estimator service to determine a person’s gender, and from there to the emotion-estimator, where an emotion rating is added.
Examples:
Request to face-detector-liveness-estimator:
{
"$image": "image in base64",
"objects": [
{}
]
}
Response:
{
"$image":"image in base64",
"objects": [
{
"id": 0,
"class": "face",
"confidence": 0.8233476281166077,
"bbox": [
0.375,
0.12333333333333334,
0.7645833333333333,
0.42
],
"liveness": {
"confidence": 0.9989556074142456,
"value": "REAL"
}
}
]
}
Request to age-estimator:
{
"$image": "image in base64",
"objects": [
{"id": 0,
"class": "face",
"confidence": 0.8233476281166077,
"bbox": [
0.375,
0.12333333333333334,
0.7645833333333333,
0.42
],
"liveness": {
"confidence": 0.9989556074142456,
"value": "REAL"
}
}
]
}
Response:
{
"$image":"image in base64",
"objects": [
{
"id": 0,
"class": "face",
"age": 21,
"liveness": {
"confidence": 0.9989556074142456,
"value": "REAL"
},
"confidence": 0.8233476281166077,
"bbox": [
0.375,
0.12333333333333334,
0.7645833333333333,
0.42
]
}
]
}
Request to gender-estimator:
{
"$image": "image in base64",
"objects": [
{"id": 0,
"class": "face",
"age": 21,
"liveness": {
"confidence": 0.9989556074142456,
"value": "REAL"
},
"confidence": 0.8233476281166077,
"bbox": [
0.375,
0.12333333333333334,
0.7645833333333333,
0.42
]
}
]
}
Response:
{
"$image":"image in base64",
"objects": [
{
"id": 0,
"class": "face",
"gender": "FEMALE",
"liveness": {
"confidence": 0.9989556074142456,
"value": "REAL"
},
"bbox": [
0.375,
0.12333333333333334,
0.7645833333333333,
0.42
],
"age": 21,
"confidence": 0.8233476281166077
}
]
}
Request to emotion-estimator:
{
"$image": "image in base64",
"objects": [
{"id": 0,
"class": "face",
"gender": "FEMALE",
"liveness": {
"confidence": 0.9989556074142456,
"value": "REAL"
},
"bbox": [
0.375,
0.12333333333333334,
0.7645833333333333,
0.42
],
"age": 21,
"confidence": 0.8233476281166077
}
]
}
Response:
{
"$image":"image in base64",
"objects": [
{
"id": 0,
"class": "face",
"emotions": [
{
"confidence": 0.00046337815752155756,
"emotion": "ANGRY"
},
{
"confidence": 0.000010690175584454014,
"emotion": "DISGUSTED"
},
{
"confidence": 0.0000651997511831193,
"emotion": "SCARED"
},
{
"confidence": 0.050197473080296776,
"emotion": "HAPPY"
},
{
"confidence": 0.6730428226960512,
"emotion": "NEUTRAL"
},
{
"confidence": 0.274063680489088,
"emotion": "SAD"
},
{
"confidence": 0.0021567556502748936,
"emotion": "SURPRISED"
}
],
"bbox": [
0.375,
0.12333333333333334,
0.7645833333333333,
0.42
],
"confidence": 0.8233476281166077,
"age": 21,
"liveness": {
"confidence": 0.9989556074142456,
"value": "REAL"
},
"gender": "FEMALE"
}
]
}