両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン 次のリビジョン両方とも次のリビジョン |
opencv_dnn:object_detection [2018/09/18 12:29] – [Yolo] baba | opencv_dnn:object_detection [2018/10/12 10:01] – baba |
---|
| {{indexmenu_n>3}} |
====== Object Detection ====== | ====== Object Detection ====== |
[[opencv_dnn:install|OpenCVでDNN]]にてできあがった実行ファイルである,example_dnn_object_detectionを利用します.実行に先立ち,ネットワークの設定ファイル, | [[opencv_dnn:install|OpenCVでDNN]]にてできあがった実行ファイルである,example_dnn_object_detectionを利用します.実行に先立ち,ネットワークの設定ファイル, |
* configファイル: MobileNetSSD_deploy.prototxt | * configファイル: MobileNetSSD_deploy.prototxt |
* classesファイル:{{ :opencv_dnn:names-voc.txt |}} | * classesファイル:{{ :opencv_dnn:names-voc.txt |}} |
| * 実行時間:65.18[ms] |
| * {{:opencv_dnn:スクリーンショット_2018-09-18_12.34.14.png?400|}} |
| |
ダウンロードが済んだら,下記を実行して動作を確かめてみます. | ダウンロードが済んだら,下記を実行して動作を確かめてみます. |
$ ./example_dnn_object_detection --config=MobileNetSSD_deploy.prototxt --model=MobileNetSSD_deploy.caffemodel --width=300 --height=300 --scale=0.00784 | $ ./example_dnn_object_detection --config=MobileNetSSD_deploy.prototxt --model=MobileNetSSD_deploy.caffemodel --width=300 --height=300 --scale=0.00784 --input=dog.jpg |
| |
カメラが起動して,眼の前の自分がpersonとして識別されていればOKです. | カメラで起動したい場合は,inputのオプションを消すと,デフォルトカメラで起動します. |
| |
===== SSDs from TensorFlow ===== | ===== SSDs from TensorFlow ===== |
ダウンロード後展開し,その中にある frozen_inference_graph.pb をmodelファイルとして指定します.configファイルには,解凍したファイルからpbtxtを生成するのが正しいやり方になります. | ダウンロード後展開し,その中にある frozen_inference_graph.pb をmodelファイルとして指定します.configファイルには,解凍したファイルからpbtxtを生成するのが正しいやり方になります. |
* {{ :opencv_dnn:ssd_mobilenet_v1_coco_2017_11_17.pbtxt |}} | * {{ :opencv_dnn:ssd_mobilenet_v1_coco_2017_11_17.pbtxt |}} |
| * 実行時間:63.86[ms] |
| * {{:opencv_dnn:スクリーンショット_2018-09-18_12.32.49.png?400|}} |
| |
$ ./example_dnn_object_detection --config=ssd_mobilenet_v1/ssd_mobilenet_v1_coco_2017_11_17.pbtxt --model=ssd_mobilenet_v1/frozen_inference_graph.pb --classes=names.txt --width=300 --height=300 --scale=1.0 --rgb | $ ./example_dnn_object_detection --config=ssd_mobilenet_v1/ssd_mobilenet_v1_coco_2017_11_17.pbtxt --model=ssd_mobilenet_v1/frozen_inference_graph.pb --classes=names.txt --width=300 --height=300 --scale=1.0 --rgb --input=dog.jpg |
| |
==== ssd_mobilenet_v2_coco ==== | ==== ssd_mobilenet_v2_coco ==== |
上記同様に froen_inference_graph.pb をmodelファイル,configファイルには生成したpbtxtを使う.ここでは生成したファイルをはっつけます. | 上記同様に froen_inference_graph.pb をmodelファイル,configファイルには生成したpbtxtを使う.ここでは生成したファイルをはっつけます. |
* {{ :opencv_dnn:ssd_mobilenet_v2_coco_2018_03_29.pbtxt |}} | * {{ :opencv_dnn:ssd_mobilenet_v2_coco_2018_03_29.pbtxt |}} |
| * 実行時間:91.83[ms] |
| * {{:opencv_dnn:スクリーンショット_2018-09-18_12.31.35.png?400|}} |
| |
$ ./example_dnn_object_detection --config=ssd_mobilenet_v2/ssd_mobilenet_v2_coco_2018_03_29.pbtxt --model=ssd_mobilenet_v1/frozen_inference_graph.pb --classes=names.txt --width=300 --height=300 --scale=1.0 --rgb | $ ./example_dnn_object_detection --config=ssd_mobilenet_v2/ssd_mobilenet_v2_coco_2018_03_29.pbtxt --model=ssd_mobilenet_v2/frozen_inference_graph.pb --classes=names.txt --width=300 --height=300 --scale=1.0 --rgb --input=dog.jpg |
===== SSD from Caffe ===== | ===== SSD from Caffe ===== |
MobileNetではなく,元々のオリジナルSSDのcaffe実装.まずは下記リンクから一式ダウンロードし,必要なモデル,configファイルを持ってくる. | MobileNetではなく,元々のオリジナルSSDのcaffe実装.まずは下記リンクから一式ダウンロードし,必要なモデル,configファイルを持ってくる. |