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

相关推荐
IT_陈寒1 天前
React 18实战:7个被低估的Hooks技巧让你的开发效率提升50%
前端·人工智能·后端
逛逛GitHub1 天前
飞书多维表“独立”了!功能强大的超出想象。
人工智能·github·产品
机器之心1 天前
刚刚,DeepSeek-R1论文登上Nature封面,通讯作者梁文锋
人工智能·openai
aneasystone本尊1 天前
学习 Chat2Graph 的知识库服务
人工智能
IT_陈寒1 天前
Redis 性能翻倍的 7 个冷门技巧,第 5 个大多数人都不知道!
前端·人工智能·后端
飞哥数智坊2 天前
GPT-5-Codex 发布,Codex 正在取代 Claude
人工智能·ai编程
倔强青铜三2 天前
苦练Python第46天:文件写入与上下文管理器
人工智能·python·面试
虫无涯2 天前
Dify Agent + AntV 实战:从 0 到 1 打造数据可视化解决方案
人工智能
Dm_dotnet2 天前
公益站Agent Router注册送200刀额度竟然是真的
人工智能
算家计算2 天前
7B参数拿下30个世界第一!Hunyuan-MT-7B本地部署教程:腾讯混元开源业界首个翻译集成模型
人工智能·开源