Option 2: USB camera

December 21, 2017 ยท View on GitHub

Classification for Video

This project supports multiple CNN models for classification. Please make sure you have already set up environment and installed this project correctly. You can refer to the following links for your interested models then.

1 CNN Models

2 Run with Other ROS Supported Cameras

3 Other Arguments


1 CNN Models

Compile NCS graph.

cd /opt/movidius/ncappzoo/caffe/AlexNet
make

Launch video streaming nodelet.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=alexnet camera:=realsense
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=alexnet camera:=usb

Launch image viewer to show the classification result on another console.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/camera/color/image_raw"
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/usb_cam/image_raw"

Compile NCS graph.

cd /opt/movidius/ncappzoo/caffe/GoogleNet
make

Launch video streaming nodelet.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=googlenet camera:=realsense
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=googlenet camera:=usb

Launch image viewer to show the classification result on another console.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/camera/color/image_raw"
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/usb_cam/image_raw"

Compile NCS graph.

cd /opt/movidius/ncappzoo/caffe/SqueezeNet
make

Launch video streaming nodelet.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=squeezenet camera:=realsense
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=squeezenet camera:=usb

Launch image viewer to show the classification result on another console.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/camera/color/image_raw"
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/usb_cam/image_raw"

Compile NCS graph.

cd /opt/movidius/ncappzoo/tensorflow/inception_v1
make

Launch video streaming nodelet.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=inception_v1 camera:=realsense
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=inception_v1 camera:=usb

Launch image viewer to show the classification result on another console.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/camera/color/image_raw"
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/usb_cam/image_raw"

Compile NCS graph.

cd /opt/movidius/ncappzoo/tensorflow/inception_v2
make

Launch video streaming nodelet.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=inception_v2 camera:=realsense
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=inception_v2 camera:=usb

Launch image viewer to show the classification result on another console.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/camera/color/image_raw"
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/usb_cam/image_raw"

Compile NCS graph.

cd /opt/movidius/ncappzoo/tensorflow/inception_v3
make

Launch video streaming nodelet.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=inception_v3 camera:=realsense
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=inception_v3 camera:=usb

Launch image viewer to show the classification result on another console.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/camera/color/image_raw"
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/usb_cam/image_raw"

Compile NCS graph.

cd /opt/movidius/ncappzoo/tensorflow/inception_v4
make

Launch video streaming nodelet.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=inception_v4 camera:=realsense
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=inception_v4 camera:=usb

Launch image viewer to show the classification result on another console.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/camera/color/image_raw"
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/usb_cam/image_raw"

Compile NCS graph.

cd /opt/movidius/ncappzoo/tensorflow/mobilenets
make

Launch video streaming nodelet.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=mobilenet camera:=realsense
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=mobilenet camera:=usb

Launch image viewer to show the classification result on another console.

# Option 1: RealSense
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/camera/color/image_raw"
# Option 2: USB camera
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:="/usb_cam/image_raw"

2 Run with Other ROS Supported Cameras

Though this ROS package is only tested on RealSense D400 series camera and Microsoft HD-300 USB camera, other ROS supported cameras probably work as well. You can try in this way:
Launch your preferred camera node.

#launch ROS master
roscore
#launch camera node on another console
rosrun <your-camera-pkg> <your-camera-node>

Launch video streaming nodelet and assign input_topic with the topic URL of your RGB camera.

# Launch video streaming nodelet
roslaunch movidius_ncs_launch ncs_camera.launch cnn_type:=googlenet camera:=others input_topic:=<your_rgb_camera_topic>
# Launch image viewer to show the classification result on another console
roslaunch movidius_ncs_launch ncs_stream_classification_example.launch camera_topic:=<your_rgb_camera_topic>

3 Other Arguments

ArgumentsDescriptionDefault ValueValid Values
device_indexncs device index00~N-1(N is the maximum number of inserted NCS devices)
log_levelncs log level00:Nothing / 1:Errors / 2:Verbose
cnn_typeindicate different cnn modelsgooglenetalexnet / googlenet / squeezenet / inception_v1 / inception_v2 / inception_v3 / inception_v4 / mobilenet
top_nthe number of results to be shown, only valid for classification30~5
input_topicRGB camera topic to be subscribed/camera/color/image_rawonly valid when "camera:=others"
output_topicpublished topic of inference results/movidius_ncs_nodelet/classified_objectsany valid topic name
cameracamera typeothersusb / realsense / others
color_widthframe width of RealSense D400640any resolution that RealSense D400 supports
color_heightframe height of RealSense D400480any resolution that RealSense D400 supports
image_widthframe width of USB camera640any resolution that USB camera supports
image_heightframe height of USB camera480any resolution that USB camera supports
video_deviceUSB camera device node/dev/video0any available video device node