【发布时间】:2020-06-03 11:55:20
【问题描述】:
我的代码...
import numpy as np
import argparse
import imutils
import sys
import cv2 as cv
ap = argparse.ArgumentParser()
ap.add_argument("-m", "--model", required=True, help = "path to trained activity recognition
model")
ap.add_argument("-c", "--classes", required=True, help = "path to class label file")
ap.add_argument("-i", "--input", type = str, default = "", help = "optional file to video file")
args = vars(ap.parse_args())
我正在关注this 教程。这里得到错误是
用法:ipykernel_launcher.py [-h] -m MODEL -c CLASSES [-i INPUT] ipykernel_launcher.py:错误:需要以下参数:-m/--model、-c/--classes
发生异常,使用 %tb 查看完整的回溯。
系统退出:2
【问题讨论】:
-
您不能在
jupyter-notebook中使用argparse。您在启动服务器时提供的命令行值适用于服务器本身,而不是您的笔记本。此代码旨在作为“普通”python 脚本(来自 shell)运行。
标签: python-3.x tensorflow computer-vision argparse