小编Ahm*_*ari的帖子

为什么我收到此错误: TypeError: 'Namespace' object is not subscriptable

我面临 argparse 库的问题。

我有encodings.pickle 文件,并且我按照下面的代码来识别演员,但加载嵌入似乎不起作用。

这是代码:

ap = argparse.ArgumentParser()
ap.add_argument("-e", "--encodings", required=True,
                help="path to serialized db of facial encodings")
ap.add_argument("-i", "--image", required=True,
                help="path to input image")
ap.add_argument("-d", "--detection-method", type=str, default="cnn",
                help="face detection model to use: either `hog` or `cnn`")
ap.add_argument("-fnn", "--fast-nn", action="store_true")
args = parser.parse_args('')
print(args)

# load the known faces and embeddings
print("[INFO] loading encodings...")
data = pickle.loads(open(args["encodings"], "rb").read())
Run Code Online (Sandbox Code Playgroud)

源代码可以在这里找到。

python

12
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×1