首先确保计算机中有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的命名层删掉。