【发布时间】:2022-01-03 18:00:44
【问题描述】:
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
help="path to input image")
ap.add_argument("-d", "--dataset", required=True,
help="path to dataset")
ap.add_argument("-m", "--model", required=True,
help="path to Caffe pre-trained model")
ap.add_argument("-l", "--labels", required=True,
help="path to ImageNet labels (i.e., syn-sets)")
args = vars(ap.parse_args())
我得到的输出是
usage: train.py [-h] -i IMAGE -d DATASET -m MODEL -l LABELS
ipykernel_launcher.py: error: the following arguments are required: -i/--image, -p/--prototxt, -m/--model, -l/--labels.
An exception has occurred, use %tb to see the full traceback.
System Exit: 2
【问题讨论】:
-
错误表明
-p/--prototxt是必需的参数,但它没有出现在您的代码中。您确定您正在运行脚本的更新版本吗? -
根据错误信息,this question 似乎相关。
-
错误消息告诉我们您正在 jupyter notebook 中运行它。在那种环境中为脚本提供命令行参数并不容易,即使您知道这意味着什么。像这样的脚本应该从 OS shell 运行。