tensorflow::ops::DecodeImage

#include <image_ops.h>

Function for decode_bmp, decode_gif, decode_jpeg, and decode_png.

Summary

Detects whether an image is a BMP, GIF, JPEG, or PNG, and performs the appropriate operation to convert the input bytes string into a Tensor of type dtype.

NOTE: decode_gif returns a 4-D array [num_frames, height, width, 3], as opposed to decode_bmp, decode_jpeg and decode_png, which return 3-D arrays [height, width, num_channels]. Make sure to take this into account when constructing your graph if you are intermixing GIF files with BMP, JPEG, and/or PNG files. Alternately, set the expand_animations argument of this function to False, in which case the op will return 3-dimensional tensors and will truncate animated GIF files to the first frame.

NOTE: If the first frame of an animated GIF does not occupy the entire canvas (maximum frame width x maximum frame height), then it fills the unoccupied areas (in the first frame) with zeros (black). For frames after the first frame that does not occupy the entire canvas, it uses the previous frame to fill the unoccupied areas.

Arguments:

  • scope: A Scope object
  • contents: 0-D. The encoded image bytes.

Optional attributes (see Attrs):

  • channels: Number of color channels for the decoded image.
  • dtype: The desired DType of the returned Tensor.
  • expand_animations: Controls the output shape of the returned op. If True, the returned op will produce a 3-D tensor for PNG, JPEG, and BMP files; and a 4-D tensor for all GIFs, whether animated or not. If, False, the returned op will produce a 3-D tensor for all file types and will truncate animated GIFs to the first frame.

Returns:

  • Output: 3-D with shape [height, width, channels] or 4-D with shape [frame, height, width, channels]..

Constructors and Destructors

DecodeImage(const ::tensorflow::Scope & scope, ::tensorflow::Input contents)
DecodeImage(const ::tensorflow::Scope & scope, ::tensorflow::Input contents, const DecodeImage::Attrs & attrs)

Public attributes

image
operation

Public functions

node() const
::tensorflow::Node *
operator::tensorflow::Input() const
operator::tensorflow::Output() const

Public static functions

Channels(int64 x)
Dtype(DataType x)
ExpandAnimations(bool x)

Structs

tensorflow::ops::DecodeImage::Attrs

Optional attribute setters for DecodeImage.

Public attributes

image

::tensorflow::Output image

operation

Operation operation

Public functions

DecodeImage

 DecodeImage(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input contents
)

DecodeImage

 DecodeImage(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input contents,
  const DecodeImage::Attrs & attrs
)

node

::tensorflow::Node * node() const 

operator::tensorflow::Input

 operator::tensorflow::Input() const 

operator::tensorflow::Output

 operator::tensorflow::Output() const 

Public static functions

Channels

Attrs Channels(
  int64 x
)

Dtype

Attrs Dtype(
  DataType x
)

ExpandAnimations

Attrs ExpandAnimations(
  bool x
)