tensorflow根据pb多bitch size去推导物体
with self.detection_graph.as_default():
with tf.Session(graph=self.detection_graph) as sess:
# Expand dimensions since the model expects images to have shape: [1, None, None, 3]
image_np_expanded = np.expand_dims(imageSerialized, axis=0)
image_tensor = self.detection_graph.get_tensor_by_name('image_tensor:0')
# Each box represents a part of the image where a particular object was detected.
boxes = self.detection_graph.get_tensor_by_name('detection_boxes:0')
# Each score represent how level of confidence for each of the objects.
# Score is shown on the result image, together with the class label.
scores = self.detection_graph.get_tensor_by_name('detection_scores:0')
classes = self.detection_graph.get_tensor_by_name('detection_classes:0')
num_detections = self.detection_graph.get_tensor_by_name('num_detections:0')
# Actual detection.
(boxes, scores, classes, num_detections) = sess.run(
[boxes, scores, classes, num_detections],
feed_dict={image_tensor: image_np_expanded})
boxesList.append([boxes,xmin,ymin])
scoresList.append(scores)
classesList.append(classes)
# extractBox.extractBoxMessage(
# RecognizeInfoList,
# boxMessageList,
# classNameList,
# RecognizeInfo,
# incisePictureWidth,
# incisePictureHeight,
# inciseXmin,
# inciseYmin,
# np.squeeze(boxes),
# np.squeeze(classes).astype(np.int32),
# np.squeeze(scores),
# min_score_thresh=0.5
# )
以及高效率不多次生成和关闭sess:
def _detector(self,imageSerializedList,boxesList,scoresList,classesList):
incisePictureWidth=self.beCheckedImageWidth
incisePictureHeight=self.beCheckedImageHeight
with self.detection_graph.as_default():
with tf.Session(graph=self.detection_graph) as sess:
# Expand dimensions since the model expects images to have shape: [1, None, None, 3] image_tensor = self.detection_graph.get_tensor_by_name('image_tensor:0')
# Each box represents a part of the image where a particular object was detected.
boxes = self.detection_graph.get_tensor_by_name('detection_boxes:0')
# Each score represent how level of confidence for each of the objects.
# Score is shown on the result image, together with the class label.
scores = self.detection_graph.get_tensor_by_name('detection_scores:0')
classes = self.detection_graph.get_tensor_by_name('detection_classes:0')
num_detections = self.detection_graph.get_tensor_by_name('num_detections:0')
# Actual detection.
for imageSerialized in imageSerializedList:
image_np_expanded = np.expand_dims(imageSerialized[0], axis=0)
(box, score, cla, num_detection) = sess.run(
[boxes, scores, classes, num_detections],
feed_dict={image_tensor: image_np_expanded})
boxesList.append([box,imageSerialized[1],imageSerialized[2]])
scoresList.append(score)
classesList.append(cla)
tensorflow根据pb多bitch size去推导物体的更多相关文章
- tensorflow打印pb、ckpt模型的参数以及在tensorboard里显示图结构
打印pb模型参数及可视化结构import tensorflow as tf from tensorflow.python.framework import graph_util tf.reset_de ...
- 将keras的h5模型转换为tensorflow的pb模型
h5_to_pb.py from keras.models import load_model import tensorflow as tf import os import os.path as ...
- tensorRT 使用tensorflow的pb问价构建推理
- tensorflow使用pb文件进行模型预测
- Tensorflow object detection API 搭建属于自己的物体识别模型
一.下载Tensorflow object detection API工程源码 网址:https://github.com/tensorflow/models,可通过Git下载,打开Git Bash, ...
- Tensorflow技巧
1.尽量控制图片大小在1024以内,不然显存会爆炸. 2.尽量使用多GPU并行工作,训练下降速度快. 3.当需要被检测的单张图片里物体太多时,记得修改Region_proposals的个数 4.测试的 ...
- OpenCV开发笔记(七十二):红胖子8分钟带你使用opencv+dnn+tensorFlow识别物体
前言 级联分类器的效果并不是很好,准确度相对深度学习较低,本章使用opencv通过tensorflow深度学习,检测已有模型的分类. Demo 可以猜测,1其实是人,18序号类是狗 ...
- TensorFlow object detection API应用--配置
目标检测在图形识别的基础上有了更进一步的应用,但是代码也更加繁琐,TensorFlow专门为此开设了一个object detection API,接下来看看怎么使用它. object detectio ...
- 机器学习框架ML.NET学习笔记【6】TensorFlow图片分类
一.概述 通过之前两篇文章的学习,我们应该已经了解了多元分类的工作原理,图片的分类其流程和之前完全一致,其中最核心的问题就是特征的提取,只要完成特征提取,分类算法就很好处理了,具体流程如下: 之前介绍 ...
随机推荐
- element表单验证
rules: { name:[{ required: true, message: '请输入用户名', trigger: 'blur' },{ min: 2, max: 5, message: '长度 ...
- wpf 几种常用控件样式
转自:http://blog.csdn.net/xuejiren/article/details/39449515
- 基于Swagger+SpringBoot快速构建javaweb项目
章节导航 SpringBoot&Swagger简介 数据模型和接口定义 项目框架生成 业务逻辑实现 项目源码地址 github项目路径:https://github.com/Vikezhu/s ...
- LOJ#6075. 「2017 山东一轮集训 Day6」重建
题目描述: 给定一个 n个点m 条边的带权无向连通图 ,以及一个大小为k 的关键点集合S .有个人要从点s走到点t,现在可以对所有边加上一个非负整数a,问最大的a,使得加上a后,满足:s到t的最短路长 ...
- 【学术篇】状态压缩动态规划——POJ3254/洛谷1879 玉米田Corn Field
我要开状压dp的坑了..直播从入门到放弃系列.. 那就先拿一道状压dp的水题练练手吧.. 然后就找到了这一道..这道题使我清醒地认识到阻碍我的不是算法,而是视力= = 传送门: poj:http:// ...
- Android开发 获取View的尺寸的2个方法
前言 总所周知,在activity启动的onCreate或者其他生命周期里去获取View的尺寸是错误的,因为很有可能View并没有初始化测量绘制完成.你这个时候获取的宽或的高不出意外就是0.所以,我们 ...
- CentOS6.3搭建ZooKeeper伪集群
1. 将zookeeper安装包移动至/home, 解压后改名为zookeeper 相关命令 # 解压 .tar.gz # 重命名 zookeeper 2. 进入zookeeper/conf/目录下, ...
- Excel skill: 如何替换换行符,以及如何把一格转换成多行/多列
http://blog.sciencenet.cn/blog-508298-695290.html 增加一辅助列,用替换函数替换掉软回车.比如A列是数据,从A1开始,则插入B列,B1输入公式=REPL ...
- Python-进程(1)
目录 操作系统发展史 穿孔卡片 联机批处理系统 统计批处理系统 单道 多道技术 空间上复用 时间上复用 并行与并发 进程 程序与进程 进程调度 进程的三个状态 就绪态 运行态 阻塞态 同步和异步 阻塞 ...
- 转:linux下的c/c++开发
源地址:http://zhidao.baidu.com/question/131261452.html 我就是做LINUX下的C开发的. 准确的说,LINUX下C才是主要的开发语言,但是写应用程序还是 ...