# Path: selfsup/multi/loaders/loader.py
# class Loader:
#     def __init__(self, batch_size=16, num_threads=5):
#         self._batch_size = batch_size
#         self._num_threads = num_threads
# 
#     def batch(self):
#         raise NotImplemented('Cannot use base class')
# 
#     def start(self, sess):
#         pass


from .loader import Loader
import tensorflow as tf
import threading
import numpy as np
import time
import glob
import os
import imageio
import cv2
import deepdish as dd
        self._batch_size = batch_size
        self._input_size = input_size
        self._num_threads = num_threads
        self._coord = tf.train.Coordinator()
        self._base_shape = [batch_size, input_size, input_size]
        self._image_shape = self._base_shape + [3]
        self._label_shape = self._base_shape + [1]
        p_x = tf.placeholder(tf.float32, self._image_shape, name='x')
        p_y = tf.placeholder(tf.float32, self._label_shape, name='y')
        inputs = [p_x, p_y]
        self._queue = tf.FIFOQueue(400,
                [i.dtype for i in inputs], [i.get_shape() for i in inputs])
        self._inputs = inputs
        self._enqueue_op = self._queue.enqueue(inputs)
        self._queue_close_op = self._queue.close(cancel_pending_enqueues=True)
        self._threads = []

    def __feed(self, rank):
        time.sleep(np.random.uniform(0, 3))
        batch_x = np.zeros(self._image_shape, dtype=np.float32)
        batch_y = np.zeros(self._label_shape, dtype=np.float32)
        pool = []
        N = len(self._list_files)
        input_size = self._input_size
        while True:
            while len(pool) < self._batch_size * 30:
                i = np.random.randint(N)

                fn = os.path.join(self._root_path, self._list_files[i])
                #print(fn)

# Path: selfsup/multi/loaders/loader.py
# class Loader:
#     def __init__(self, batch_size=16, num_threads=5):
#         self._batch_size = batch_size
#         self._num_threads = num_threads
# 
#     def batch(self):
#         raise NotImplemented('Cannot use base class')
# 
#     def start(self, sess):
#         pass


# Path: selfsup/multi/loaders/video_jpeg_rolls_flow_saliency.py
from .loader import Loader
import tensorflow as tf
import threading
import numpy as np
import time
import glob
import os
import imageio
import cv2
import deepdish as dd

        self._batch_size = batch_size
        self._input_size = input_size
        self._num_threads = num_threads
        self._coord = tf.train.Coordinator()
        self._base_shape = [batch_size, input_size, input_size]
        self._image_shape = self._base_shape + [3]
        self._label_shape = self._base_shape + [1]
        p_x = tf.placeholder(tf.float32, self._image_shape, name='x')
        p_y = tf.placeholder(tf.float32, self._label_shape, name='y')
        inputs = [p_x, p_y]
        self._queue = tf.FIFOQueue(400,
                [i.dtype for i in inputs], [i.get_shape() for i in inputs])
        self._inputs = inputs
        self._enqueue_op = self._queue.enqueue(inputs)
        self._queue_close_op = self._queue.close(cancel_pending_enqueues=True)
        self._threads = []

    def __feed(self, rank):
        time.sleep(np.random.uniform(0, 3))
        batch_x = np.zeros(self._image_shape, dtype=np.float32)
        batch_y = np.zeros(self._label_shape, dtype=np.float32)
        pool = []
        N = len(self._list_files)
        input_size = self._input_size
        while True:
            while len(pool) < self._batch_size * 30:
                i = np.random.randint(N)

                fn = os.path.join(self._root_path, self._list_files[i])
                #print(fn)

                outputs = extract_optical_flow(fn, n_frames=FRAMES)