小编Rim*_*wal的帖子

keras inceptionV3 错误“base_model.get_layer('custom')” ValueError: No such layer: custom

我正在尝试使用 inceptionV3 预训练模型(来自 keras 应用程序)提取特征。我的代码有以下块:

 base_model = InceptionV3(include_top=include_top, weights=weights, input_tensor=Input(shape=(299,299,3)))
 model = Model(input=base_model.input, output=base_model.get_layer('custom').output)
 image_size = (299, 299)
Run Code Online (Sandbox Code Playgroud)

当我运行它时,它会出现以下错误:

ValueError                                Traceback (most recent call last)
<ipython-input-24-fa1f85b62b84> in <module>()
     20 elif model_name == "inceptionv3":
     21   base_model = InceptionV3(include_top=include_top, weights=weights, input_tensor=Input(shape=(299,299,3)))
---> 22   model = Model(input=base_model.input, output=base_model.get_layer('custom').output)
     23   image_size = (299, 299)
     24 elif model_name == "inceptionresnetv2":

~\Anaconda3\lib\site-packages\keras\engine\network.py in get_layer(self, name, index)
    362         """Retrieves the model's updates.
    363 
--> 364         Will only include updates that are either
    365         unconditional, or conditional on …
Run Code Online (Sandbox Code Playgroud)

python classification keras tensorflow

1
推荐指数
1
解决办法
3475
查看次数

标签 统计

classification ×1

keras ×1

python ×1

tensorflow ×1