Skip to main content

人脸检测

人脸检测是 POST /v2/face-recognition/face-validation,即检测引擎的别名。image 必填。若省略,本路由把 min_score 设为 0.5,把 search_mode 设为 FAST。实际载荷是 face_count、faces(含 score 和 bbox)、imageDimensions 和 engine。

调用返回的内容​

  • face_count
  • faces[].score 与 faces[].bbox
  • imageDimensions 与 engine

使用场景​

  • 活体检测前先数人脸。
  • 读取主脸的框。
  • 只有图像时使用默认分数和模式。

API 参考​

Endpoint​

POST https://api.verifik.co/v2/face-recognition/face-validation

先读 face_count。faces 的每一项都有 score 和 bbox。imageDimensions 是解码后的宽和高。engine 是检测器名称。

Headers​

名称值说明
Content-Typeapplication/json请求格式
Acceptapplication/json响应格式
AuthorizationBearer <token>客户端 JWT

Parameters​

名称类型必填示例说明
imagestring是data:image/jpeg;base64,AAAAbase64 或 data URI 的人脸图像。必填。
min_scorenumber否0.5可选。本路由默认填 0.5。
search_modestring否FAST可选。本路由默认填 FAST。另一个值是 ACCURATE。

Request​

import axios from "axios";

const options = {
method: "POST",
url: "https://api.verifik.co/v2/face-recognition/face-validation",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: "Bearer <your_token>",
},
data: {
"image": "data:image/jpeg;base64,AAAA"
},
};

try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error.response ? error.response.data : error.message);
}

Response​

{
"data": {
"face_count": 1,
"faces": [
{
"score": 0.97,
"bbox": [
80,
60,
280,
320
]
}
],
"imageDimensions": {
"width": 640,
"height": 480
},
"engine": "insightface"
},
"signature": {
"dateTime": "November 27, 2026 12:00 PM",
"message": "Certified by Verifik.co"
}
}

说明​

  • 只有 image 必填。
  • 省略的 min_score 变为 0.5,省略的 search_mode 变为 FAST。
  • 响应使用 bbox,不是单独的特征点对象。
  • 在 Authorization 头中发送 Bearer JWT。
  • JSON 示例只说明字段形状。实际调用返回你所发送数值对应的记录。
  • 不要发送绕过缓存的标志。本页只记录客户端参数。

沙盒​

场景参数结果
数据源有记录image only含 face_count、faces、imageDimensions 和 engine 的 200。
缺少必填值Omit image409 MissingParameter。
未知的值min_score: 0.8, search_mode: "ACCURATE"使用你发送的分数和模式返回 200。

401 when the bearer token is missing or rejected.