人脸检测 各种 demo/api体验

1. 先尝试的opencv做人脸检测,准确率太低
2 face recognition|github.

代码很简单,

# pip install face_recognition
import face_recognition as fr
img = fr.load_image_file(imgname)
faces = fr.face_locations(img, model='HOG')
faces = fr.face_locations(img, model='CNN')

获得的 faces即为人脸的矩形框坐标,
HOG 模型即为dlib.get_frontal_face_detector(), CPU/GPU下大概是0.19s一张图片。
CNN 模式在 CPU 下大概是12s左右,GPU 下大概是0.06s左右。

3 MS 的 API 调用

免费试用30天 , 链接为认知服务,准确度很高,但是有调用限制,每分钟 20 个,一共30000个。快了会封 IP。可以注册多个账号。
其 api 及使用在微软的 githubMicrosoft/Cognitive-Face-Python上。
demo code 为:

import cognitive_face as CF

KEY = 'subscription key'  # Replace with a valid subscription key (keeping the quotes in place).
CF.Key.set(KEY)

BASE_URL = 'https://westus.api.cognitive.microsoft.com/face/v1.0/'  # Replace with your regional Base URL
CF.BaseUrl.set(BASE_URL)

# You can use this example JPG or replace the URL below with your own URL to a JPEG image.
img_url = 'https://raw.githubusercontent.com/Microsoft/Cognitive-Face-Windows/master/Data/detection1.jpg'
result = CF.face.detect(img_url)
print result
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值