darknet之VSCode单步调试

1. How

  • 参考这篇博客
  • 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": "region",
              "type": "cppdbg",
              "request": "launch",
              "program": "${workspaceFolder}/darknet",
              "args": ["detector", "train", "${workspaceFolder}/data/candle.data", "${workspaceFolder}/cfg/candle11-tr.cfg", "${workspaceFolder}/yolov2-tiny.conv.11"],
              "stopAtEntry": false,
              "cwd": "${workspaceFolder}",
              "environment": [],
              "externalConsole": false,
              "MIMode": "gdb",
              "preLaunchTask": "make",
              "setupCommands": [
                  {
                      "description": "Enable pretty-printing for gdb",
                      "text": "-enable-pretty-printing",
                      "ignoreFailures": true
                  }
              ]
          }
      ]}
      
  • 修改Makefile,在CFLAGS最后加-g

2. 训练流程

  • darknet.c调用detector.c的run_detector
  • run_detector调用train_detector
  • train_detector调用parser.c的parse_network_cfg,实际调用parse_network_cfg_custom
    • parse_network_cfg_custom调用解析网络层的函数,以region层为例,调用parse_region
    • parse_region调用region_layer.c的make_region_layer,并设置anchor
  • train_detector调用data.c的load_data
  • train_detector调用network.c的train_network_waitkey(只用1个GPU时)
    • train_network_waitkey调用train_network_datum
    • train_network_datum调用forward_network和backward_network
  • train_detector调用validate_detector_map(需要的时候)

你可能感兴趣的:(deeplearning)