vscode带参数调试--例如使用argparse

使用 argparse 调试 python 脚本时,只需要把传入的参数写在 .vscode/launch.json 文件里:

{
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: 当前文件",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true,
            "args": [
                // "-c","configs/cls/cls_mv3.yml",
                // "Global.save_inference_dir=./inference/cls/",
                // "Global.load_static_weights=False",
                // "Global.infer_img=testdata/1-1.png"
                // "--image_dir","testdata",
                // "--cls_model_dir","inference/cls"
                "--model_dir","inference/cls",
                "--model_filename","inference.pdmodel", 
                "--params_filename","inference.pdiparams",
                "--save_file","./inference/cls_onnx/model.onnx",
                "--opset_version","11",
                "--enable_onnx_checker","True",

            ]
        }
    ]
}

例如下图,这个就等价于执行python脚本时的: --model_dir  "inference/cls"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值