pretrain.py 文件源码

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

项目:SRGAN-tensorflow 作者: zoharli 项目源码 文件源码
def read(filenames):
    file_names=open(filenames,'rb').read().split('\n')
    random.shuffle(file_names)
    filename_queue=tf.train.string_input_producer(file_names,capacity=3000,num_epochs=100)#shuffled input_producer by default
    reader=tf.WholeFileReader()
    _,value=reader.read(filename_queue)
    image=tf.image.decode_jpeg(value)
    cropped=tf.random_crop(image,[resolution*4,resolution*4,3])
    random_flipped=tf.image.random_flip_left_right(cropped)
    minibatch=tf.cast(tf.train.batch([random_flipped],batch_size,capacity=300),tf.float32)
    rescaled=tf.image.resize_bicubic(minibatch,[resolution,resolution])
    rescaled=rescaled*2/255-1
    return minibatch,rescaled
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号