class_docstr: Activation generator for a basic image model
class_docstr_tok: ["Activation","generator","for","a","basic","image","model"]
docstr: Return image arrays from filenames.
  
  Args:
    filenames: locations of image files.
    max_imgs: maximum number of images from filenames.
    do_shuffle: before getting max_imgs files, shuffle the names or not
    run_parallel: get images in parallel or not
    shape: desired shape of the image
    num_workers: number of workers in parallelization.
  
  Returns:
    image arrays
docstr_tok: ["Return","image","arrays","from","filenames",".","Args",":","filenames",":","locations","of","image","files",".","max_imgs",":","maximum","number","of","images","from","filenames",".","do_shuffle",":","before","getting","max_imgs","files",",","shuffle","the","names","or","not","run_parallel",":","get","images","in","parallel","or","not","shape",":","desired","shape","of","the","image","num_workers",":","number","of","workers","in","parallelization",".","Returns",":","image","arrays"]
code: def load_images_from_files(
      self,
      filenames,
      max_imgs=500,
      do_shuffle=True,
      run_parallel=True,
      shape=(299, 299),
      num_workers=50,
  ):
      """Return image arrays from filenames.
  
      Args:
        filenames: locations of image files.
        max_imgs: maximum number of images from filenames.
        do_shuffle: before getting max_imgs files, shuffle the names or not
        run_parallel: get images in parallel or not
        shape: desired shape of the image
        num_workers: number of workers in parallelization.
  
      Returns:
        image arrays
  
      """
      imgs = []
      # First shuffle a copy of the filenames.
      filenames = filenames[:]
      if do_shuffle:
          np.random.shuffle(filenames)
  
      if run_parallel:
          pool = multiprocessing.Pool(num_workers)
          imgs = pool.map(
              lambda filename: self.load_image_from_file(
                  filename, shape
              ),
              filenames[:max_imgs],
          )
          pool.close()
          imgs = [img for img in imgs if img is not None]
          if len(imgs) <= 1:
              raise ValueError(
                  "You must have more than 1 image in each class to run TCAV."
              )
      else:
          for filename in filenames:
              img = self.load_image_from_file(filename, shape)
              if img is not None:
                  imgs.append(img)
              if len(imgs) >= max_imgs:
                  break
          if len(imgs) <= 1:
              raise ValueError(
                  "You must have more than 1 image in each class to run TCAV."
              )
  
      return np.array(imgs)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from abc import ABCMeta
  from abc import abstractmethod
  from multiprocessing import dummy
  import os
  import os.path
  import numpy
  import PIL.Image
  import six
  import tensorflow
label_desc: Use image node_id 4 for calling the ImageActivationGenerator obj's underlying member method code with example usage: obj.load_images_from_files(filenames, max_imgs, do_shuffle, run_parallel, shape, num_workers) and returns: np