樣品=批量大小=圖像的數量在一個批處理
Keras會經常使用None
這個維度,這意味着它可以改變你不必設置。
雖然這方面確實存在,當你創建一個層,你通過input_shape
沒有它:
Conv2D(64,(3,3), input_shape=(channels,rows,cols))
#the standard it (rows,cols,channels), depending on your data_format
爲每個時間段(或批次)後都做的動作,你可以使用一個LambdaCallback,經過on_epoch_end
功能:
#the function to call back
def get_weights(epoch,logs):
wsAndBs = model.layers[indexOfTheConvLayer].get_weights()
#or model.get_layer("layerName").get_weights()
weights = wsAndBs[0]
biases = wsAndBs[1]
#do what you need to do with them
#you can see the epoch and the logs too:
print("end of epoch: " + str(epoch)) for instance
#the callback
from keras.callbacks import LambdaCallback
myCallback = LambdaCallback(on_epoch_end=get_weights)
通過這個回調訓練功能:
model.fit(...,...,... , callbacks=[myCallback])
你到底明白了什麼?你需要具體,否則它是一個重複的問題。 –
假設我在keras中製作了一個類似Conv2D(64,(3,3),activation ='relu')的模型,這意味着沒有過濾器是64並且每個過濾器的大小是3 * 3。對於任何模型的第一次迭代,這些64 * 3 * 3值通過讓我們說glorot_uniform初始化,然後在model.compile中初始化,我使用sgd優化器。現在,這64位文件員將獲得新的價值。我想看到這些新的價值。 – Hitesh
我知道。你鏈接的問題提供了答案。你還沒有解釋你從另一個問題中不瞭解的內容。 –