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: Saves file with target class for given dataset batch.
  
  Args:
    filename: output filename
    image_batches: instance of ImageBatchesBase with dataset batches
    batch_id: dataset batch ID
docstr_tok: ["Saves","file","with","target","class","for","given","dataset","batch",".","Args",":","filename",":","output","filename","image_batches",":","instance","of","ImageBatchesBase","with","dataset","batches","batch_id",":","dataset","batch","ID"]
code: def save_target_classes_for_batch(
      self, filename, image_batches, batch_id
  ):
      """Saves file with target class for given dataset batch.
  
      Args:
        filename: output filename
        image_batches: instance of ImageBatchesBase with dataset batches
        batch_id: dataset batch ID
      """
      images = image_batches.data[batch_id]["images"]
      with open(filename, "w") as f:
          for image_id, image_val in iteritems(images):
              target_class = self.get_target_class(
                  image_val["dataset_image_id"]
              )
              f.write("{0}.png,{1}\n".format(image_id, target_class))
  
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 4 for calling the DatasetMetadata obj's underlying member method code with example usage: obj.save_target_classes_for_batch(filename, image_batches, batch_id) without return types