简体   繁体   English

使用不同的人脸检测器和 dlib 的地标检测器

[英]Using a different face detector with dlib's landmark detector

I am currently working on a python implementation of Adrian Rosebrock's video blink detector with dlib blog post:我目前正在使用 dlib 博客文章对 Adrian Rosebrock 的视频闪烁检测器进行 Python 实现:

https://www.pyimagesearch.com/author/adrian/ https://www.pyimagesearch.com/author/adrian/

Basically, I am using dlib's frontal face detector and passing the bounding box around the face to dlib's landmark detector as seen in this picture:基本上,我正在使用 dlib 的正面人脸检测器并将面部周围的边界框传递给 dlib 的地标检测器,如下图所示:

https://imgur.com/xvkfNeG https://imgur.com/xvkfNeG

Sometimes dlib's frontal face detector doesn't find a face, but other face detectors like OpenCV's do.有时 dlib 的正面人脸检测器找不到人脸,但其他像 OpenCV 的人脸检测器可以。 Adrian's blog made it sound like I could use openCV's frontal face detector and pass the bounding box along instead. Adrian 的博客听起来像是我可以使用 openCV 的正面检测器并传递边界框。

However when I do this the landmark detector can't find the eyes of the person correctly as seen in this photo:但是,当我这样做时,地标检测器无法正确找到人的眼睛,如这张照片所示:

https://imgur.com/3eAFFsQ https://imgur.com/3eAFFsQ

Is there way I could use an alternative face detector with dlib's landmark detector?有没有办法在 dlib 的地标检测器中使用替代人脸检测器? Or am I stuck using dlib's frontal face detector because the bounding box passed by a different face detector will be ever so slightly incorrect for the dlib landmark detector?还是我一直在使用 dlib 的正面人脸检测器,因为不同人脸检测器通过的边界框对于 dlib 地标检测器来说会有点不正确?

Thank you for your time!感谢您的时间!

Checking the images you are providing it just look like you are not passing the correct parameters to the plotting method.检查您提供的图像看起来就像您没有将正确的参数传递给绘图方法。 The results look correct, just upside-down.结果看起来是正确的,只是颠倒了。

You can use your own face detector.您可以使用自己的面部检测器。 You just have to use dlib.rectangle() function.你只需要使用dlib.rectangle()函数。 First, find the bounding boxes from your face detector and after that map them to dlib.rectangle(x,y,w,h) .首先,从人脸检测器中找到边界框,然后将它们映射到dlib.rectangle(x,y,w,h)

Then you can pass the bounding boxes from this list to predictor(img, rect) .然后,您可以将此列表中的边界框传递给predictor(img, rect)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用python使用Dlib的人脸检测器检测多个人脸 - Detect multiple faces using Dlib's face detector using python 为什么我的 dlib.get_frontal_face_detector() 的输出(rectangles[]) 是空的? - why my dlib.get_frontal_face_detector()'s output(rectangles[]) is empty? 如何在 Python 脚本(Flask 服务器)中保存 dlib.get_frontal_face_detector() 的 output (dlib.rectangles)? - How to save dlib.get_frontal_face_detector() 's output (dlib.rectangles) in a Python Script (Flask Server)? 在Python中使用dlib训练的对象检测器 - Using dlib trained object detector in Python 模块“dlib”没有属性“get_frontal_face_detector”错误 - module 'dlib' has no attribute 'get_frontal_face_detector' ERROR AttributeError:模块“dlib”没有属性“get_frontal_face_detector” - AttributeError: module 'dlib' has no attribute 'get_frontal_face_detector' 安装 dlib 以使用面部识别 [dlib 没有属性 - get_frontal_face_detector] - Installing dlib to work with facial recognition [dlib has no attribute - get_frontal_face_detector] Dlib 的 simple_object_detector() 运行缓慢 - Dlib's simple_object_detector() is running slowly OpenCV DNN人脸检测器 - OpenCV DNN Face detector 如何从自定义对象的地标检测器开始? - How to start with landmark detector for custom objects?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM