Bootstrap

关于DNN检测中替换caff用Tensorflow的注意事项

首先确保计算机中有python标准库,之后在环境变量中加入python的路径,这样在管理员的cmd中才不会出现tf_text_graph_ssd.py无法编译的情况,之后要在python的环境下添加opencv,不然会导致无法生成pbtxt文件,从而std::string model_text_file = "C:/Users/ss/Desktop/bbb/ssd_mobilenet_v2_coco_2018_03_29/ssd_mobilenet_v2_coco_2018_03_29/frozen_inference_graph.pb";
std::string modelFile = "C:/Users/ss/Desktop/bbb/ssd_mobilenet_v2_coco_2018_03_29/ssd_mobilenet_v2_coco_2018_03_29/frozen_inference_graph.pbtxt";无法读取位置。值得注意的是Net net = readNetFromTensorflow(model_text_file,modelFile);的model的位置和CAFF是相反的,Mat blobImage = blobFromImage(frame, 1.0,
    Size(300, 300),
    Scalar(127.5, 127.5, 127.5), true, false);要跟及models的模板来写。最后Mat detection = net.forward("detection_out");要将caff的命名层删掉。

1.python标准库

2.python的环境下添加opencv

3.tf_text_graph_ssd.py

4.input C:\Users\ss\Desktop\bbb\ssd_mobilenet_v2_coco_2018_03_29\ssd_mobilenet_v2_coco_2018_03_29\frozen_inference_graph.pb --out C:\Users\ss\Desktop\bbb\ssd_mobilenet_v2_coco_2018_03_29\ssd_mobilenet_v2_coco_2018_03_29\frozen_inference_graph.pbtxt --config  C:\Users\ss\Desktop\bbb\ssd_mobilenet_v2_coco_2018_03_29\ssd_mobilenet_v2_coco_2018_03_29\pipeline.config

5.readNetFromTensorflow(model_text_file,modelFile)

6.格式

7.net.forward("detection_out")

;