def postprocess(results, filenames, batch_size):
  """
  Post-process results to show classifications.
  """
  if len(results) != 1:
    raise Exception("expected 1 result, got {}".format(len(results)))

  batched_result = results[0].batch_classes
  if len(batched_result) != batch_size:
    raise Exception("expected {} results, got {}".format(batch_size, len(batched_result)))
  if len(filenames) != batch_size:
    raise Exception("expected {} filenames, got {}".format(batch_size, len(filenames)))

  label, score = [], []
  # batch size is always 1 here, need to modify if were to larger batch_size
  for (index, result) in enumerate(batched_result):
    print("Image '{}':".format(filenames[index]))
    for cls in result.cls:
      label.append(cls.label)
      score += [{"index": cls.label, "val": cls.value}]
      print("    {} ({}) = {}".format(cls.idx, cls.label, cls.value))
  return label[0], score