Request parameters

이 엔드포인트에는 다음 형식의 application/json 요청 본문이 필요합니다.

{
    "image": "<base64 encoded image data>",
    "pipelines": [
        {
            "pipeline_name": "ibis-sr",
            "calibration": "REGULAR"
        },
        {
            "pipeline_name": "kiwi-rc7-pc"
        },
        {
            "pipeline_name": "lark-ps"
        }
    ]
}

Response

HTTP 200/OK

API 함수 'OK' 응답 데이터는 항상 JSON 형식입니다.

사용 샘플

Python

import base64

data = open("/data/image0.png", "rb").read()
post_res = requests.post(
    url="<URL>/check_liveness",
    json={
        "image": base64.b64encode(data).decode("utf-8"),
        "pipelines": [
            {"pipeline_name": "ibis-sr", "calibration": "REGULAR"},
            {"pipeline_name": "kiwi-rc7-pc"},
            {"pipeline_name": "lark-ps"},
        ],
    },
)

JavaScript

const url = '<URL>/check_liveness';

function checkLiveness(image_buffer) {
    const data = {
        "image": btoa(image_buffer),
        "pipelines": [
            {
                "pipeline_name": "default-sr",
                "calibration": "REGULAR"
            },
            {
                "pipeline_name": "default-pc"
            },
            {
                "pipeline_name": "default-ps"
            }
        ]
    };

    const req = new XMLHttpRequest();

    req.open('POST', url, true);
    req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
    req.onreadystatechange = function () {
        if (this.readyState == 4 && this.status == 200) {
            alert(this.responseText);
        }
    };
    req.send(JSON.stringify(data));
}

Bash

(echo -n '{
              "image": "'; base64 image0.png; echo '",
              "pipelines": [
                  {"pipeline_name": "default-sr", "calibration": "REGULAR"},
                  {"pipeline_name": "default-pc"},
                  {"pipeline_name": "default-ps"}
               ]
          }') | \
curl -H "Content-Type: application/json" \
     -X POST -d @- "<URL>/check_liveness"

응답 body 예시

{
    "aggregate_liveness_probability": 1.0,
    "aggregate_quality_score": 1.0,
    "aggregate_image_quality_warnings": [],
    "pipeline_results": [
        {
            "pipeline_name": "ibis-sr",
            "calibration": "REGULAR",
            "result" : {
                "liveness_probability": 1.0,
                "liveness_score": 1.0,
                "quality_score": 1.0,
                "image_quality_warnings": [],
                "status_code": "OK"
            }
        },
        {
            "pipeline_name": "kiwi-rc7-pc",
            "calibration": "REGULAR",
            "result" : {
                "liveness_probability": 1.0,
                "liveness_score": 1.0,
                "quality_score": 1.0,
                "image_quality_warnings": [],
                "status_code": "OK"
            }
        },
        {
            "pipeline_name": "lark-ps",
            "calibration": "REGULAR",
            "result" : {
                "status_code": "DOCUMENT_PHOTO_NOT_FOUND"
            }
        }
    ]
}

결과에 대한 해석