Objects detection ROS pakage based on OpenCV::dnn.
Authot: Michael.Chen
Website: www.tgeek.tech
ROS::Kinect, OpenCV with OpenCV_contrib no less than 3.3.
######dnn_nets/ : The configration, labels and pre-trained model of networks
- yolo/ -Yolo Configurations
- ssd/ -SSD Configurations
- DetectorNode.hpp
- dnndetector.hpp
- param_config.xml -configuration of video stream
- dnn_param.xml -configuration of dnn
- listener/ -source of listener
- talker/ -source of the main functions
video/ : test video folder
ConfigureCMakeLists.txt
gedit CMakeLists.txt
if you have OpenCV version more than one, uncommit and change line9,set the build path which one you want to use.
#if u have OpenCV version more than one, set the build path which one u want to use
set(OpenCV_DIR "YOUR_PATH")
Ex:
#if u have OpenCV version more than one, set the build path which one u want to use
set(OpenCV_DIR "/home/test/app/opencv-3.4.0/build/")
make sure you are in the ROS catkin workspace.
$ catkin_make
Open a terminal and run the ros master
$ roscore
Open a new terminal. Set this workspace on top!
$ source devel/setup.sh #(option, if workspace not on top)
$ rosrun detector detector_node
If you want to hear the message from the detctor_node. Run the listener node
massages:
[time stemp]
[detected object type]
[detected object confidence]
[detected object center positon]
Open a new terminal. Set this workspace on top!
$ rosrun detector listener
Do not need to re-compile
videl_file location is {ROS_Package Path}/video/{VIdeo Name}
<?xml version="1.0"?>
<opencv_storage>
<!--0-disable 1-enable-->
<show_time>1</show_time> <!--display time on output image-->
<debug_mode>1</debug_mode> <!--wait for keyboard to process next frame-->
<show_fps>0</show_fps> <!--display fps on output image-->
<use_camera>1</use_camera> <!--use camera or video-->
<video_file>test.mp4</video_file> <!--video file name in {ProjectFolder}/video-->
<camera_index>1</camera_index> <!--camera index-->
<window_width>1280</window_width> <!--window size width-->
<window_height>720</window_height> <!--window size height-->
</opencv_storage>
Do not need to re-compile
network files location is {ROS_Package Path}/dnn/{File Name}
<?xml version="1.0"?>
<opencv_storage>
<!-->Configration<-->
<net_type>1</net_type> <!-->0-ssd 1-yolo<-->
<thresh>0.35</thresh> <!-->confidence threshold<-->
<nms_thresh>0.25</nms_thresh> <!-->nms threshold<-->
<!-->Yolo configration files<-->
<Yolo_meanVal>1</Yolo_meanVal>
<Yolo_scaleFactor>0.003921569</Yolo_scaleFactor>
<Yolo_config>/dnn_nets/yolo/yolov3-tiny.cfg</Yolo_config>
<Yolo_model>/dnn_nets/yolo/yolov3-tiny.weights</Yolo_model>
<coco_name>/dnn_nets/yolo/coco.names</coco_name>
<!-->ssd configration files<-->
<ssd_meanVal>127.5</ssd_meanVal>
<ssd_scaleFactor>0.007843</ssd_scaleFactor>
<ssd_config>/dnn_nets/ssd/deploy.prototxt</ssd_config>
<ssd_model>/dnn_nets/ssd/mobilenet_iter_73000.caffemodel</ssd_model>
<ssd_name>/dnn_nets/ssd/ssd.names</ssd_name>
</opencv_storage>