LoginSignup
21
14

More than 5 years have passed since last update.

ROSでdarknetを動かしてみた。

Last updated at Posted at 2017-05-28

目的

深層学習フレームワークdarknetのYOLO(You only look once)特徴量による物体認識を、ROSラッパーしたパッケージ”darknet_ros”をWEBカメラと接続して動かしてみた。
darknet_ros”はETH Zurich(チューリッヒ工科大)のRobotic Systems Labが作成したものを使用した。

darknet_ros
darknet

predictions.jpg

環境

Ubuntu 16.04(x64)
ROS:Kinetic
GPU:NVIDIA GeForce GTX1050

インストール

ROSのcatkin-toolsをインストールする。
これで catkin buildコマンドが使えるようになる。

sudo apt-get install python-catkin-tools

darknetをダウンロードし、catkinでコンパイルする。

 mkdir -p ~/catkin_darknet/src
 cd ~/catkin_darknet/src
 git clone --recursive https://github.com/leggedrobotics/darknet_ros.git
 cd ../
 catkin build darknet_ros

ROSにパッケージの情報を読みこむ。

source ~/catkin_darknet/devel/setup.bash 

実行

コンソースを3つ立ち上げ、以下のコマンドを実行する。

roscoreの起動

roscore

usbカメラの起動

rosrun usb_cam usb_cam_node /usb_cam/image_raw:=/camera/image_raw

darknet_rosの起動

roslaunch darknet_ros darknet_ros.launch 

rqt_graphの図は以下の様になっている。
darknet_rosgraph.png

検出結果は、/darknet_ros/YOLO_BoundingBoxesでPublishされる。

$ rostopic echo /darknet_ros/YOLO_BoundingBoxes 
---
boundingBoxes: 
  - 
    Class: person   //物体の識別
    probability: 0.382561951876 //尤度
    xmin: 69   //物体のboundingBoxの左上座標
    ymin: 0     //物体のboundingBoxの左上座標
    xmax: 640   //物体のboundingBoxの右下座標
    ymax: 480   //物体のboundingBoxの右下座標
---


21
14
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
14