codecamp

TensorFlow函数:tf.image.convert_image_dtype

tf.image.convert_image_dtype函数

tf.image.convert_image_dtype(
    image,
    dtype,
    saturate=False,
    name=None
)

定义在:tensorflow/python/ops/image_ops_impl.py.

请参阅指南:图像操作>颜色空间之间转换

将image转换为dtype,根据需要缩放其值.

使用浮点值表示的图像的值预期在[0,1)范围内.存储在整数数据类型中的图像数据预计在范围[0,MAX]内的具有值,其中MAX数据类型是最大的可表示正数.

这个操作可以在数据类型之间转换,在转换之前适当地缩放值.

请注意,从浮点输入转换为整数类型可能会导致上溢/下溢问题.设置饱和度为True,以避免有问题的转换中出现此类问题.如果启用,饱和将在执行潜在的危险转换之前将输出剪切到允许的范围内(并且仅在执行此类转换之前,即从浮点转换为整数类型时,以及从符号类型转换为无符号类型;saturate对浮动之间的强制转换和增加类型范围的强制转换没有影响).

参数:

  • image:一个图像.
  • dtype:要将image转为DType.
  • saturate:如果为True,则在强制转换前裁剪输入(如有必要).
  • name:此操作的名称(可选).

返回值:

返回要转换为dtype的image.

TensorFlow函数:tf.image.central_crop
TensorFlow函数:tf.image.crop_and_resize
温馨提示
下载编程狮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; }