vscode launch.json 配置


开宗明义

${workspaceFolder} :表示当前workspace文件夹路径,

${workspaceRootFolderName}:表示workspace的文件夹名,

${file}:文件自身的绝对路径,

${relativeFile}:文件在workspace中的路径

${fileBasenameNoExtension}:当前文件的文件名,不带后缀

${fileBasename}:当前文件的文件名

${fileDirname}:文件所在的文件夹路径

${fileExtname}:当前文件的后缀

${lineNumber}:当前文件光标所在的行号

${env:PATH}:系统中的环境变量

 

以mmdetection为例

我们需要的命令是:

python tools/test.py configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py \
    checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth \
    --show

 

linux路径为 /home/yy18dlz/github/mmdetection/

用vscode 打开到上述路径

配置 launch.json

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Current File",
      "type": "python",
      "request": "launch",
      "program": "${workspaceFolder}/${relativeFile}",
      "console": "integratedTerminal",
      "cwd":"${workspaceFolder}",
      "args": [
        "configs/yolo/yolov3_d53_mstrain-608_273e_coco.py",
        "checkpoints/yolov3_d53_mstrain-608_273e_coco-139f5633.pth",
        "--show",
      ]
    }
  ]
}

打开文件 tools/test.py F5即可完成开头的命令执行

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM