如何为jupyter编写argparse

时间:2019-09-10 08:02:14

标签: python jupyter-notebook argparse

如何在jupyter笔记本中编写此argparse代码?

ap = argparse.ArgumentParser()

ap.add_argument("-i", "--image", required=True,
    help="path to input image")

ap.add_argument("-y", "--yolo", required=True,
    help="base path to YOLO directory")

ap.add_argument("-c", "--confidence", type=float, default=0.5,
    help="minimum probability to filter weak detections")

ap.add_argument("-t", "--threshold", type=float, default=0.3,
    help="threshold when applying non-maxima suppression")

args = vars(ap.parse_args())

1 个答案:

答案 0 :(得分:0)

为了从命令行执行jupyter笔记本并传递参数,您可以使用诸如papermill之类的工具 下面的github链接包含有关如何使用它的详细文档

https://github.com/nteract/papermill