SRCNN-TensorFlow复现

code:https://github.com/tegg89/SRCNN-Tensorflow

model.py
1、相关函数整理
tf.random_normal() 参考
(https://blog.csdn.net/dcrmg/article/details/79028043)
tf.random_normal() 从正太分布的数值中输出随机值。

tf.random_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32, seed=None, name=None)

  • shape: 输出张量的形状,必选
  • mean: 正态分布的均值,默认为0
  • stddev: 正态分布的标准差,默认为1.0
  • dtype: 输出的类型,默认为tf.float32
  • seed: 随机数种子,是一个整数,当设置之后,每次生成的随机数都一样

2、model解读
定义SRCNN类
(1)def __init()
(2)bulid_model(self)
weight ,biases,pred,loss
(3)train()
调用input_setup

utils.py
1、prepare_data(sess,dataset)
作用:返回data是训练集或测试集bmp格式的图像
(1)参数说明:dataset是train dataset 或 test dataset

(2)glob.glob得到所有的训练集或是测试集图像

2、input_setup(sess,config)
功能:读取train set or test set ;做sub-images;保存成h5文件

3、read_data(path)
读取.h5文件的data和label数据,转化np.array格式

4、preprocess(path,scale=3)
(1)读取灰度图像;
(2)modcrop;
(3)归一化;
(4)两次bicubic interpolation

返回input_ ,label_

make_data(sess,data,label)**
作用:将data(checkpoint下的train.h5 或test.h5)利用h5的create_dataset 写入

  • 为什么?

  • 如何生成train.h5 或test.h5文件的?

5、imread(path,is_grayscale=True)
目的:读取指定路径的图像

6、modcrop(image,scale)
7、

8、imsave(image,path)
9、merge(image,size)

你可能感兴趣的:(论文解读)