Cozmo&AI作業

zhangrelay發表於2018-12-18

學習下面連結內容,將其實現並應用到Cozmo或mrobot機器人中。




參考連結:

1. ros_caffe:github.com/tzutalin/ros_caffe

2. Tensorflow_in_ROS:github.com/shunchan0677/Tensorflow_in_ROS

3. cozmo-tensorflow:github.com/whatrocks/cozmo-tensorflow


ros_people_object_detection_tensorflow

github.com/cagbal/ros_people_object_detection_tensorflow

廣泛使用的ROS工具箱,用於物體檢測和跟蹤以及面部/動作識別,具有2D和3D支援,使機器人瞭解周圍的環境。

 

技術

此repo使用許多開源專案來正常工作:

對於Tracker部分:

  • scikit學習
  • scikit影象
  • FilterPy

安裝

首先,應在您的系統上安裝tensorflow。

然後,

$ cd && mkdir -p catkin_ws/src && cd ..
$ catkin_make && cd src
$ git clone --recursive https://github.com/cagbal/
ple_object_detection_tensorflow.git
$ git clone https://github.com/cagbal/cob_perception_common.git
$ cd cob_people_object_detection_tensorflow/src
$ protoc object_detection/protos/*.proto --python_out=.
$ cd ~/catkin_ws
$ rosdep install --from-path src/ -y -i
$ catkin_make
$ pip install face_recognition

repo包含最快的基於mobilenet的方法,因此您可以跳過以下步驟。

然後,從 Models Zoo中安裝tensorflow物件檢測模型

並將這些模型放入src / object_detection /,最後設定launch / cob_people_object_detection_tensoflow_params.yaml的model_name引數

執行

在ROS中開啟相機驅動程式,並在啟動目錄下的yaml配置檔案中設定輸入RGB主題名稱。預設值為openni2。

用於執行一切,(這將適用於2D和3D)

$ roslaunch cob_people_object_detection_tensorflow alltogether.launch

上面的程式碼將啟動所有內容。它非常適合從這個回購開始。但是,如果您需要一些靈活性,則需要逐個啟動每個節點。如下:

對於物體檢測:

$ roslaunch cob_people_object_detection_tensorflow cob_people_object_detection_tensorflow.launch

然後,它開始為每個檢測到的物件分配ID,並將結果釋出到/ object_tracker / tracks。請注意,檢測到的跟蹤物件編號可能不同。

如果您還想執行跟蹤器,

$ roslaunch cob_people_object_detection_tensorflow cob_people_object_tracker.launch

如果您還想執行face_recognition,

將人臉影象放入人員資料夾並啟動:

$ roslaunch cob_people_object_detection_tensorflow cob_face_recognizer.launch

如果你還想執行深度探測器,

$ roslaunch cob_people_object_detection_tensorflow projection.launch

並設定detections.pose.pose.position.x / y / z並將其設為pusblishes。

如果您還想執行動作識別,

$ roslaunch cob_people_object_detection_tensorflow action_recognition.launch

然後,您將看到/ action_recognition / action_predictions上釋出的概率

Subscibes:訂閱

  • 到* params.yaml檔案中設定的任何RGB影象主題。

     Publishes:釋出

  • / object_detection / detection(cob_perception_msgs / DetectionArray)包括所有具有概率,標籤和邊界框的檢測
  • / object_detection / detections_image(sensor_msgs / Image)帶有邊界框的影象
  • / object_tracker / tracks(cob_perception_msgs / DetectionArray)僅包含跟蹤物件及其邊界框,標籤。這裡,ID是跟蹤器分配的檢測ID。示例:DetectionArray.detections [0] .id
  • / face_recognizer / faces(cob_perception_msgs / DetectionArray)帶有面部和人物邊界框的面部標籤
  • / action_recognition / action_predictions(cob_perception_msgs / ActionRecognitionmsg)使用Kinetics 600資料集標籤的動作識別概率

效能

我的計算機(Intel(R)Core(TM)i7-6820HK CPU @ 2.70GHz)的最後五次檢測時間為幾秒鐘:

  • 0.105810880661
  • 0.108750104904
  • 0.112195014954
  • 0.115020036697
  • 0.108013153076

 

相關文章