[英]how can I set the the weights of networks in CNNs TensorFlow?
我在以下鏈接中將以下代碼用於卷積神經網絡: https : //github.com/aymericdamien/TensorFlow-Examples/blob/master/examples/3_NeuralNetworks/convolutional_network.py ,我想為模型設置參數:
我的輸入是35 * 128的數組
我設置了以下網絡參數:
# Network Parameters
n_input = 35*128
n_classes = 6
dropout = 0.75
您能否讓我知道如何設置權重和偏見? 默認值為:
# Store layers weight & bias
weights = {
# 5x5 conv, 1 input, 32 outputs
'wc1': tf.Variable(tf.random_normal([5, 5, 1, 32])),
# 5x5 conv, 32 inputs, 64 outputs
'wc2': tf.Variable(tf.random_normal([5, 5, 32, 64])),
# fully connected, 7*7*64 inputs, 1024 outputs
'wd1': tf.Variable(tf.random_normal([7*7*64, 1024])),
# 1024 inputs, 10 outputs (class prediction)
'out': tf.Variable(tf.random_normal([1024, n_classes]))
}
biases = {
'bc1': tf.Variable(tf.random_normal([32])),
'bc2': tf.Variable(tf.random_normal([64])),
'bd1': tf.Variable(tf.random_normal([1024])),
'out': tf.Variable(tf.random_normal([n_classes]))
}
我的聲譽不足,無法發表評論。 因此,只需通過設置權重和偏差來明確說明您的確切意思。 如果要使用某些條件設置值,請參見此鏈接https://www.tensorflow.org/api_docs/python/tf/random_normal
在這里,您可以指定權重和偏差值的平均值,標准差和dtype。
最后,我通過閱讀下面的tensorflow教程找到了自己的解決方案,這確實很有幫助:
https://www.tensorflow.org/tutorials/layers
我的輸入圖像大小為35 * 128,我應該在密集層('wd1')中將參數設置為9 * 32 * 64。
'wd1': tf.Variable(tf.random_normal([9*32*64, 1024]))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.