肤色检测

传入一张图,框出分数不低于阈值的人脸,并给出肤色。RGB 照片会先按训练同一套转成 YUV NV12(BT.601,全范围)再识别。

地址

POST https://skin.model2.wgdl.tech/v1/detect

请求体是 multipart/form-data。不需要登录。

参数

字段必填说明
file是RGB 图片(jpg、png 等),或原始 YUV 字节
color是rgb 或 yuv
threshold否人脸分数阈值,范围 (0, 1],默认 0.6
max_faces否只保留分数最高的前几张脸。默认 0,表示不限制
width / heightYUV 必填原始画面宽高。NV12 的宽和高都要是偶数
yuv_format否nv12(默认)或 yuv444
annotate否1 时直接返回画了框的 JPEG,不再返回 JSON

RGB 图片

curl -F file=@photo.jpg \
     -F color=rgb \
     -F threshold=0.8 \
     -F max_faces=3 \
     https://skin.model2.wgdl.tech/v1/detect

YUV

curl -F file=@frame.nv12 \
     -F color=yuv \
     -F yuv_format=nv12 \
     -F width=1280 \
     -F height=720 \
     -F threshold=0.8 \
     https://skin.model2.wgdl.tech/v1/detect

返回

{
  "color": "rgb",
  "width": 683,
  "height": 1024,
  "threshold": 0.8,
  "model_ms": 14.7,
  "faces": [
    {
      "bbox": [312, 45, 69, 94],
      "score": 0.9245,
      "mst": 2,
      "tone": "白",
      "input_jpeg": "<base64 JPEG>"
    }
  ]
}

bbox 是 x, y, w, h,坐标在转正 EXIF 之后的画面上。score 是人脸检测分数。mst 是 Monk Skin Tone,1 到 10。tone 是收成的四色。model_ms 只计肤色模型前向,不含检测、编码和网络。input_jpeg 是送进模型的 96×96 人脸,从 YUV 转回 RGB 后的 JPEG。

没检出脸时 faces 是空数组。

四色

MSTtone
01–03白
04–06黄
07–08棕
09–10黑

画框图

加上 annotate=1,响应是 image/jpeg,框和文字直接画在原图上。

curl -F file=@photo.jpg -F color=rgb -F annotate=1 \
     -o marked.jpg \
     https://skin.model2.wgdl.tech/v1/detect