def load_images_from_files(self, filenames, max_imgs=500, do_shuffle=True, run_parallel=True, shape=(299, 299), num_workers=100):
    'Return image arrays from filenames.\n\n    Args:\n      filenames: locations of image files.\n      max_imgs: maximum number of images from filenames.\n      do_shuffle: before getting max_imgs files, shuffle the names or not\n      run_parallel: get images in parallel or not\n      shape: desired shape of the image\n      num_workers: number of workers in parallelization.\n\n    Returns:\n      image arrays\n\n    '
    imgs = []
    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])
        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) <= 1):
                raise ValueError('You must have more than 1 image in each class to run TCAV.')
            elif (len(imgs) >= max_imgs):
                break
    return np.array(imgs)
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
def load_images_from_files(self, filenames, max_imgs=500, do_shuffle=True, run_parallel=True, shape=(299, 299), num_workers=100):
    'Return image arrays from filenames.\n\n    Args:\n      filenames: locations of image files.\n      max_imgs: maximum number of images from filenames.\n      do_shuffle: before getting max_imgs files, shuffle the names or not\n      run_parallel: get images in parallel or not\n      shape: desired shape of the image\n      num_workers: number of workers in parallelization.\n\n    Returns:\n      image arrays\n\n    '
    imgs = []
    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])
        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) <= 1):
                raise ValueError('You must have more than 1 image in each class to run TCAV.')
            elif (len(imgs) >= max_imgs):
                break
    return np.array(imgs)