Skip to contents

Creates a image summary

Usage

summary_image(img, ..., metadata = NULL, tag = NA)

# S3 method for ggplot
summary_image(img, ..., width = 480, height = 480, metadata = NULL, tag = NA)

# S3 method for array
summary_image(img, ..., metadata = NULL, tag = NA)

# S3 method for blob
summary_image(img, ..., width, height, colorspace, metadata = NULL, tag = NA)

# S3 method for raw
summary_image(img, ..., width, height, colorspace, metadata = NULL, tag = NA)

Arguments

img

An object that can be converted to an image.

...

Currently unused.

metadata

A metadata object, as created with summary_metadata(). In most cases you don't need to change the default.

tag

A tag that within the TensorBoard UI. See log_event() for other ways of specifying the tag attribute.

width

Width of the image.

height

Height of the image.

colorspace

Valid colorspace values are 1 - grayscale, 2 - grayscale + alpha, 3 - RGB, 4 - RGBA, 5 - DIGITAL_YUV, 6 - BGRA

Value

An image summary that can be logged with log_event().

Methods (by class)

  • summary_image(ggplot): Cretes an image summary from a ggplot2 graph object. The ... will be forwarded to grDevices::png().

  • summary_image(array): Creates an image from an R array. The array should be numeric, with values between 0 and 1. Dimensions should be (batch, height, width, channels).

  • summary_image(blob): Creates an image from blob::blob() vctr of PNG encoded images, (eg using png::writePNG()). width, height and colorspace are recycled thus they can be a single scalar or a vector the same size of the images blob.

  • summary_image(raw): Creates an image from a png encoded image. Eg, created with png::writePNG(). In this case you need to provide width, height and colorspace arguments.

See also

Examples

tmp <- tempfile()
with_logdir(tmp, {
  summary_image(array(runif(100), dim = c(1,10, 10, 1)))
})
#> <tfevents_summary_tensor[1]>
#> [1] <NA>