该模型的介绍地址
https://www.paddlepaddle.org.cn/hubdetail?name=pyramidbox_lite_mobile_mask&en_category=FaceDetection
import paddlehub as hub
import cv2
import numpy as np
if __name__ == '__main__':
image = "red_people.png"
face_detector = hub.Module(name="pyramidbox_lite_mobile_mask")
result = face_detector.face_detection(images=[cv2.imread(image)], visualization=True)
print(result[0]['save_path'])
image是你的图片名
hub.Module里可以直接传模型名的参数来调用模型
也可以运用命令行来直接运行
!hub run pyramidbox_lite_mobile_mask --input_path "test_face_detection.jpg" --output_dir 'detection_result' --visualization True