我有vgg19型号,我想微调一下.
# fine tuning the vgg19 model
# let's take a look to see how many layers are in the base model
print("Number of layers in the base model: ", len(vgg_model.layers))
# fine-tune from this layer onwards
fine_tune_at = 100
# freeze all the layers before the `fine_tune_at` layer
for layer in vgg_model.layers[:fine_tune_at]:
layer.trainable = False
Number of layers in the base model: 22当摘要模型
Total params: 20,090,177
Trainable params: 65,793
Non-trainable params: 20,024,384# compiling the model
model.compile(loss = 'binary_crossentropy', optimizer = 'adam', metrics = ['accuracy'])len(model.trainable_variables)
4我想知道len(model.trainable variables) = 4是什么?
有人能跟我解释一下吗?
发布于 2022-11-04 03:46:53
打印(“可训练变量:”,simple_module.trainable_variables)打印(“所有变量:”,simple_module.trainable_variables)
上述代码可用于获取模型中的所有可训练变量和不可训练变量。谢谢。
https://stackoverflow.com/questions/74154534
复制相似问题