(self, tag, image, step=None)
Saves RGB image summary from np.ndarray [H,W], [H,W,1], or [H,W,3].

    Args:
      tag: str: label for this data
      image: ndarray: [H,W], [H,W,1], [H,W,3] save image in greyscale or colors/
      step: int: training step
Saves RGB image summary from np.ndarray [H,W], [H,W,1], or [H,W,3].
Saves RGB image summary from np . ndarray [ H W ] [ H W 1 ] or [ H W 3 ] .
def image(self, tag, image, step=None):
    """Saves RGB image summary from np.ndarray [H,W], [H,W,1], or [H,W,3].

    Args:
      tag: str: label for this data
      image: ndarray: [H,W], [H,W,1], [H,W,3] save image in greyscale or colors/
      step: int: training step
    """
    image = np.array(image)
    if step is None:
      step = self._step
    else:
      self._step = step
    if len(np.shape(image)) == 2:
      image = image[:, :, np.newaxis]
    if np.shape(image)[-1] == 1:
      image = np.repeat(image, 3, axis=-1)
    image_strio = io.BytesIO()
    plt.imsave(image_strio, image, format='png')
    image_summary = tf.compat.v1.Summary.Image(
        encoded_image_string=image_strio.getvalue(),
        colorspace=3,
        height=image.shape[0],
        width=image.shape[1])
    summary = tf.compat.v1.Summary(
        value=[tf.compat.v1.Summary.Value(tag=tag, image=image_summary)])
    self.add_summary(summary, step)
def image ( self , tag , image , step = None ) : image = np . array ( image ) if step is None : step = self . _step else : self . _step = step if len ( np . shape ( image ) ) == 2 : image = image [ : , : , np . newaxis ] if np . shape ( image ) [ - 1 ] == 1 : image = np . repeat ( image , 3 , axis = - 1 ) image_strio = io . BytesIO ( ) plt . imsave ( image_strio , image , format = 'png' ) image_summary = tf . compat . v1 . Summary . Image ( encoded_image_string = image_strio . getvalue ( ) , colorspace = 3 , height = image . shape [ 0 ] , width = image . shape [ 1 ] ) summary = tf . compat . v1 . Summary ( value = [ tf . compat . v1 . Summary . Value ( tag = tag , image = image_summary ) ] ) self . add_summary ( summary , step )