インターフェースを介してアップロードされた顔画像と生体認証データを比較して、画像内の顔が同一人物のものであるかどうかを判断します。
画像は、以下の要件を満たすものとします。
JPG (JPEG)、BMP、PNG、GIF、TIFF のいずれかの形式
幅と高さは 8 px 以上 5,000 px 以下
ファイルサイズは 5 MB 以下
POST
顔比較スコアの閾値とエラー率との対応関係:
推奨閾値: 0.7 以上
システムレスポンスコードの説明
可能性のある http ステータスコード:
No
デフォルト値は false で、画像が回転していないことを示します。値が true の場合、画像は自動的に回転されます。
check_quality
boolean
No
デフォルト値が false の場合は品質チェックを行わず、true の場合は画像の品質チェックを行います。
画像タイプが要件を満たしていません
2006
corrupted image error
画像が破損しています
4000
detection failed
特徴の抽出に失敗しました。画像に顔が検出されませんでした
4004
face occlusion
顔は検出されたが、目、鼻、口が部分的に見えないです
フィールド
型
必須
説明
liveness_file
File
Yes
インタラクティブ・ライブネスまたはサイレント・ライブネスSDKによる検出に成功した後に返された暗号化されたバイナリ・ストリーム・ファイル(i.e. protobufData)です。別途の暗号化を必要とせずに既に暗号化されています。
encrypted_image
String
Yes
暗号化された画像 。暗号化方法の参照: 個人データの暗号化
auto_rotate
フィールド
型
説明
request_id
string
このリクエストのID
code
int
システムレスポンスコード: 1000
verification_score
float
顔照合スコア、値0~1、値が高いほど同一人物である可能性が高いことです。
閾値
0.4
0.5
0.6
0.7
0.8
0.9
エラー率
1/10
1/100
1/1000
1/10,000
1/100,000
1/1,000,000
フィールド
型
説明
request_id
string
このリクエストのID
code
int
システムレスポンスコード
message
string
エラーメッセージ
コード
フィールドの値
説明
1200
invalid argument
無効な入力パラメーター
2003
invalid image size
画像サイズが要件を満たしていません
2004
invalid content length
画像コンテンツの長さが要件を満たしていません
2005
ステータスコード
ステータスフィールド
400
BAD_REQUEST
404
NOT_FOUND
411
LENGTH_REQUIRED
413
PAYLOAD_TOO_LARGE
500
INTERNAL_ERROR
boolean
invalid image type
http://ip:port/identity/liveness_image_verification/stateless{
'request_id': 'xxx',
'code': xxx,
'verification_score': xxx
}{
'request_id': 'xxx',
'code': xxx,
'message': xxx
}curl -X POST "http://ip:port/identity/liveness_image_verification/stateless" \
-F liveness_file=@/PATH/TO/FILE \
-d encrypted_image=xxx \
-d auto_rotate=trueimport java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
public class HttpClient {
public static final String POST_URL = "http://127.0.0.1:3000/identity/liveness_image_verification/stateless";
private static AESCipher cipher = new AESCipher("dcbbad6765e14139a07d34b92292a672", "df25d188a061");
public static void Post() throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost post = new HttpPost(POST_URL);
MultipartEntityBuilder entity = MultipartEntityBuilder.create();
String encryptedImage = cipher.encrypt(
Files.readAllBytes(Paths.get("src/main/resources/face_01.jpg")));
entity.addPart("liveness_file", new FileBody(new File("src/main/resources/mobile.protobuf")));
entity.addPart("encrypted_image", new StringBody(encryptedImage));
entity.addPart("auto_rotate", new StringBody("true"));
post.setEntity(entity.build());
HttpResponse response = httpclient.execute(post);
if (response.getStatusLine().getStatusCode() == 200) {
HttpEntity respEntity = response.getEntity();
BufferedReader reader = new BufferedReader(new InputStreamReader(respEntity.getContent()));
String line = reader.readLine();
System.out.println(line);
} else {
HttpEntity respEntity = response.getEntity();
String responseString = EntityUtils.toString(respEntity);
System.out.println("error:" + response.getStatusLine().getStatusCode()
+ " " + response.getStatusLine().getReasonPhrase());
System.out.println("cause of error:"+responseString);
}
}
public static void main(String[] args) throws Exception {
Post();
}
}