关于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")

相关推荐
Skrrapper4 分钟前
【大模型开发之数据挖掘】2.数据挖掘的核心任务与常用方法
数据库·人工智能·数据挖掘
围炉聊科技5 分钟前
尝鲜 AWS Agentic IDE:Kiro 一周使用初体验
ide·人工智能·ai编程·aws
智算菩萨1 小时前
从对话演示到智能工作平台:ChatGPT的三年演进史(2022-2025)
人工智能·chatgpt
lsrsyx1 小时前
以科技守护长寿:Quantum Life 自主研发AI驱动平台助力港怡医疗,开启香港精准预防医疗新时代
人工智能·科技
Good kid.1 小时前
基于XGBoost的中文垃圾分类系统实战(TF-IDF + XGBoost)
人工智能·分类·tf-idf
It's now8 小时前
Spring AI 基础开发流程
java·人工智能·后端·spring
Glad_R8 小时前
巧用AI流程图,让信息呈现更全面
人工智能·信息可视化·产品运营·流程图·产品经理
西南胶带の池上桜9 小时前
1.Pytorch模型应用(线性与非线性预测)
人工智能·pytorch·python
杀生丸学AI9 小时前
【无标题】VGGT4D:用于4D场景重建的视觉Transformer运动线索挖掘
人工智能·深度学习·3d·aigc·transformer·三维重建·视觉大模型