This work is similar to the previous work here , but this time I used Single Shot MultiBox Detector (SSD) for car detection. Installation is similar, clone the SSD Caffe:
git clone https : //github.com/weiliu89/caffe.git ssdcaffe
cd ssdcaffe
git checkout 5365d0dccacd18e65f10e840eab28eb65ce0cda
add the following lines to your Makefile.config
INCLUDE_DIRS += /usr /include /hdf5 /serial
LIBRARY_DIRS += /usr /lib /x86_64 -linux -gnu /hdf5 /serial
and build it:
used video_stream_opencv to stream your video:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
< ! --
Example of run :
roslaunch video_file . launch video_file : =/home /behnam /Desktop /dash_cam . mp4
-->
< launch >
< ! -- launch video stream -->
< ! --remaping the topic -->
< remap from ="/videofile/image_raw" to ="/image_raw" />
< include file ="$(find video_stream_opencv)/launch/camera.launch" >
< ! -- node name and ros graph name -->
< arg name ="camera_name" value ="videofile" />
< ! -- full path to the video file -->
< arg name ="video_stream_provider" value ="$(arg video_file)" />
< ! -- throttling the querying of frames to -->
< arg name ="fps" value ="30" />
< ! -- setting frame_id -->
< arg name ="frame_id" value ="videofile_frame" />
< /include >
< /launch >
download the trained model from here and put them in the model directory.
source /opt /ros /kinetic /setup . bash
source /home /< user_name > /Autoware /ros /devel /setup . sh
export ROS_PACKAGE_PATH =/home /< user_name > /Autoware /: $ ROS_PACKAGE_PATH
roslaunch cv_tracker ssd . launch
In my ssd.launch, I have changed my trained network into:
< ! --
< arg name ="network_definition_file" default ="$(env HOME)/ssdcaffe/models/VGGNet/VOC0712/SSD_500x500/deploy.prototxt" />
< arg name ="pretrained_model_file" default ="$(env HOME)/ssdcaffe/models/VGGNet/VOC0712/SSD_500x500/VGG_VOC0712_SSD_500x500_iter_60000.caffemodel" />
-->
< arg name ="network_definition_file" default ="$(env HOME)/ssdcaffe/models/VGGNet/ilsvrc15/SSD_500x500/deploy.prototxt" />
< arg name ="pretrained_model_file" default ="$(env HOME)/ssdcaffe/models/VGGNet/ilsvrc15/SSD_500x500/VGG_ilsvrc15_SSD_500x500_iter_480000.caffemodel" />
Now run the following to open rviz:
source /opt /ros /kinetic /setup . bash
source /home /< user_name > /Autoware /ros /devel /setup . sh
export ROS_PACKAGE_PATH =/home /< user_name > /Autoware /: $ ROS_PACKAGE_PATH
rosrun rviz rviz
in the rviz, go to add a panel, and add integrated viewer>ImageViewrPlugin.
Now correct the topic in the added panel and you should see detected cars:
VIDEO