样品=批量大小=图像的数量在一个批处理
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
我知道。你链接的问题提供了答案。你还没有解释你从另一个问题中不了解的内容。 –