class_docstr: Helper class which loads and stores dataset metadata.
docstr: Initializes instance of DatasetMetadata.
docstr_tok: ["Initializes","instance","of","DatasetMetadata","."]
code: def __init__(self, filename):
      """Initializes instance of DatasetMetadata."""
      self._true_labels = {}
      self._target_classes = {}
      with open(filename) as f:
          reader = csv.reader(f)
          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 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")
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import csv
  import json
  import os
  import subprocess
  import numpy
  from PIL import Image
label_desc: Use image node_id 1 to create a new DatasetMetadata object from inherited base classes: object with example: obj = DatasetMetadata(filename)