def input_producer(self, batch_size=10):

    def read_data():
        img_a = tf.image.decode_image(tf.read_file(tf.string_join(['./training_set/', self.data_queue[0]])), channels=3)
        img_b = tf.image.decode_image(tf.read_file(tf.string_join(['./training_set/', self.data_queue[1]])), channels=3)
        (img_a, img_b) = preprocessing([img_a, img_b])
        return (img_a, img_b)

    def preprocessing(imgs):
        imgs = [(tf.cast(img, tf.float32) / 255.0) for img in imgs]
        if (self.args.model != 'color'):
            imgs = [tf.image.rgb_to_grayscale(img) for img in imgs]
        img_crop = tf.unstack(tf.random_crop(tf.stack(imgs, axis=0), [2, self.crop_size, self.crop_size, self.chns]), axis=0)
        return img_crop
    with tf.variable_scope('input'):
        List_all = tf.convert_to_tensor(self.data_list, dtype=tf.string)
        gt_list = List_all[:, 0]
        in_list = List_all[:, 1]
        self.data_queue = tf.train.slice_input_producer([in_list, gt_list], capacity=20)
        (image_in, image_gt) = read_data()
        (batch_in, batch_gt) = tf.train.batch([image_in, image_gt], batch_size=batch_size, num_threads=8, capacity=20)
    return (batch_in, batch_gt)
def input_producer(self, batch_size=10):

    def read_data():
        img_a = tf.image.decode_image(tf.read_file(tf.string_join(['./training_set/', self.data_queue[0]])), channels=3)
        img_b = tf.image.decode_image(tf.read_file(tf.string_join(['./training_set/', self.data_queue[1]])), channels=3)
        (img_a, img_b) = preprocessing([img_a, img_b])
        return (img_a, img_b)

    def preprocessing(imgs):
        imgs = [(tf.cast(img, tf.float32) / 255.0) for img in imgs]
        if (self.args.model != 'color'):
            imgs = [tf.image.rgb_to_grayscale(img) for img in imgs]
        img_crop = tf.unstack(tf.random_crop(tf.stack(imgs, axis=0), [2, self.crop_size, self.crop_size, self.chns]), axis=0)
        return img_crop
    with tf.variable_scope('input'):
        List_all = tf.convert_to_tensor(self.data_list, dtype=tf.string)
        gt_list = List_all[:, 0]
        in_list = List_all[:, 1]
        self.data_queue = tf.train.slice_input_producer([in_list, gt_list], capacity=20)
        (image_in, image_gt) = read_data()
        (batch_in, batch_gt) = tf.train.batch([image_in, image_gt], batch_size=batch_size, num_threads=8, capacity=20)
    return (batch_in, batch_gt)