首页 > 解决方案 > python:add_argument用于读取数据集但无法读取数据文件夹

问题描述

我是 python 新手,在这里我正在练习通过调试来理解代码。

python: add_argument 用于读取数据集但无法读取数据文件夹。

请检查附件和下面的代码。

ap = argparse.ArgumentParser()
## This is a useful line because it adds an option that we are interested in. The input file
ap.add_argument("-d", "--dataset", required=True,
    help="path to input dataset")
## The plot
ap.add_argument("-p", "--plot", type=str, default="plot.png",
    help="path to output loss/accuracy plot")
## The model
ap.add_argument("-m", "--model", type=str,
    default="mask_detector.model",
    help="path to output kite detector model")
## Parse the command line argument
args = vars(ap.parse_args())

得到错误:

kite_detector.py: error: the following arguments are required: -d/--dataset

但是文件夹名称dataset的数据已经存在于多个分类文件夹所在的项目文件夹中。

请提供链接以了解获取问题的原因和原因。提前致谢。在此处输入图像描述

[![在此处输入图像描述][2]][2]

标签: pythonpython-3.xpycharmcommand-line-arguments

解决方案


推荐阅读