找了半天终于找到一篇blog里面说了dlib内部使用的算法
https://talengu.github.io/public/2018/11/12/cv/FaceDetectionComparison/
发现其实是把dlib的examples说了一下
dlib github部分源码
https://github.com/davisking/dlib-models
dlib官方文档
http://dlib.net/python/index.html#dlib.mmod_rectangles
dlib的HOG人脸检测检测不出来下面这张图
换成CNN方法就可以检测出来了
import dlib
import cv2
PREDICTOR_PATH = r'shape_predictor_5_face_landmarks.dat'
DETECTOR_PATH = r'mmod_human_face_detector.dat'
detector = dlib.cnn_face_detection_model_v1(DETECTOR_PATH)
predictor = dlib.shape_predictor(PREDICTOR_PATH)
output_path = "OUTPUT"
def get_landmarks(im, fname):
#gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
print('start detecting')
dets