codecamp

TensorFlow函数教程:tf.io.decode_jpeg

tf.io.decode_jpeg函数

别名:

  • tf.image.decode_jpeg
  • tf.io.decode_jpeg
tf.io.decode_jpeg(
    contents,
    channels=0,
    ratio=1,
    fancy_upscaling=True,
    try_recover_truncated=False,
    acceptable_fraction=1,
    dct_method='',
    name=None
)

将JPEG编码的图像解码为uint8张量。

参数channels表示解码图像的所需数量的颜色通道。

可接受的值是:

  • 0:使用JPEG编码图像中的通道数。
  • 1:输出灰度图像。
  • 3:输出RGB图像。

如果需要,转换JPEG编码的图像以匹配所请求的颜色通道数。

参数ratio允许在解码期间通过整数因子缩小图像。允许的值为:1,2,4和8。这比稍后缩小图像要快得多。

此操作还支持解码PNG和非动画GIF,因为界面相同,但使用tf.image.decode_image更简洁。

参数:

  • contents:string类型的0-d Tensor。JPEG编码的图像。
  • channels:可选的int。默认为0。解码图像的颜色通道数。
  • ratio:可选的int。默认为1。缩小比例。。
  • fancy_upscaling:可选的bool。默认为True。如果为true,则使用较慢但更好的色度平面升级(仅限yuv420 / 422)。
  • try_recover_truncated:可选的bool。默认为False。如果为true,则尝试从截断的输入中恢复图像。
  • acceptable_fraction:可选的float。默认为1。接受截断输入之前所需的最小行数。
  • dct_method:可选的string。字符串指定有关用于解压缩的算法的提示。当前有效值为["INTEGER_FAST", "INTEGER_ACCURATE"]。可以忽略提示(例如,内部jpeg库更改为没有该特定选项的版本。)
  • name:操作的名称(可选)。

返回:

uint8类型的Tensor。

TensorFlow函数教程:tf.io.decode_image
TensorFlow函数教程:tf.io.decode_json_example
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

TensorFlow 函数介绍

TensorFlow 函数模块:tf

TensorFlow的image模块

TensorFlow使用之tf.io

TensorFlow使用之tf.keras

TensorFlow函数教程:tf.keras.applications

TensorFlow函数教程:tf.keras.backend

TensorFlow使用之tf.metrics

TensorFlow使用之tf.nn

TensorFlow使用之tf.python_io

TensorFlow 功能函数

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }