For dlib, it is natural to use io.imread to load image like the example https://github.com/davisking/dlib/blob/master/python_examples/face_detector.py.
But I wanted to use cv2.imread for some reason. Is it possible? Yes! I can detect faces correctly using the code sample.
image_path = 'xxxx.jpg' image = cv2.imread(image_path) image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) detects = self.face_detector(image_rgb, 1)