# Path: settings.py
# FLAGS = flags.FLAGS
# 
# Path: utils/io_handler.py
# def generate_batch_from_dir(path, suffix="*.png"):
#   '''
#   :param path: directory path to images
#   :param suffix: regex that specifies the file suffix (e.g. "*.png" or "*.jpg")
#   :return: numpy array with shape (1, encoder_length, height, width, num_channels)
#   '''
#   assert os.path.isdir(path), str(path) + "doesn't seem to be a valid path"
# 
#   files = file_paths_from_directory(path, suffix)
#   assert files and len(files)>0, 'Could not find an image with suffix %s in %s'%(path, suffix)
#   batch = np.zeros((1, FLAGS.encoder_length, FLAGS.height, FLAGS.width, 3), dtype=np.uint8)
# 
#   for i, filename in enumerate(files[:FLAGS.encoder_length]):
#     im = Image.open(filename).convert('RGB')
#     if im.size != (FLAGS.height, FLAGS.width):
#       im = im.resize((FLAGS.height, FLAGS.width), Image.ANTIALIAS)
#       print("image " + str(filename) + " has a different shape than expected -> reshape to (%i,%i)"%(FLAGS.height, FLAGS.width))
#     batch[0, i, :, :, :3] = np.asarray(im, np.uint8)
# 
# 
#   # add dense optical flow channel to batch
#   if FLAGS.num_channels == 4:
#     batch = compute_dense_optical_flow_for_batch(batch)
# 
#   return batch


import tensorflow as tf
import numpy as np
from settings import FLAGS
from utils.io_handler import generate_batch_from_dir



def create_batch_and_feed(initializer, feeding_model):
  # TODO
  """

  :param initializer:
  :param feed_model:
  :return:
  """
  assert FLAGS.pretrained_model

# Path: settings.py
# FLAGS = flags.FLAGS
# 
# Path: utils/io_handler.py
# def generate_batch_from_dir(path, suffix="*.png"):
#   '''
#   :param path: directory path to images
#   :param suffix: regex that specifies the file suffix (e.g. "*.png" or "*.jpg")
#   :return: numpy array with shape (1, encoder_length, height, width, num_channels)
#   '''
#   assert os.path.isdir(path), str(path) + "doesn't seem to be a valid path"
# 
#   files = file_paths_from_directory(path, suffix)
#   assert files and len(files)>0, 'Could not find an image with suffix %s in %s'%(path, suffix)
#   batch = np.zeros((1, FLAGS.encoder_length, FLAGS.height, FLAGS.width, 3), dtype=np.uint8)
# 
#   for i, filename in enumerate(files[:FLAGS.encoder_length]):
#     im = Image.open(filename).convert('RGB')
#     if im.size != (FLAGS.height, FLAGS.width):
#       im = im.resize((FLAGS.height, FLAGS.width), Image.ANTIALIAS)
#       print("image " + str(filename) + " has a different shape than expected -> reshape to (%i,%i)"%(FLAGS.height, FLAGS.width))
#     batch[0, i, :, :, :3] = np.asarray(im, np.uint8)
# 
# 
#   # add dense optical flow channel to batch
#   if FLAGS.num_channels == 4:
#     batch = compute_dense_optical_flow_for_batch(batch)
# 
#   return batch


# Path: core/production_op.py
import tensorflow as tf
import numpy as np
from settings import FLAGS
from utils.io_handler import generate_batch_from_dir




def create_batch_and_feed(initializer, feeding_model):
  # TODO
  """

  :param initializer:
  :param feed_model:
  :return:
  """
  assert FLAGS.pretrained_model

  feed_batch = generate_batch_from_dir(FLAGS.feeding_input_dir, suffix='*.jpg')