The Movidius™ Neural Compute Stick (NCS) is a tiny fanless deep learning device that you can use to learn AI programming at the edge. NCS is powered by the same low power high performance Movidius™ Vision Processing Unit (VPU) that can be found in millions of smart security cameras, gesture controlled drones, industrial machine vision equipment, and more.
This project is a ROS wrapper for NC API of NCS SDK, providing the following features in the latest release(v0.3.0):
- A ROS service for classifying objects in a static image file
- A ROS publisher for classifying objects in a video stream from a USB camera
- Demo applications to show the capbilities of ROS service and publisher
- Support multiple CNN models
- An x86_64 computer running Ubuntu 16.04
- ROS Kinetic
- Movidius Neural Compute Stick (NCS)
- Movidius Neural Compute (MvNC) SDK
- USB Camera, e.g. Realsense ZR300 camera or standard USB camera
- Install ROS Kinetic Desktop-Full (guide)
- Create a catkin workspace (guide)
- Install NCS SDK (guide)
- Create a symbol link in
/opt
to the installation path of NCS SDK<ncs-sdk-installation-path>
sudo ln -s <ncs-sdk-installation-path> /opt/NCS
After that, make sure you can find graph data in /opt/NCS/ncapi/networks
and image data in /opt/NCS/ncapi/images
- Install ROS package for different cameras as needed. e.g.
- Standard USB camera
sudo apt-get install ros-kinetic-usb-cam
- Realsense ZR300 camera
Install Realsense camera package (guide). Refer to Realsense ROS WiKi for more information.
cd ~/catkin_ws/src
git clone https://github.com/intel/ros_intel_movidius_ncs.git
cd ~/catkin_ws
catkin_make
catkin_make install
source devel/setup.bash
Launch video streaming nodelet. Refer here for more parameter configurations.
roslaunch movidius_ncs_launch ncs_usbcam.launch
Make sure you can get result from the topic of object classification.
rostopic echo /movidius_ncs_nodelet/classified_object
Launch image viewer to show the inference result.
roslaunch movidius_ncs_launch ncs_stream_example.launch camera_topic:="/usb_cam/image_raw"
Launch video streaming nodelet. Refer here for more parameter configurations.
roslaunch movidius_ncs_launch ncs_realsense.launch
Make sure you can get result from the topic of object classification.
rostopic echo /movidius_ncs_nodelet/classified_object
Launch image viewer to show the inference result. You can launch it directly without setting camera_topic
, as its default value is /camera/color/image_raw
roslaunch movidius_ncs_launch ncs_stream_example.launch camera_topic:="/camera/color/image_raw"
#or
roslaunch movidius_ncs_launch ncs_stream_example.launch
Launch your preferred camera node.
#launch ROS master
roscore
#launch camera node in another console
rosrun <your-camera-pkg> <your-camera-node>
e.g.
roscore
rosrun usb_cam usb_cam_node
Launch NCS nodelet and assign input_topic
with the topic url of your rgb camera.
roslaunch movidius_ncs_launch ncs_nocam.launch input_topic:=<your_rgb_camera_topic>
e.g.
roslaunch movidius_ncs_launch ncs_nocam.launch input_topic:="/usb_cam/image_raw"
Launch image viewer to show the inference result.
roslaunch movidius_ncs_launch ncs_stream_example.launch camera_topic:=<your_rgb_camera_topic>
e.g.
roslaunch movidius_ncs_launch ncs_stream_example.launch camera_topic:="/usb_cam/image_raw"
Launch object classification service. Refer here for more parameter configurations.
roslaunch movidius_ncs_launch ncs_image.launch
Run the example application with an absolute path of an image
rosrun movidius_ncs_example movidius_ncs_example_image <image_path_to_be_inferred>
e.g.
rosrun movidius_ncs_example movidius_ncs_example_image /opt/NCS/ncapi/images/cat.jpg
You can choose different CNN Models for inference through the argument of network_conf_path
. e.g.
Using Realsense camera
#one console
roslaunch movidius_ncs_launch ncs_realsense.launch network_conf_path:="/opt/NCS/ncapi/networks/SqueezeNet/"
#another console
roslaunch movidius_ncs_launch ncs_stream_example.launch
Using standard USB camera
#one console
roslaunch movidius_ncs_launch ncs_usbcam.launch network_conf_path:="/opt/NCS/ncapi/networks/AlexNet/"
#another console
roslaunch movidius_ncs_launch ncs_stream_example.launch camera_topic:="/usb_cam/image_raw"
/movidius_ncs_nodelet/classified_object
/movidius_ncs_image/classify_object
Node | Arguments | Default Value | Description |
---|---|---|---|
ncs | input_topic | /camera/color/image_raw | subscribed rgb camera topic |
ncs | output_topic | /movidius_ncs_nodelet/classified_object | published topic of inference results |
ncs | device_index | 0 | ncs device index |
ncs | log_level | 1 | ncs log level |
ncs | network_conf_path | /opt/NCS/ncapi/networks/GoogLeNet | CNN model for inference |
ncs | top_n | 3 | the number of results to be shown |
realsense | color_width | 1920 | frame width |
realsense | color_height | 1080 | frame height |
usb cam | image_width | 640 | frame width |
usb cam | image_height | 480 | frame height |
usb cam | video_device | /dev/video0 | use camera device node |
CNN Model | Weights | Status |
---|---|---|
GoogleNet | weights | Supported |
AlexNet | weights | Supported |
SqueezeNet | weights | Supported |
Gender | weights | Supported |
Age | weights | Not supported |
- Only absolute path of image file supported in image inference demo
- Only test on Realsense ZR300 camera and Microsoft HD-300 USB camera
- Support multiple NCS devices
- Support more CNN models