【tensorFlow】——图像数据增强、读取图像、保存图像,雷柏v8(tensorflow2 制作图像数据集)
cpugpu芯片开发光刻机
开发者生态
3
文件名:【tensorFlow】——图像数据增强、读取图像、保存图像,雷柏v8
【tensorFlow】——图像数据增强、读取图像、保存图像
#!/usr/bin/env python# -*- coding: utf-8 -*-# @Time : 2021/4/13 10:54# @Author : @linlianqin# @Site : # @File : 数据增强(distorted).py# @Software: PyCharm# @description:一些基于TensorFlow的数据处理方法import tensorflow as tfimport cv2import matplotlib.pyplot as pltpath = r'E:\gitHubProjects\tensorflow_learning\CNN卷积神经网络-cifar数据集分类\tensorflow_image_processing\1.png'def tf_imgae_processing():# 读取图像文件image_raw = tf.gfile.GFile(path,'rb').read() # 以二进制的形式读取with tf.Session() as sess:## 对图像进行解码得到图像的三维矩阵数据image_data = tf.image.decode_image(image_raw)h,w,c = image_data.eval().shapeprint("image_data.shape:",(h,w,c))# 显示图像plt.imshow(image_data.eval())plt.show()# 裁剪图像crop_img = tf.random_crop(image_data,[300,300,c])plt.imshow(crop_img.eval())plt.show()## 保存图像crop_encode_img = tf.image.encode_png(crop_img)with tf.gfile.GF
同类推荐
-

-【SGU - 114】Telecasting station (带权中位数 或 三分),关键词
查看 -

【PWN】学习笔记(一)【二进制基础】,fulltao(二进制讲解)
查看 -

【Promise】某个异步方法执行结束后 在执行下面方法,无线耳麦
查看 -

【QT】解决QTableView修改合并单元格内容无法修改到合并范围内的单元格,抢小米3
查看 -

【QT表格-6】QTableWidget的currentCellChanged实现中途撤销,三星i728
查看 -

【Qt开发经验】Qt信号槽连接不成功问题原因汇总,诺亚舟搜学王(qt信号槽连接connect无响应)
查看 -

【RNA structures】RNA-seq 分析- RNA转录的重构和前沿测序技术,三星i728
查看 -

【RabbitMQ实战】07 3分钟部署一个RabbitMQ集群,iphone4上不了网
查看 -

【React】【react-globe.gl】3D Objects效果,三星i9008怎么样
查看