資源簡介
《深度學習之TensorFlow:入門、原理與進階實戰》高清+源碼.rar
代碼片段和文件信息
#?-*-?coding:?utf-8?-*-
“““
Created?on?Tue?May?23?16:28:24?2017
@author:?代碼醫生
@blog:http://blog.csdn.net/lijin6249
“““
import?tensorflow?as?tf
import?numpy?as?np
import?matplotlib.pyplot?as?plt
#?導入?MINST?數據集
from?tensorflow.examples.tutorials.mnist?import?input_data
mnist?=?input_data.read_data_sets(“/data/“?one_hot=True)
#?網絡模型參數
learning_rate?=?0.01
n_hidden_1?=?256?#?第一層256個節點
n_hidden_2?=?128?#?第二層128個節點
n_input?=?784?#?MNIST?data?輸入?(img?shape:?28*28)
#?占位符
x?=?tf.placeholder(“float“?[None?n_input])#輸入
y?=?x?#輸出
#學習參數
weights?=?{
????‘encoder_h1‘:?tf.Variable(tf.random_normal([n_input?n_hidden_1]))
????‘encoder_h2‘:?tf.Variable(tf.random_normal([n_hidden_1?n_hidden_2]))
????‘decoder_h1‘:?tf.Variable(tf.random_normal([n_hidden_2?n_hidden_1]))
????‘decoder_h2‘:?tf.Variable(tf.random_normal([n_hidden_1?n_input]))
}
biases?=?{
????‘encoder_b1‘:?tf.Variable(tf.zeros([n_hidden_1]))
????‘encoder_b2‘:?tf.Variable(tf.zeros([n_hidden_2]))
????‘decoder_b1‘:?tf.Variable(tf.zeros([n_hidden_1]))
????‘decoder_b2‘:?tf.Variable(tf.zeros([n_input]))
}
#?編碼
def?encoder(x):
????layer_1?=?tf.nn.sigmoid(tf.add(tf.matmul(x?weights[‘encoder_h1‘])biases[‘encoder_b1‘]))
????layer_2?=?tf.nn.sigmoid(tf.add(tf.matmul(layer_1?weights[‘encoder_h2‘])?biases[‘encoder_b2‘]))
????return?layer_2
#?解碼
def?decoder(x):
????layer_1?=?tf.nn.sigmoid(tf.add(tf.matmul(x?weights[‘decoder_h1‘])biases[‘decoder_b1‘]))
????layer_2?=?tf.nn.sigmoid(tf.add(tf.matmul(layer_1?weights[‘decoder_h2‘])biases[‘decoder_b2‘]))
????return?layer_2
#輸出的節點
encoder_out?=?encoder(x)
pred?=?decoder(encoder_out)
#?使用平方差為cost
cost?=?tf.reduce_mean(tf.pow(y?-?pred?2))
optimizer?=?tf.train.RMSPropOptimizer(learning_rate).minimize(cost)
#?訓練參數
training_epochs?=?20??#一共迭代20次
batch_size?=?256?????#每次取256個樣本
display_step?=?5?????#迭代5次輸出一次信息
#?啟動繪話
with?tf.Session()?as?sess:
????sess.run(tf.global_variables_initializer())
????
????
????total_batch?=?int(mnist.train.num_examples/batch_size)
????#?開始訓練
????for?epoch?in?range(training_epochs):#迭代
????????
????????for?i?in?range(total_batch):
????????????batch_xs?batch_ys?=?mnist.train.next_batch(batch_size)#取數據
????????????_?c?=?sess.run([optimizer?cost]?feed_dict={x:?batch_xs})#?訓練模型
????????if?epoch?%?display_step?==?0:#?現實日志信息
????????????print(“Epoch:“?‘%04d‘?%?(epoch+1)“cost=“?“{:.9f}“.format(c))
????print(“完成!“)
????
????#?測試
????correct_prediction?=?tf.equal(tf.argmax(pred?1)?tf.argmax(y?1))
????#?計算錯誤率
????accuracy?=?tf.reduce_mean(tf.cast(correct_prediction?“float“))
????print?(“Accuracy:“?1-accuracy.eval({x:?mnist.test.images?y:?mnist.test.images}))
???
????#?可視化結果
????show_num?=?10
????reconstruction?=?sess.run(
????????pred?feed_dict={x:?mnist.test.images[:show_num]})
????f?a?=?plt.subplots(2?10?figsize=(10?2))
????for?i?in?range(show_num):
????????a[0][i].imshow(np.reshape(mnist.test.images[i]?(28?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???30708206??2018-11-10?23:55??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\《深度學習之TensorFlow:入門、原理與進階實戰》.pdf
?????文件???????3325??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\10-1??自編碼.py
?????文件???????4564??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\10-2??自編碼進階.py
?????文件???????5143??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\10-3??卷積網絡自編碼.py
?????文件???????4535??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\10-4??自編碼練習題.py
?????文件???????4304??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\10-5??去噪自編碼.py
?????文件???????9273??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\10-6??自編碼綜合.py
?????文件??????10065??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\10-7??分布自編碼綜合.py
?????文件???????4874??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\10-8??變分自編碼器.py
?????文件???????5881??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\10-9??條件變分自編碼器.py
?????文件????????870??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\11-1??tfrecodertest.py
?????文件???????1825??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\11-2??inception_resnet_v2使用.py
?????文件???????3531??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\11-3??vgg19圖片檢測使用.py
?????文件???????3714??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\11-4?ob
?????文件???????7471??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\12-1??Mnistinfogan.py
?????文件???????9529??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\12-2??aegan.py
?????文件???????3924??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\12-3??wgan_gp.py
?????文件???????7574??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\12-4??mnistLSgan.py
?????文件???????5802??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\12-5??GAN-cls.py
?????文件???????2691??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\12-6??mnistEspcn.py
?????文件???????5543??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\12-7??tfrecoderSRESPCN.py
?????文件???????6940??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\12-8??resESPCN.py
?????文件??????10208??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\12-9??rsgan.py
?????文件???????2670??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\3-1??線性回歸.py
?????文件???????2748??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\3-2??字典.py
?????文件???????1558??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\3-3??無占位符.py
?????文件???????2698??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\3-4??字典2.py
?????文件????????504??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\4-1??sessionhello.py
?????文件????????663??2018-04-22?19:40??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\4-10??get_variable配合variable_scope.py
?????文件????????952??2018-04-22?19:39??《深度學習之TensorFlow:入門、原理與進階實戰》PDF+源代碼\代碼\4-11??get_variable配合variable_scope2.py
............此處省略100個文件信息
- 上一篇:COM+編程指南.pdf
- 下一篇:計算機程序的構造和解釋原書第2版 中文版
評論
共有 條評論