/mobileNet-ssd

About object detection(mobileNet-ssd) tensorflow/language:c++

Primary LanguageC++

mobileNet-ssd

ABOUT

  • mobilenet ssd
  • tensorflow /c++/python
  • catkin_make

INSTALL

 cd mobileNet-ssd
 catkin_make

RUN

  • tensorflow c++
    rosrun mobileNet mobileNet_pb
    or
    ./devel/lib/mobileNet/mobileNet_pb
  • opencv dnn
    rosrun mobileNet mobileNet_opencv
    or
    ./devel/lib/mobileNet/mobileNet_opencv
  • python
    python src/mobileNet/python/ssd-mobilenet.py

tensorflow模型预测对比总结

将通过以下的方法进行模型预测部分的实现

  • Tensorflow c++
  • Tensorflow python
  • Opencv dnn

对比分析内容

  • 图片输入说明(图片加载)
    • Tensorflow c++ :
      tensorflow ops::ReadFile/DecodePng
    • Tensorflow python :
      load_image_into_numpy_array(numpy)
    • Opencv dnn :
      cv::imread(imagePath)
  • 模型加载说明
    • Tensorflow c++ :
      Status status = ReadBinaryProto(Env::Default(),MODEL_PATH,&graph_def);
    • Tensorflow python:
      with gfile.FastGFile(PATH_TO_PB) as f:
          graph_def = tf.GraphDef()
          graph_def.ParseFromString(f.read())
          sess.graph.as_default()
          tf.import_graph_def(graph_def,name='')
      or 
      with open(PATH_TO_PB) as f:
          graph_def = tf.GraphDef()
          .......
    • opencv DNN :
      dnn::Net net = cv::dnn::readNetFromTensorflow(weights, prototxt);

时间对比:

  • Opencvdnn :detection time: 618.522 ms
  • Tensorflow c++ :detection time:699.195 ms
  • Tensorflow python : detection time : 5916.458 ms

效果展示

  • Tensorflow c++
    tensorflow-c++
  • Tensorflow python
    python
  • Opencv dnn
    opencv