code: def _get_final_image(
      self, config, trainable=None, arrays=None, frame=None
  ):
      if config["values"] == "frames":
          # print('===frames===')
          final_image = frame
      elif config["values"] == "arrays":
          # print('===arrays===')
          final_image = np.concatenate([arr for arr, _ in arrays])
          stat = self.stats(arrays)
          write_pickle(
              stat,
              "{}/{}".format(self.PLUGIN_LOGDIR, SECTION_INFO_FILENAME),
          )
      elif config["values"] == "trainable_variables":
          # print('===trainable===')
          final_image = np.concatenate([arr for arr, _ in trainable])
          stat = self.stats(trainable)
          write_pickle(
              stat,
              "{}/{}".format(self.PLUGIN_LOGDIR, SECTION_INFO_FILENAME),
          )
      if (
          len(final_image.shape) == 2
      ):  # Map grayscale images to 3D tensors.
          final_image = np.expand_dims(final_image, -1)
  
      return final_image
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from ..proto.summary_pb2 import Summary
  from ..proto.summary_pb2 import SummaryMetadata
  from ..proto.tensor_pb2 import TensorProto
  from ..proto.tensor_shape_pb2 import TensorShapeProto
  import os
  import time
  import numpy
  from .file_system_tools import read_pickle, write_pickle, write_file
  from .shared_config import PLUGIN_NAME, TAG_NAME, SUMMARY_FILENAME, DEFAULT_CONFIG, CONFIG_FILENAME, SUMMARY_COLLECTION_KEY_NAME, SECTION_INFO_FILENAME
  from .None import video_writing
label_desc: Use image node_id 5 for calling the Beholder obj's underlying member method code with example usage: obj._get_final_image(config, trainable, arrays, frame) and returns: final_image