tf.gfile.FastGFile()
来源:互联网 发布:mac梦幻西游更新不了 编辑:程序博客网 时间:2024/06/06 02:00
tf.gfile.FastGFile(path,decodestyle)
函数功能:实现对图片的读取。
函数参数:(1)path:图片所在路径 (2)decodestyle:图片的解码方式。(‘r’:UTF-8编码; ‘rb’:非UTF-8编码)
import matplotlib.pyplot as plt import tensorflow as tf #tf.gfileGFile()函数:读取图像 image_jpg = tf.gfile.FastGFile('dog.jpg','rb').read() image_png = tf.gfile.FastGFile('lizard.png','rb').read() with tf.Session() as sess: image_jpg = tf.image.decode_jpeg(image_jpg) #图像解码 print(sess.run(image_jpg))#打印解码后的图像(即为一个三维矩阵[w,h,3]) image_jpg = tf.image.convert_image_dtype(image_jpg,dtype=tf.uint8) #改变图像数据类型 image_png = tf.image.decode_png(image_png) print(sess.run(image_jpg)) image_png = tf.image.convert_image_dtype(image_png,dtype=tf.uint8) plt.figure(1) #图像显示 plt.imshow(image_jpg.eval()) plt.figure(2) plt.imshow(image_png.eval())
阅读全文
0 0
- tf.gfile.FastGFile()
- tf.gfile.FastGFile造成的'utf-8' codec can't decode..错误
- TensorFlow-tf.gfile()模块
- tf.gfile的应用 来自tensorflow官网
- Tensorflow r0.11的tf.gfile.Glob()错误
- 使用 tf.gfile.DeleteRecursively 时,报 FailedPreconditionError 错误
- tensorflow.python.platform.gfile
- Gfile-超G传输
- TF
- tf
- tensorflow直接读取图像数据之gfile,WholeFileReader,read_file
- tf.scatter_update tf.scatter_sub
- tf.get_variable tf.variable_scope tf.name_scope
- TF/IDF
- TF-IDF
- TF-IDF
- TF-IDF
- TF-IDF
- 树莓派的硬件原理图
- 如何在Dev c++中查看程序生成的汇编代码
- WPF自定义搜索控件
- HTML5 WEBGL学习1 3D基础知识
- Android设计模式
- tf.gfile.FastGFile()
- HTTP请求状态码大全
- 669. Trim a Binary Search Tree
- 安装nginx和 nginx负载均衡
- 一只程序猿的养成日记 第一章 第十节 递归和非递归分别实现求第n个斐波那契数
- 左侧导航栏
- 7-7 螺旋方阵(20 分)
- jdk源码阅读之AbstractList
- 2017-12-15 centos 7 lamp环境搭建