Commit 17d17806 authored by yongshk's avatar yongshk
Browse files

Initial commit

parents
# Auto detect text files and perform LF normalization
* text=auto
\ No newline at end of file
samples/
log/
\ No newline at end of file
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
\ No newline at end of file
# Tensorflow implementation of the paper "Deep Laplacian Pyramid Networks for Fast and Accurate Super-Resolution" (CVPR 2017)
This is a Tensorflow implementation using TensorLayer.
Original paper and implementation using MatConNet can be found on their [project webpage](http://vllab1.ucmerced.edu/~wlai24/LapSRN/).
### Environment
The implementation is tested using python 3.6 and cuda 8.0.
### Download repository:
$ git clone https://github.com/zjuela/LapSRN-tensorflow.git
### Train model
Specify dataset path in config.py file and run:
$ python main.py
The pre-trained model is trained using [NTIRE 2017](http://www.vision.ee.ethz.ch/ntire17/) challenge dataset.
### Test
Run with your test image:
$ python main.py -m test -f TESTIMAGE
Results can be find in folder ./samples/
# 简介
LapSRN是一种用于超分辨率重建的神经网络模型,全称为Laplacian Pyramid Super-Resolution Network。它可以将低分辨率的图像增强到高分辨率,从而提高图像的质量和清晰度。LapSRN模型基于图像金字塔理论,采用多级金字塔结构,通过渐进性的上采样和细节增强,逐步提高图像分辨率。
LapSRN模型主要有两个部分,即拉普拉斯金字塔预测模型和残差学习模型。拉普拉斯金字塔预测模型通过建立图像金字塔结构,将低分辨率图像逐步上采样到目标分辨率,并通过像素差异来预测高分辨率图像。残差学习模型则用于学习并纠正拉普拉斯金字塔模型中的误差,从而进一步提高图像质量。
# 测试流程
## 安装工具包
tensorflow1.15版本[[tensorflow-1.15.1_dtk22.04.1-cp37-cp37m-manylinux2014_x86_64](https://cancon.hpccube.com:65024/file/4/tensorflow/dtk22.04.1/tensorflow-1.15.1_dtk22.04.1-cp37-cp37m-manylinux2014_x86_64.whl) ]
## 加载环境变量
```
export PATH={PYTHON3_install_dir}/bin:$PATH
export LD_LIBRARY_PATH={PYTHON3_install_dir}/lib:$LD_LIBRARY_PATH
```
## 下载数据集
数据集下载地址:DIV2K
https://data.vision.ee.ethz.ch/cvl/DIV2K/
## 修改配置文件
```python
config.valid.hr_folder_path = '/../LapSRN/data/DIV2K_valid_HR/'
config.valid.lr_folder_path = '/../LapSRN/data/DIV2K_train_LR_bicubic/X4/'
```
# 运行指令
## 训练模型
```
$ python main.py
```
## 测试
使用您的测试图像运行:
```
$ python main.py -m test -f TESTIMAGE
```
结果可以在文件夹 ./samples/ 中找到
# 参考
[https://github.com/zjuela/LapSRN-tensorflow](https://github.com/zjuela/LapSRN-tensorflow)
\ No newline at end of file
from easydict import EasyDict as edict
import json
config = edict()
config.model = edict()
config.model.result_path = "samples"
config.model.checkpoint_path = "checkpoint"
config.model.log_path = "log"
config.model.scale = 4
config.model.resblock_depth = 10
config.model.recursive_depth = 1
config.valid = edict()
config.valid.hr_folder_path = '/media/zhehu/DATA/Public_Dataset/NTIRE2017/DIV2K_valid_HR/'
config.valid.lr_folder_path = '/media/zhehu/DATA/Public_Dataset/NTIRE2017/DIV2K_valid_LR_bicubic/X4/'
config.train = edict()
config.train.hr_folder_path = '/media/zhehu/DATA/Public_Dataset/NTIRE2017/DIV2K_train_HR/'
config.train.lr_folder_path = '/media/zhehu/DATA/Public_Dataset/NTIRE2017/DIV2K_train_LR_bicubic/X4/'
config.train.batch_size = 4 # use large number if you have enough memory
config.train.in_patch_size = 64
config.train.out_patch_size = config.model.scale * config.train.in_patch_size
config.train.batch_size_each_folder = 30
config.train.log_write = False
config.train.lr_init = 5*1.e-6
config.train.lr_decay = 0.5
config.train.decay_iter = 10
config.train.beta1 = 0.90
config.train.n_epoch = 300
config.train.dump_intermediate_result = True
def log_config(filename, cfg):
with open(filename, 'w') as f:
f.write("================================================\n")
f.write(json.dumps(cfg, indent=4))
f.write("\n================================================\n")
#! /usr/bin/python
# -*- coding: utf8 -*-
import os, time, random
import numpy as np
import scipy
import tensorflow as tf
import tensorlayer as tl
from model import *
from utils import *
from config import *
###====================== HYPER-PARAMETERS ===========================###
batch_size = config.train.batch_size
patch_size = config.train.in_patch_size
ni = int(np.sqrt(config.train.batch_size))
def compute_charbonnier_loss(tensor1, tensor2, is_mean=True):
epsilon = 1e-6
if is_mean:
loss = tf.reduce_mean(tf.reduce_mean(tf.sqrt(tf.square(tf.subtract(tensor1,tensor2))+epsilon), [1, 2, 3]))
else:
loss = tf.reduce_mean(tf.reduce_sum(tf.sqrt(tf.square(tf.subtract(tensor1,tensor2))+epsilon), [1, 2, 3]))
return loss
def load_file_list():
train_hr_file_list = []
train_lr_file_list = []
valid_hr_file_list = []
valid_lr_file_list = []
directory = config.train.hr_folder_path
for filename in [y for y in os.listdir(directory) if os.path.isfile(os.path.join(directory,y))]:
train_hr_file_list.append("%s%s"%(directory,filename))
directory = config.train.lr_folder_path
for filename in [y for y in os.listdir(directory) if os.path.isfile(os.path.join(directory,y))]:
train_lr_file_list.append("%s%s"%(directory,filename))
directory = config.valid.hr_folder_path
for filename in [y for y in os.listdir(directory) if os.path.isfile(os.path.join(directory,y))]:
valid_hr_file_list.append("%s%s"%(directory,filename))
directory = config.valid.lr_folder_path
for filename in [y for y in os.listdir(directory) if os.path.isfile(os.path.join(directory,y))]:
valid_lr_file_list.append("%s%s"%(directory,filename))
return sorted(train_hr_file_list),sorted(train_lr_file_list),sorted(valid_hr_file_list),sorted(valid_lr_file_list)
def prepare_nn_data(hr_img_list, lr_img_list, idx_img=None):
i = np.random.randint(len(hr_img_list)) if (idx_img is None) else idx_img
input_image = get_imgs_fn(lr_img_list[i])
output_image = get_imgs_fn(hr_img_list[i])
scale = int(output_image.shape[0] / input_image.shape[0])
assert scale == config.model.scale
out_patch_size = patch_size * scale
input_batch = np.empty([batch_size,patch_size,patch_size,3])
output_batch = np.empty([batch_size,out_patch_size,out_patch_size,3])
for idx in range(batch_size):
in_row_ind = random.randint(0,input_image.shape[0]-patch_size)
in_col_ind = random.randint(0,input_image.shape[1]-patch_size)
input_cropped = augment_imgs_fn(input_image[in_row_ind:in_row_ind+patch_size,
in_col_ind:in_col_ind+patch_size])
input_cropped = normalize_imgs_fn(input_cropped)
input_cropped = np.expand_dims(input_cropped,axis=0)
input_batch[idx] = input_cropped
out_row_ind = in_row_ind * scale
out_col_ind = in_col_ind * scale
output_cropped = output_image[out_row_ind:out_row_ind+out_patch_size,
out_col_ind:out_col_ind+out_patch_size]
output_cropped = normalize_imgs_fn(output_cropped)
output_cropped = np.expand_dims(output_cropped,axis=0)
output_batch[idx] = output_cropped
return input_batch,output_batch
def train():
save_dir = "%s/%s_train"%(config.model.result_path,tl.global_flag['mode'])
checkpoint_dir = "%s"%(config.model.checkpoint_path)
tl.files.exists_or_mkdir(save_dir)
tl.files.exists_or_mkdir(checkpoint_dir)
###========================== DEFINE MODEL ============================###
t_image = tf.placeholder('float32', [batch_size, patch_size, patch_size, 3], name='t_image_input')
t_target_image = tf.placeholder('float32', [batch_size, patch_size*config.model.scale, patch_size*config.model.scale, 3], name='t_target_image')
t_target_image_down = tf.image.resize_images(t_target_image, size=[patch_size*2, patch_size*2], method=0, align_corners=False)
net_image2, net_grad2, net_image1, net_grad1 = LapSRN(t_image, is_train=True, reuse=False)
net_image2.print_params(False)
## test inference
net_image_test, net_grad_test, _, _ = LapSRN(t_image, is_train=False, reuse=True)
###========================== DEFINE TRAIN OPS ==========================###
loss2 = compute_charbonnier_loss(net_image2.outputs, t_target_image, is_mean=True)
loss1 = compute_charbonnier_loss(net_image1.outputs, t_target_image_down, is_mean=True)
g_loss = loss1 + loss2 * 4
g_vars = tl.layers.get_variables_with_name('LapSRN', True, True)
with tf.variable_scope('learning_rate'):
lr_v = tf.Variable(config.train.lr_init, trainable=False)
g_optim = tf.train.AdamOptimizer(lr_v, beta1=config.train.beta1).minimize(g_loss, var_list=g_vars)
###========================== RESTORE MODEL =============================###
sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True, log_device_placement=False))
tl.layers.initialize_global_variables(sess)
tl.files.load_and_assign_npz(sess=sess, name=checkpoint_dir+'/params_{}.npz'.format(tl.global_flag['mode']), network=net_image2)
###========================== PRE-LOAD DATA ===========================###
train_hr_list,train_lr_list,valid_hr_list,valid_lr_list = load_file_list()
###========================== INTERMEDIATE RESULT ===============================###
sample_ind = 37
sample_input_imgs,sample_output_imgs = prepare_nn_data(valid_hr_list,valid_lr_list,sample_ind)
tl.vis.save_images(truncate_imgs_fn(sample_input_imgs), [ni, ni], save_dir+'/train_sample_input.png')
tl.vis.save_images(truncate_imgs_fn(sample_output_imgs), [ni, ni], save_dir+'/train_sample_output.png')
###========================== TRAINING ====================###
sess.run(tf.assign(lr_v, config.train.lr_init))
print(" ** learning rate: %f" % config.train.lr_init)
for epoch in range(config.train.n_epoch):
## update learning rate
if epoch != 0 and (epoch % config.train.decay_iter == 0):
lr_decay = config.train.lr_decay ** (epoch // config.train.decay_iter)
lr = config.train.lr_init * lr_decay
sess.run(tf.assign(lr_v, lr))
print(" ** learning rate: %f" % (lr))
epoch_time = time.time()
total_g_loss, n_iter = 0, 0
## load image data
idx_list = np.random.permutation(len(train_hr_list))
for idx_file in range(len(idx_list)):
step_time = time.time()
batch_input_imgs,batch_output_imgs = prepare_nn_data(train_hr_list,train_lr_list,idx_file)
errM, _ = sess.run([g_loss, g_optim], {t_image: batch_input_imgs, t_target_image: batch_output_imgs})
total_g_loss += errM
n_iter += 1
print("[*] Epoch: [%2d/%2d] time: %4.4fs, loss: %.8f" % (epoch, config.train.n_epoch, time.time() - epoch_time, total_g_loss/n_iter))
## save model and evaluation on sample set
if (epoch >= 0):
tl.files.save_npz(net_image2.all_params, name=checkpoint_dir+'/params_{}.npz'.format(tl.global_flag['mode']), sess=sess)
if config.train.dump_intermediate_result is True:
sample_out, sample_grad_out = sess.run([net_image_test.outputs,net_grad_test.outputs], {t_image: sample_input_imgs})#; print('gen sub-image:', out.shape, out.min(), out.max())
tl.vis.save_images(truncate_imgs_fn(sample_out), [ni, ni], save_dir+'/train_predict_%d.png' % epoch)
tl.vis.save_images(truncate_imgs_fn(np.abs(sample_grad_out)), [ni, ni], save_dir+'/train_grad_predict_%d.png' % epoch)
def test(file):
try:
img = get_imgs_fn(file)
except IOError:
print('cannot open %s'%(file))
else:
checkpoint_dir = config.model.checkpoint_path
save_dir = "%s/%s"%(config.model.result_path,tl.global_flag['mode'])
input_image = normalize_imgs_fn(img)
size = input_image.shape
print('Input size: %s,%s,%s'%(size[0],size[1],size[2]))
t_image = tf.placeholder('float32', [None,size[0],size[1],size[2]], name='input_image')
net_g, _, _, _ = LapSRN(t_image, is_train=False, reuse=False)
###========================== RESTORE G =============================###
sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True, log_device_placement=False))
tl.layers.initialize_global_variables(sess)
tl.files.load_and_assign_npz(sess=sess, name=checkpoint_dir+'/params_train.npz', network=net_g)
###======================= TEST =============================###
start_time = time.time()
out = sess.run(net_g.outputs, {t_image: [input_image]})
print("took: %4.4fs" % (time.time() - start_time))
tl.files.exists_or_mkdir(save_dir)
tl.vis.save_image(truncate_imgs_fn(out[0,:,:,:]), save_dir+'/test_out.png')
tl.vis.save_image(input_image, save_dir+'/test_input.png')
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-m', '--mode', choices=['train','test'], default='train', help='select mode')
parser.add_argument('-f','--file', help='input file')
args = parser.parse_args()
tl.global_flag['mode'] = args.mode
if tl.global_flag['mode'] == 'train':
train()
elif tl.global_flag['mode'] == 'test':
if (args.file is None):
raise Exception("Please enter input file name for test mode")
test(args.file)
else:
raise Exception("Unknow --mode")
#! /usr/bin/python
# -*- coding: utf8 -*-
import numpy as np
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import *
from config import *
def lrelu(x):
return tf.maximum(x*0.2,x)
def LapSRNSingleLevel(net_image, net_feature, reuse=False):
with tf.variable_scope("Model_level", reuse=reuse):
tl.layers.set_name_reuse(reuse)
net_tmp = net_feature
# recursive block
for d in range(config.model.resblock_depth):
net_tmp = PReluLayer(net_tmp, name='prelu_D%s'%(d))
net_tmp = Conv2dLayer(net_tmp,shape=[3,3,64,64],strides=[1,1,1,1],
name='conv_D%s'%(d), W_init=tf.contrib.layers.xavier_initializer())
# for r in range(1,config.model.recursive_depth):
# for d in range(config.model.resblock_depth):
# net_tmp = PReluLayer(net_tmp, name='prelu_R%s_D%s'%(r,d))
# net_tmp = Conv2dLayer(net_tmp,shape=[3,3,64,64],strides=[1,1,1,1],
# name='conv_R%s_D%s'%(r,d), W_init=tf.contrib.layers.xavier_initializer())
net_feature = ElementwiseLayer(layer=[net_feature,net_tmp],combine_fn=tf.add,name='add_feature')
net_feature = PReluLayer(net_feature, name='prelu_feature')
net_feature = Conv2dLayer(net_feature,shape=[3,3,64,256],strides=[1,1,1,1],
name='upconv_feature', W_init=tf.contrib.layers.xavier_initializer())
net_feature = SubpixelConv2d(net_feature,scale=2,n_out_channel=64,
name='subpixel_feature')
# add image back
gradient_level = Conv2dLayer(net_feature,shape=[3,3,64,3],strides=[1,1,1,1],act=lrelu,
name='grad', W_init=tf.contrib.layers.xavier_initializer())
net_image = Conv2dLayer(net_image,shape=[3,3,3,12],strides=[1,1,1,1],
name='upconv_image', W_init=tf.contrib.layers.xavier_initializer())
net_image = SubpixelConv2d(net_image,scale=2,n_out_channel=3,
name='subpixel_image')
net_image = ElementwiseLayer(layer=[gradient_level,net_image],combine_fn=tf.add,name='add_image')
return net_image, net_feature, gradient_level
def LapSRN(inputs, is_train=False, reuse=False):
n_level = int(np.log2(config.model.scale))
assert n_level >= 1
with tf.variable_scope("LapSRN", reuse=reuse) as vs:
tl.layers.set_name_reuse(reuse)
shapes = tf.shape(inputs)
inputs_level = InputLayer(inputs, name='input_level')
net_feature = Conv2dLayer(inputs_level, shape=[3,3,3,64], strides=[1,1,1,1],
W_init=tf.contrib.layers.xavier_initializer(),
name='init_conv')
net_image = inputs_level
# 2X for each level
net_image1, net_feature1, net_gradient1 = LapSRNSingleLevel(net_image, net_feature, reuse=reuse)
net_image2, net_feature2, net_gradient2 = LapSRNSingleLevel(net_image1, net_feature1, reuse=True)
return net_image2, net_gradient2, net_image1, net_gradient1
\ No newline at end of file
"""
Deep learning and Reinforcement learning library for Researchers and Engineers
"""
from __future__ import absolute_import
try:
install_instr = "Please make sure you install a recent enough version of TensorFlow."
import tensorflow
except ImportError:
raise ImportError("__init__.py : Could not import TensorFlow." + install_instr)
from . import activation
from . import cost
from . import files
from . import iterate
from . import layers
from . import ops
from . import utils
from . import visualize
from . import prepro
from . import nlp
from . import rein
# alias
act = activation
vis = visualize
__version__ = "1.5.0"
global_flag = {}
global_dict = {}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment