1. 程式人生 > >計算機視覺caffe之路第五篇:關於ssd_detect.cpp的使用方法

計算機視覺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的使用

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並編譯:
這裡寫圖片描述



參考文獻: