Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何从自定义模型tensorflow keras更改inputshape、include_top=False和冻结_Python_Tensorflow_Machine Learning_Keras_Object Detection - Fatal编程技术网

Python 如何从自定义模型tensorflow keras更改inputshape、include_top=False和冻结

Python 如何从自定义模型tensorflow keras更改inputshape、include_top=False和冻结,python,tensorflow,machine-learning,keras,object-detection,Python,Tensorflow,Machine Learning,Keras,Object Detection,我有一个自定义模型,另存为model.h5。我想用这个预先训练好的模式进行迁移学习。然后我需要将输入形状更改为(224224,3),在冻结它之前不包括顶层。这个的语法是怎样的?我知道如何使用库中的模型执行此操作,例如: base_model = keras.applications.VGG16( weights='imagenet', # Load weights pre-trained on ImageNet. input_shape=(224, 224, 3), i

我有一个自定义模型,另存为model.h5。我想用这个预先训练好的模式进行迁移学习。然后我需要将输入形状更改为(224224,3),在冻结它之前不包括顶层。这个的语法是怎样的?我知道如何使用库中的模型执行此操作,例如:

base_model = keras.applications.VGG16(
    weights='imagenet',  # Load weights pre-trained on ImageNet.
    input_shape=(224, 224, 3),
    include_top=False) 
我想要这样的东西:

from keras.models import load_model

base_model = load_model('model.h5', input_shape=(224,224,3), include_top=False)
base_model.trainable = False


您必须手动创建一个子模型。。。顶层是什么/顶层是什么层?@MarcoCerliani您有创建子模型语法的示例吗。你说的顶层对我来说是什么意思。Im使用YOLOv3交叉数据集以及github中的权重和配置