YOLOに触れるうちに、様々なコマンドを実行することになりますが、「一体どれだけの機能があるんだろうか?何をオプションとして指定できるのだろうか?」 と知りたくなるかと思います。
ここでは、良く使うコマンドと、Alexeyさんのサイトに載っている、"How to use on the command line"と、cのソースファイル内に書かれているargsを参考に、すべてのfunctionとargsを洗いざらいまとめてみました。
下記の表のうち(カッコ)書きで書かれたものは、当方で動作を確認できていないものです。「これは良く使うよ」というものを太字で表しました。
どうぞご活用下さい。
./detector {
function説明
train | 学習 |
test | テスト |
demo | 動画テスト |
map | mAP算出 |
calc_anchors | ? |
}
+
データ定義:例:cfg/coco.data
+
ネットワーク設定:例:cfg/yolov3.cfg
+
重み:例:yolov3.weights
+
Args{
-dont_show | dont_show | (1) |
(-show) | show | |
(-letter_box) | letter_box | |
-map | calc_map | |
(-points) | map_points | |
(-check_mistakes) | check_mistakes | |
(-show_imgs) | show_imgs | |
(-mjpeg_port) | mjpeg_port | (8090) |
(-json_port) | json_port | (8070) |
-out_filename | *out_filename | data/test/01_out.mp4 |
-out | *outfile | result/result.json |
-prefix | *prefix | result_v/frame_ |
-thresh | thresh | 0.5 |
-iou_thresh | iou_thresh | 0.75 |
(-hier) | hier_thresh | |
(-i) | gpu_index | (0),-1:no_gpu |
-c | cam_index | 0 |
(-s) | frame_skip | |
(-num_of_clusters) | num_of_clusters | |
(-width) | width | |
(-height) | height | |
-ext_output | ext_output | |
-save_labels | save_labels | |
(-gpus) | gpu number | |
(-clear) |
}
train | test | valid | demo | map | arg | 動作 |
1 | 1 | 1 | -dont_show | dont_show | ||
-show | show | |||||
1 | 1 | -letter_box | letter_box | |||
1 | -map | calc_map | ||||
1 | -points | map_points | ||||
-check_mistakes | check_mistakes | |||||
1 | -show_imgs | show_imgs | ||||
1 | 1 | -mjpeg_port | mjpeg_port | |||
1 | -json_port | json_port | ||||
1 | 1 | -out_filename | *out_filename | |||
-out | *outfile | |||||
1 | -prefix | *prefix | ||||
1 | 1 | -thresh | thresh | |||
1 | -iou_thresh | iou_thresh | ||||
1 | 1 | -hier | hier_thresh | |||
-i | ? | |||||
1 | -c | cam_index | ||||
1 | -s | frame_skip | ||||
-num_of_clusters | num_of_clusters | |||||
-width | width | |||||
-height | height | |||||
1 | 1 | -ext_output | ext_output | |||
1 | -save_labels | save_labels | ||||
1 | -gpus | gpu number | ||||
1 | -clear |
-mapオプションで学習時のmAPのグラフを書いてくれます。GPUメモリが少ない場合には落ちるので要注意。
darknet.exe detector train data/originalmodel.data cfg/yolov3-voc_originalmodel.cfg darknet53.conv.74 -map
処理したい画像のリストを作って、食わせちゃえば一括処理できます。
darknet.exe detector test data/originalmodel.data cfg/yolov3-voc_originalmodel_test.cfg backup/originalmodel/yolov3-voc_originalmodel_last.weights -i 0 -thresh 0.5 -dont_show -ext_output < data/testimage/originalmodel/jpeglist.txt -out data/originalmodel/result.json > data/originalmodel/result.txt
リアルタイムに検出結果をモニタリングしたい場合は、-dont_show 1を削除すればOKです。
darknet.exe detector demo data/originalmodel.data cfg/yolov3-voc_originalmodel_test.cfg backup/originalmodel/yolov3-voc_originalmodel_last.weights -thresh 0.5 data/testimage/originalmodel/01.mp4 -dont_show 1 -ext_output -out_filename data/testimage/originalmodel/01_out.mp4 -out data/testimage/originalmodel/out.json > data/testimage/originalmodel/01_res.txt
実は・・・結構凄いんです。
darknet.exe detector demo data/originalmodel.data cfg/yolov3-voc_originalmodel_test.cfg backup/originalmodel/yolov3-voc_originalmodel_last.weights -ext_output data/testimage/originalmodel/01.mp4 -prefix results_v/01/img > results_v/01/result.txt
各イテレーション毎のmAPをテキストで書き出します。ここから各区分ごとのTP、TFを拾ってExcelでグラフにするといい感じ!。
darknet.exe detector map data/originalmodel.data cfg/yolov3-voc_originalmodel_test.cfg backup/originalmodel/yolov3-voc_originalmodel_1000.weights -iou_thresh 0.5 -thresh 0.5 > backup/originalmodel/result_1000.txt
▼この記事を書いたひと
R&Dセンター 松井 良行
R&Dセンター 室長。コンピュータと共に35年。そしてこれからも!
●富士見事務所 TEL : 052-228-8733 FAX : 052-323-3337
〒460-0014 愛知県名古屋市中区富士見町13−22 ファミール富士見711 地図
交通部 R&Dセンター