tensorflow Image解码函数
时间:2022-07-23
本文章向大家介绍tensorflow Image解码函数,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
tf.image.decode_png(contents, channels=None, name=None)
Decode a PNG-encoded image to a uint8 tensor. 将一个png编码的图像解码成一个uint8张量。The attr channels
indicates the desired number of color channels for the decoded image. 参数"channels"表示解码图像所需的颜色通道数量。
Accepted values are:
- 0: Use the number of channels in the PNG-encoded image. 使用png编码图像的通道数
- 1: output a grayscale image. 输出一个灰度图像
- 3: output an RGB image. 输出一个RGB值表示的图像
- 4: output an RGBA image. 输出一个RGBA值表示的图像 If needed, the PNG-encoded image is transformed to match the requested number of color channels. 如果需要,将转换为png编码的图像,以匹配所请求的颜色通道数量。
Args:
-
contents
: ATensor
of typestring
. 0-D. The PNG-encoded image. 0阶"string"类型的张量,使用png编码格式的图片 -
channels
: An optionalint
. Defaults to0
. Number of color channels for the decoded image. 可选int参数,默认是0,表示解码图像的颜色通道数。 -
name
: A name for the operation (optional).
Returns:
A Tensor
of type uint8
. 3-D with shape [height, width, channels]
. 一个uint8类型的张量。3维分别表示[高度,宽度,通道数]
tf.image.decode_jpeg(contents, channels=None, ratio=None, fancy_upscaling=None, try_recover_truncated=None, acceptable_fraction=None, name=None)
Decode a JPEG-encoded image to a uint8 tensor. 讲一个jepg编码的图片编码为int类型的张量 The attr channels
indicates the desired number of color channels for the decoded image. 属性"channels"表示解码图像所需的颜色通道数量。
Accepted values are:
- 0: Use the number of channels in the JPEG-encoded image.
- 1: output a grayscale image.
- 3: output an RGB image.
- 0: 使用jpeg编码映像中的通道数量。
- 1: 输出一个灰度图像。
- 3: 输出一个RGB图像 If needed, the JPEG-encoded image is transformed to match the requested number of color channels. 如果需要,则将jpeg编码的图像转换为匹配请求的数字的颜色通道。The attr
ratio
allows downscaling the image by an integer factor during decoding. Allowed values are: 1, 2, 4, and 8. This is much faster than downscaling the image later. 在解码过程中,属性'ratio'允许通过整数因子来缩小图像。允许的值是:1、2、4和8。这比稍后缩小图像的速度要快得多。
Args:
-
contents
: ATensor
of typestring
. 0-D. The JPEG-encoded image. 是一个0维度的string类型的使用JRPG编码的张量. -
channels
: An optionalint
. Defaults to0
. Number of color channels for the decoded image. 一个可选的int类型的参数,默认是0,表示解码图片的通道数. -
ratio
: An optionalint
. Defaults to1
. Downscaling ratio. 默认是1,可以通过调节来缩小图片. -
fancy_upscaling
: An optionalbool
. Defaults toTrue
. If true use a slower but nicer upscaling of the chroma planes (yuv420/422 only). 可选的布尔值. 默认是"True"如果选择true会使用一个慢但是更好的对于chroma层的加速 plane一般是以luma plane、chroma plane的形式出现,其实就是luma层和chroma层,就像RGB,要用三个plane来存。 -
try_recover_truncated
: An optionalbool
. Defaults toFalse
. If true try to recover an image from truncated input. 一个可选的布尔值,默认是假,如果选择"true"则会试图从截断的输入中恢复图像。 -
acceptable_fraction
: An optionalfloat
. Defaults to1
. The minimum required fraction of lines before a truncated input is accepted. 可选的"float"类型的变量,默认为“1”。在被截断的输入被接受之前,最少需要的行数。 -
name
: A name for the operation (optional).
Returns:
A Tensor
of type uint8
. 3-D with shape [height, width, channels]
. 一个uint8类型的张量。3维分别表示[高度,宽度,通道数]
- 云端架构师养成之三:微信也在用的消息队列服务
- 现在 tensorflow和mxnet 很火,是否还有必要学习 scikit-learn 等框架?
- ASP.NET MVC基于标注特性的Model验证:将ValidationAttribute应用到参数上
- 改进版CodeTimer及XCode性能测试
- 常见测试术语解析
- 秦俊:开放 DevOps 敏捷开发套件,助力开发者驰骋云端
- 开源组件NanUI一周年-使用HTML/CSS/JS来构建.Net Winform应用程序界面
- 邱寒:新零售笔记(四)基于区块链大数据的人工智能
- 腾讯云GAME-TECH沙龙干货回顾:网龙《英魂之刃口袋版》开发经验分享
- ASP.NET MVC基于标注特性的Model验证:一个Model,多种验证规则
- 【深度学习系列】用PaddlePaddle和Tensorflow实现经典CNN网络AlexNet
- 黄荣奎:如何快速、便捷开发小程序
- 熊普江: BGP网络架构助力开发者快速构建、优化业务
- 唐良:云端架构给电商行业带来创新力
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- Django中Aggregation聚合的基本使用方法
- ThinkPHP3.2.3框架实现执行原生SQL语句的方法示例
- PHP反射实际应用示例
- 解决Keras使用GPU资源耗尽的问题
- 如何表示python中的相对路径
- 基于Tensorflow读取MNIST数据集时网络超时的解决方式
- python中的错误如何查看
- python实现斗地主分牌洗牌
- Python Mock模块原理及使用方法详解
- python实现猜数游戏(保存游戏记录)
- PHP实现简单计算器小程序
- PHP单例模式模拟Java Bean实现方法示例
- php实现每日签到功能
- laravel5实现微信第三方登录功能
- Laravel框架定时任务2种实现方式示例