class_docstr: Helper class which loads and stores dataset metadata.
  
  Dataset metadata stored by this class contains true labels and target classes
  for all images in the dataset.
class_docstr_tok: ["Helper","class","which","loads","and","stores","dataset","metadata",".","Dataset","metadata","stored","by","this","class","contains","true","labels","and","target","classes","for","all","images","in","the","dataset","."]
docstr: Initializes instance of DatasetMetadata.
  
  Args:
    fobj: file object
docstr_tok: ["Initializes","instance","of","DatasetMetadata",".","Args",":","fobj",":","file","object"]
code: def __init__(self, fobj):
      """Initializes instance of DatasetMetadata.
  
      Args:
        fobj: file object
      """
      self._true_labels = {}
      self._target_classes = {}
      reader = csv.reader(fobj)
      header_row = next(reader)
      try:
          row_idx_image_id = header_row.index("ImageId")
          row_idx_true_label = header_row.index("TrueLabel")
          row_idx_target_class = header_row.index("TargetClass")
      except ValueError:
          raise IOError("Invalid format of the dataset metadata.")
      for row in reader:
          if len(row) < len(header_row):
              # skip partial or empty lines
              continue
          try:
              image_id = row[row_idx_image_id]
              self._true_labels[image_id] = int(row[row_idx_true_label])
              self._target_classes[image_id] = int(
                  row[row_idx_target_class]
              )
          except (IndexError, ValueError):
              raise IOError("Invalid format of dataset metadata")
  
file_path: cleverhans/cleverhans_v3.1.0/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/dataset_helper.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import csv
  import hashlib
  import logging
  import os
  import shutil
  import subprocess
  import numpy
  from PIL import Image
  from six import iteritems
label_desc: Use image node_id 1 to create a new DatasetMetadata object from inherited base classes: object with example: obj = DatasetMetadata(fobj)