• tensorflow Image 解码函数


    tensorflow Image解码函数

    觉得有用的话,欢迎一起讨论相互学习~

    我的微博我的github我的B站

    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: A Tensor of type string. 0-D. The PNG-encoded image.
      0阶"string"类型的张量,使用png编码格式的图片
    • channels: An optional int. Defaults to 0.
      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: A Tensor of type string. 0-D. The JPEG-encoded image.
      是一个0维度的string类型的使用JRPG编码的张量.

    • channels: An optional int. Defaults to 0.
      Number of color channels for the decoded image.
      一个可选的int类型的参数,默认是0,表示解码图片的通道数.

    • ratio: An optional int. Defaults to 1. Downscaling ratio.
      默认是1,可以通过调节来缩小图片.

    • fancy_upscaling: An optional bool. Defaults to True.
      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 optional bool. Defaults to False.
      If true try to recover an image from truncated input.
      一个可选的布尔值,默认是假,如果选择"true"则会试图从截断的输入中恢复图像。

    • acceptable_fraction: An optional float. Defaults to 1.
      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维分别表示[高度,宽度,通道数]

  • 相关阅读:
    批量插入测试脚本
    Show Profile分析sql语句的资源消耗
    慢查询日志
    ORDER BY优化
    Join查询
    Explain(执行计划)分析
    索引
    MySQL中的DML(数据操作语言)和DQL(数据查询语言)
    MySQL中的DDL(数据定义语言)和DCL(数据控制语言)
    MySQL架构体系介绍
  • 原文地址:https://www.cnblogs.com/cloud-ken/p/7493604.html
Copyright © 2020-2023  润新知