计算机视觉caffe之路第五篇:关于ssd_detect.cpp的使用方法

1.ssd_detect.py的使用

在caffe/examples/ssd下有很多python版本的目标检测文件可用:

ssd_detect.py
ssd_pascal_webcam.py
ssd_pascal_video.py

用python方法进行detect比较简单,但根据目前使用情况来看,速度较慢,在Jetson TX1下,执行

# Forward pass.
detections = net.forward()['detection_out']

这一行需要300~500ms,效果不理想。

2.ssd_detect.cpp的使用

1)按照教程 计算机视觉caffe之路第一篇:Ubuntu16.04_Jetson TX1_Caffe_ssd环境配置配置后,在caffe/.build_release/examples/ssd/目录下可以找到:

ssd_detect.bin

使用该文件可以进行目标检测:

// Usage:
//    ssd_detect [FLAGS] model_file weights_file list_file
//
// where model_file is the .prototxt file defining the network architecture, and
// weights_file is the .caffemodel file containing the network parameters, and
// list_file contains a list of image files with the format as follows:
//    folder/img1.JPEG
//    folder/img2.JPEG
// list_file can also contain a list of video files with the format as follows:
//    folder/video1.mp4
//    folder/video2.mp4
  ./build/examples/ssd/ssd_detect.bin \
  models/VGGNet/VOC0712/SSD_300x300/deploy.prototxt \
  models/VGGNet/VOC0712/SSD_300x300/VGG_VOC0712_SSD_300x300_iter_120000.caffemodel \
  examples/videos/test.txt \
  --file_type video \
  --out_file output.txt \
  --confidence_threshold 0.4

2)修改ssd_detect.cpp并编译:
计算机视觉caffe之路第五篇:关于ssd_detect.cpp的使用方法_第1张图片



参考文献:

How to use the ssd_detect.cpp to detect objects in a image
How to compile ssd_detect.cpp

关于ssd_detect.cpp

你可能感兴趣的:(计算机视觉,caffe,SSD)