# Ref: LLNet: Deep Autoencoders for Low-light Image Enhancement
#
# CVPR 2014
#
# Author: HSW
# Date: 2018-05-11
import tensorflow as tf
import numpy as np
class LLNet_Model(object):
def __init__(self, beta_pretrain, lambda_pretrain, lambda_finetune, transfer_function=tf.nn.sigmoid, LLnet_Shape=(289, 847, 578, 289), sparseCoef = 0.05):
''' LLNet Model Inputs is 17 x 17 image Patch: 289 pixels '''
self.LLnet_Shape = LLnet_Shape
# Inputs + Outputs
self.inputs = tf.placeholder(tf.float32, [None, self.LLnet_Shape[0]])
self.labels = tf.placeholder(tf.float32, [None, self.LLnet_Shape[0]])
# other initial Params
self.transfer = transfer_function
self.sparseCoef = sparseCoef
self.beta_pretrain = beta_pretrain
self.lambda_pretrain = lambda_pretrain
self.lambda_finetune = lambda_finetune
self.weights = self.initial_weights()
self.saver = tf.train.Saver()
def initial_weights(self): ''' Create LLNet weights and biads ''' all_weights = dict() # Layer1 all_weights['w1'] = tf.Variable(self.xavier_init(self.LLnet_Shape[0], self.LLnet_Shape[1])) all_weights['b1'] = tf.Variable(tf.ones([self.LLnet_Shape[1]], dtype=tf.float32)) # Layer2 all_weights['w2'] = tf.Variable(self.xavier_init(self.LLnet_Shape[1], self.LLnet_Shape[2])) all_weights['b2'] = tf.Variable(tf.ones([self.LLnet_Shape[2]], dtype=tf.float32)) # Layer3 all_weights['w3'] = tf.Variable(self.xavier_init(self.LLnet_Shape[2], self.LLnet_Shape[3])) all_weights['b3'] = tf.Variable(tf.ones([self.LLnet_Shape[3]], dtype=tf.float32)) # Layer4 all_weights['w4'] = tf.Variable(self.xavier_init(self.LLnet_Shape[3],