code: def load_images(input_dir, metadata_file_path, batch_shape):
      """Retrieve numpy arrays of images and labels, read from a directory."""
      num_images = batch_shape[0]
      with open(metadata_file_path) as input_file:
          reader = csv.reader(input_file)
          header_row = next(reader)
          rows = list(reader)
  
      row_idx_image_id = header_row.index("ImageId")
      row_idx_true_label = header_row.index("TrueLabel")
      images = np.zeros(batch_shape)
      labels = np.zeros(num_images, dtype=np.int32)
      for idx in xrange(num_images):
          row = rows[idx]
          filepath = os.path.join(
              input_dir, row[row_idx_image_id] + ".png"
          )
  
          with tf.gfile.Open(filepath, "rb") as f:
              image = (
                  np.array(Image.open(f).convert("RGB")).astype(
                      np.float
                  )
                  / 255.0
              )
          images[idx, :, :, :] = image
          labels[idx] = int(row[row_idx_true_label])
      return images, labels
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import csv
  import os
  import unittest
  import numpy
  from six.moves import xrange
  import tensorflow
  from tensorflow.contrib import slim
  from tensorflow.contrib.slim.nets import inception
  from PIL import Image
  from cleverhans.attacks import SPSA
  from cleverhans.devtools.checks import CleverHansTest
  from cleverhans.model import Model
  from cleverhans.utils import CLEVERHANS_ROOT
label_desc: Use image node_id 1 for calling a global function with example usage: load_images(input_dir, metadata_file_path, batch_shape) and returns: images,  labels