code: def main(argv):
      if len(argv) > 2:
          raise app.UsageError("Too many command-line arguments.")
      folder = argv[1]
      matches = sorted(
          tf.io.gfile.glob(
              os.path.join(folder, "tb/events.out.tfevents.*")
          )
      )
      assert matches, "No events files found"
      tags = set()
      accuracies = []
      for event_file in matches:
          try:
              for e in tf.compat.v1.train.summary_iterator(event_file):
                  for v in e.summary.value:
                      if v.tag == TAG:
                          accuracies.append(v.simple_value)
                          break
                      elif not accuracies:
                          tags.add(v.tag)
          except tf.errors.DataLossError:
              continue
  
      assert accuracies, 'No "%s" tag found. Found tags = %s' % (
          TAG,
          tags,
      )
      target_dir = os.path.join(folder, "stats")
      target_file = os.path.join(target_dir, "accuracy.json")
      tf.io.gfile.makedirs(target_dir)
  
      with tf.io.gfile.GFile(target_file, "w") as f:
          json.dump(
              summary_dict(accuracies), f, sort_keys=True, indent=4
          )
      print("Saved: %s" % target_file)
  
imports: import json
  import os
  import numpy
  import tensorflow
  from absl import app, flags
label_desc: Use image node_id 2 for calling a global function with example usage: main(argv) without return types