【问题标题】:Looking for layer names for keras inceptionresnetv2寻找 keras inceptionresnetv2 的图层名称
【发布时间】:2021-03-02 09:09:45
【问题描述】:

真的不知道自己在做什么,跟着这个教程处理 deepdream 图像https://www.youtube.com/watch?v=Wkh72OKmcKI

尝试将基础模型数据集从这里更改为任何,https://keras.io/api/applications/#models-for-image-classification-with-weights-trained-on-imagenet 目前尤其是 InceptionResNetV2。 InceptionV3 使用“mixed0”到“mixed10”,而前一个数据集显然使用了不同的命名系统。

必须更改此部分

# Maximize the activations of these layers
names = ['mixed3', 'mixed5']
layers = [base_model.get_layer(name).output for name in names]

# Create the feature extraction model
dream_model = tf.keras.Model(inputs=base_model.input, outputs=layers)

我收到一个错误“没有这样的层:mixed3”

所以,是的,只是想弄清楚如何获取此数据集中的图层以及其他图层的名称

【问题讨论】:

    标签: python tensorflow keras


    【解决方案1】:

    您只需输入以下代码即可找到模型架构(包括层名称)。

    #Model denotes the Inception model
    model.summary()
    

    或将复杂的关系可视化,

    tf.keras.utils.plot_model(model, to_file='model.png')
    

    【讨论】:

    • 谢谢,我很感激,但是我在哪里输入呢?在 powershell 中,还是在那个笔记本中?
    • @user14665806 显然在笔记本上。
    • 原来是base-model.summary()
    • @user14665806 请将您的问题标记为已回答。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-09-13
    • 1970-01-01
    • 2020-02-06
    • 2011-01-13
    • 1970-01-01
    • 1970-01-01
    • 2019-06-14
    相关资源
    最近更新 更多