Technology-OpenCV 转 Tensorflow 格式

OpenCV 转 Tensorflow 图片格式。

1
2
3
4
5
image_data = tf.gfile.FastGFile(image_path, 'rb').read()
predictions = sess.run(softmax_tensor, {'DecodeJpeg/contents:0':image_data})

image_data = cv2.imread(image_path)
predictions = sess.run(softmax_tensor, {'DecodeJpeg/contents:0': cv2.imencode('.jpg', image_data)[1].tostring()})