image_reader.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:tf_base 作者: ozansener 项目源码 文件源码
def setup_reader(self, image_paths, image_shape, num_concurrent, batch_size):
    # Path queue is list of image paths which will further be processed by another queue
    num_images = len(image_paths)
    indices = tf.range(0, num_images, 1)

    self.path_queue = tf.FIFOQueue(capacity=num_images, dtypes=[tf.int32, tf.string], name='path_queue')
    self.enqueue_path = self.path_queue.enqueue_many([indices, image_paths])
    self.close_path = self.path_queue.close()

    processed_queue = tf.FIFOQueue(capacity=num_images,
                       dtypes=[tf.int32, tf.float32],
                       shapes=[(), image_shape],
                       name='processed_queue')

    (idx, processed_image) = self.process()
    enqueue_process = processed_queue.enqueue([idx, processed_image])
    self.dequeue_batch = processed_queue.dequeue_many(batch_size)

    self.queue_runner = tf.train.QueueRunner(processed_queue, [enqueue_process] * num_concurrent)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号