darknetのVSCodeワンステップデバッグ

2099 ワード

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.crun_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(GPU 1個のみの場合)
  • train_network_waitkey呼び出しtrain_network_datum
  • train_network_datum呼び出しforward_Networkとbackward_network

  • train_detector呼び出しvalidate_detector_map(必要な場合)