import paddlehub as hub
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import cv2
from paddlehub import paddle_utils
print("++++")
# 1.待预测图片
test_img_path = ["./image/2.png"]
img = cv2.imread("./image/2.png", cv2.IMREAD_COLOR)
# 2.载入模型
module = hub.Module(name="pyramidbox_lite_mobile_mask")
# 3.预测
input_dict = {"image": test_img_path}
results = module.face_detection(data=input_dict)
# print(results[0])
# print(results[0]['data'])
# print(results[0]['data'][0]['left'])
if len(results):
print(results)
print(results[0]['data'])
for i in results[0]['data']:
print(i)
if i['label']=='MASK