问题描述
我的程序仅测试一张图片example_01.png,我想测试放在文件夹示例中的所有图片 那我该怎么办呢? 谢谢
# construct the argument parser and parse the arguments
ap = argparse.ArgumentParser()
ap.add_argument("-i","--image",required=True,help="path to input image")
ap.add_argument("-f","--face",type=str,default="face_detector",help="path to face detector model directory")
ap.add_argument("-m","--model",default="mask_detector.model",help="path to trained face mask detector model")
ap.add_argument("-c","--confidence",type=float,default=0.5,help="minimum probability to filter weak detections")
args = vars(ap.parse_args())
# load our serialized face detector model from disk
print("[INFO] loading face detector model...")
prototxtPath = os.path.sep.join([args["face"],"deploy.prototxt"])
weightsPath = os.path.sep.join([args["face"],"res10_300x300_ssd_iter_140000.caffemodel"])
net = cv2.dnn.readNet(prototxtPath,weightsPath)
# load the face mask detector model from disk
print("[INFO] loading face mask detector model...")
model = load_model(args["model"])
# load the input image from disk,clone it,and grab the image spatial
# dimensions
image = cv2.imread(args["image"])
orig = image.copy()
(h,w) = image.shape[:2]
致电:
python detect_mask_image.py --image examples/example_01.png
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)