'Initializes instance of DatasetMetadata.'

def __init__(self, filename):

    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)):
                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')
