2020年7月12日

http人脸检测服务

作者 codecafe

提供http服务的人脸检测 github源码地址

安装相关模块

pip install numpy opencv-python

注意:代码是基于python3开发

启动服务

git clone https://github.com/xxllss/face_detection
cd face_detection/

#启动服务 — python3相关版本即可
python3.8 src/index.py

请求

URL: localhost:8080
URI:/face_detection
method: GET
请求参数:

  • image :图片地址

返回参数

  • status 0:成功,-1:失败
  • data 人脸在原始图片上的坐标位置

请求样例

 http://localhost:8080/face_detection?image=https://pic3.zhimg.com/v2-35306ff8000cc2ad945bb8c04b3a5e0e_1440w.jpg?source=172ae18b

成功返回参数

{
    "status": 0,
    "data": [
        [
            53,
            51,
            403,
            403
        ]
    ]
}

失败返回参数

错误请求:

http://localhost:8080/face_detection?image=http://localhost:8080/image/not_found.jpg

错误时返回

{"status":-1,"data":"HTTP Error 404: Not Found"}

成功请求示例

  • 原始图像:

image

  • 识别到的人脸:

http人脸检测服务插图(1)

返回识别的坐标画图效果

相关资料