T 6

作者: sumpig | 来源:发表于2019-01-31 16:28 被阅读0次

class tf.gfile.GFile

  • __init__
__init__(
    name,
    mode='r'
)
  • close

  • read

  • write

  • readline

  • readlines

  • 示例

with tf.gfile.GFile("/path/output", "wb") as f:
    f.write(image)

tf.image.decode_jpeg

  • 用法
tf.image.decode_jpeg(
    contents,
    channels=0,
    ratio=1,
    fancy_upscaling=True,
    try_recover_truncated=False,
    acceptable_fraction=1,
    dct_method='',
    name=None
)
  • 示例
image_data = tf.image.decode_jpeg(image_raw_data)
  • tf.image.encode_jpeg
tf.image.encode_jpeg(
    image,
    format='',
    quality=95,
    progressive=False,
    optimize_size=False,
    chroma_downsampling=True,
    density_unit='in',
    x_density=300,
    y_density=300,
    xmp_metadata='',
    name=None
)

tf.image.resize_images

  • 用法
tf.image.resize_images(
    images,
    size,
    method=ResizeMethod.BILINEAR,
    align_corners=False,
    preserve_aspect_ratio=False
)

images: 4-D[batch, height, width, channels] 或 3-D[height, width, channels];
size: 图像的新大小;
method
ResizeMethod.BILINEAR:双线性插值。
ResizeMethod.NEAREST_NEIGHBOR:最近邻插值。
ResizeMethod.BICUBIC:双立方插值。
ResizeMethod.AREA:区域插值。

  • 示例
resized = tf.image.resize_images(img_data, [300, 300], method=0)

tf.image.resize_image_with_crop_or_pad

  • 用法
tf.image.resize_image_with_crop_or_pad(
    image,
    target_height,
    target_width
)
  • 示例
croped_or_padded = tf.image.resize_image_with_crop_or_pad(
    img_data, 1000, 1000)

tf.image.central_crop

  • 用法
tf.image.central_crop(
    image,
    central_fraction
)

central_fraction:裁剪比例;

  • 示例
central_cropped = tf.image.central_crop(img_data, 0.5)
  • tf.image.crop_to_bounding_box

  • tf.image.pad_to_bounding_box


相关文章

网友评论

      本文标题:T 6

      本文链接:https://www.haomeiwen.com/subject/qqxlsqtx.html