Detect the faces from the rectified passport image: img = cv2.imread(filename) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) image = mp.Image(image_format=mp.ImageFormat.SRGB, data=img) start_time = time.time() detection_result = detector.detect(image) end_time = time.time() print("...