code: def image_to_summary(image_pil, tag):
      summary = tf.Summary(
          value=[
              tf.Summary.Value(
                  tag=tag,
                  image=tf.Summary.Image(
                      encoded_image_string=imagepil_to_str(image_pil)
                  ),
              )
          ]
      )
      return summary
  
imports: import io
  import numpy
  import os
  import logging
  import PIL.Image
  import PIL.ImageDraw
  import PIL.ImageFont
  import tensorflow
  from .bbox_overlap import bbox_overlap
  from .bbox_transform import decode
  from base64 import b64encode
  from sys import stdout
label_desc: Use image node_id 3 for calling a global function with example usage: image_to_summary(image_pil, tag) and returns: summary