data_sr.py 文件源码

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

项目:supic 作者: Hirico 项目源码 文件源码
def batch_queue_for_training_mkdir():
    num_channel = argument_sr.options.input_channel
    image_height = argument_sr.options.height
    image_width = argument_sr.options.width
    batch_size = argument_sr.options.batch_size
    threads_num = argument_sr.options.num_threads

    filename_queue = tf.train.string_input_producer(argument_sr.options.get_file_list())
    file_reader = tf.WholeFileReader()
    _, image_file = file_reader.read(filename_queue)
    patch = tf.image.decode_jpeg(image_file, 3)
    patch = tf.image.convert_image_dtype(patch, dtype=tf.float32)
    patch = RGB_to_Tcrbr_Y(patch)

    image_HR8 = tf.random_crop(patch, [image_height, image_width, num_channel])

    image_HR4 = tf.image.resize_images(image_HR8, [int(image_height / 2), int(image_width / 2)],
                                       method=tf.image.ResizeMethod.BICUBIC)
    image_HR2 = tf.image.resize_images(image_HR8, [int(image_height / 4), int(image_width / 4)],
                                       method=tf.image.ResizeMethod.BICUBIC)
    image_LR = tf.image.resize_images(image_HR8, [int(image_height / 8), int(image_width / 8)],
                                      method=tf.image.ResizeMethod.BICUBIC)

    low_res_batch, high2_res_batch, high4_res_batch, high8_res_batch = tf.train.batch(
        [image_LR, image_HR2, image_HR4, image_HR8],
        batch_size=batch_size,
        num_threads=threads_num,
        capacity=3 * batch_size)

    filename_queue.close()

    return low_res_batch, high2_res_batch, high4_res_batch, high8_res_batch
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号