class_docstr: Class which performs validation of the submission.
class_docstr_tok: ["Class","which","performs","validation","of","the","submission","."]
docstr: Verifies correctness of the submission output.
  
  Args:
    submission_type: type of the submission
  
  Returns:
    True if output looks valid
docstr_tok: ["Verifies","correctness","of","the","submission","output",".","Args",":","submission_type",":","type","of","the","submission","Returns",":","True","if","output","looks","valid"]
code: def _verify_output(self, submission_type):
      """Verifies correctness of the submission output.
  
      Args:
        submission_type: type of the submission
  
      Returns:
        True if output looks valid
      """
      result = True
      if submission_type == "defense":
          try:
              image_classification = load_defense_output(
                  os.path.join(self._sample_output_dir, "result.csv")
              )
              expected_keys = [
                  IMAGE_NAME_PATTERN.format(i)
                  for i in range(BATCH_SIZE)
              ]
              if set(image_classification.keys()) != set(expected_keys):
                  logging.error(
                      "Classification results are not saved for all images"
                  )
                  result = False
          except IOError as e:
              logging.error("Failed to read defense output file: %s", e)
              result = False
      else:
          for i in range(BATCH_SIZE):
              image_filename = os.path.join(
                  self._sample_output_dir, IMAGE_NAME_PATTERN.format(i)
              )
              try:
                  img = np.array(
                      Image.open(image_filename).convert("RGB")
                  )
                  if list(img.shape) != [299, 299, 3]:
                      logging.error(
                          "Invalid image size %s for image %s",
                          str(img.shape),
                          image_filename,
                      )
                      result = False
              except IOError as e:
                  result = False
      return result
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from builtins import int
  import csv
  import json
  import logging
  import os
  import re
  import subprocess
  import sys
  import numpy
  from PIL import Image
  from six import iteritems
label_desc: Use image node_id 9 for calling the SubmissionValidator obj's underlying member method code with example usage: obj._verify_output(submission_type) and returns: result