人脸检测的性能对比

update @ 202306   yunet/  libfacedetection

@natsuite/yunet - NatML

https://github.com/ShiqiYu/libfacedetection

 据说比 haar还要快很多,待测试

经过初步测试, yunet同样的测试图片,比mlkit要快100%+

-----------------------------------------------------------------------------------------------------------------

update @ 202306 

'com.google.mlkit:face-detection:16.1.5

在高通865 检测一张需要50ms,即20fps, 而同样环境,haar能达到30fps(受限于摄像头?)

No1:

protoPath = os.path.sep.join([args["detector"], "deploy.prototxt"])
modelPath = os.path.sep.join([args["detector"],"res10_300x300_ssd_iter_140000.caffemodel"])
net = cv2.dnn.readNetFromCaffe(protoPath, modelPath)

blob = cv2.dnn.blobFromImage(cv2.resize(frame, (300, 300)), 1.0,(300, 300), (104.0, 177.0, 123.0))        
net.setInput(blob)
detections = net.forward()

数度慢,但检测稳定性和准确率最高.  gpu好的话可以把blob = cv2.dnn.blobFromImage(frame, 1.0, (600, 600),(104.0, 177.0, 123.0)),其中效果最好的是(900,900)

No2:

detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml")

gray = cv2.cvtColor(frameClone_cascade, cv2.COLOR_BGR2GRAY)
rects = detector.detectMultiScale(gray, scaleFactor=1.1, minNeighbors=5, minSize=(20, 20),flags=cv2.CASCADE_SCALE_IMAGE)

优点1)几乎可以在CPU上实时工作;2)简单的架构;3)可以检测不同比例的人脸。缺点1)会出现大量的把非人脸预测为人脸的情况;2)不适用于非正面人脸图像;3)不抗遮挡。

存在的问题是人脸检测效果不好。正面/垂直/光线较好的人脸,该方法可以检测出来,而侧面/歪斜/光线不好的人脸,无法检测。因此,该方法不适合现场应用

No3:

detector_age_gender = dlib.get_frontal_face_detector()
predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat")

rects = detector_age_gender(gray, 1)	

dlib人脸检测方法采用64个特征点检测,效果会好于Haar的方法识别率会更高

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值