LLNet模型实现-训练模型

本文档介绍了LLNet模型的实现,这是一个用于低光照图像增强的深度自动编码器。该模型包含多个层,并使用了Xavier初始化方法。在预训练阶段,通过计算数据损失、KL散度损失和稀疏损失来优化权重;在微调阶段,只优化最后一层的权重。
摘要由CSDN通过智能技术生成
# 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],
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值