【发布时间】:2017-03-09 11:01:04
【问题描述】:
我想用 python 和 opencv 从视频中捕获帧,然后用 tensorflow 对捕获的 Mat 图像进行分类。问题是我不知道如何将 de Mat 格式转换为 3D 张量变量。这就是我现在使用 tensorflow 的方式(从文件加载图像):
image_data = tf.gfile.FastGFile(imagePath, 'rb').read()
with tf.Session() as sess:
softmax_tensor = sess.graph.get_tensor_by_name('final_result:0')
predictions = sess.run(softmax_tensor,
{'DecodeJpeg/contents:0': image_data})
如果有任何帮助,我将不胜感激,在此先感谢
【问题讨论】:
标签: python opencv tensorflow