tensorflow中的随机裁剪函数random_crop
来源:互联网 发布:centos和redhat的区别 编辑:程序博客网 时间:2024/06/01 23:13
tf.random_crop是tensorflow中的随机裁剪函数,可以用来裁剪图片。我采用如下图片进行随机裁剪,裁剪大小为原图的一半。
如下是实验代码
import tensorflow as tfimport matplotlib.image as imgimport matplotlib.pyplot as pltsess = tf.InteractiveSession()image = img.imread('D:/Documents/Pictures/logo3.jpg')reshaped_image = tf.cast(image,tf.float32)size = tf.cast(tf.shape(reshaped_image).eval(),tf.int32)height = sess.run(size[0]//2)width = sess.run(size[1]//2)distorted_image = tf.random_crop(reshaped_image,[height,width,3])print(tf.shape(reshaped_image).eval())print(tf.shape(distorted_image).eval())fig = plt.figure()fig1 = plt.figure()ax = fig.add_subplot(111)ax1 = fig1.add_subplot(111)ax.imshow(sess.run(tf.cast(reshaped_image,tf.uint8)))ax1.imshow(sess.run(tf.cast(distorted_image,tf.uint8)))plt.show()
如下是随机实验两次的结果
阅读全文
0 0
- tensorflow中的随机裁剪函数random_crop
- tensorflow里面几个随机函数的用法
- tensorflow中的优化函数
- tensorflow中的激活函数
- C#中的随机函数
- VC中的随机函数
- VC中的随机函数
- Python中的随机函数
- cocos2dx中的随机函数
- C++中的随机函数
- C++中的随机函数
- c++中的随机函数
- C++中的随机函数
- C++中的随机函数
- matlab中的随机函数
- Matlab中的随机函数
- python中的随机函数
- 如何用TensorFlow图像处理函数裁剪图像?
- Volatile关键字解读(三)
- 有关性能的摘抄总结
- 基于原生HTML的UI组件开发
- 顺势而为,HTML发展与UI组件设计进化
- UDT源码剖析(一):UDT自带例程sendfile注释
- tensorflow中的随机裁剪函数random_crop
- hdu—1005
- 值得推荐的C/C++框架和库 (真的很强大)
- dubbo入门(一):ubuntu14.04 jdk8下 dubbo-admin编译安装
- IntelliJ IDEA使用教程十一 Lombok插件 安装及使用
- NAT&代理服务器技术调研
- (莫队算法)2038: 小Z的袜子(hose)
- 快速熟练使用numpy(学习笔记)
- Ubuntu14.04下安装Google浏览器