python - 寻找 keras inceptionresnetv2 的图层名称
问题描述
真的不知道我在做什么,按照本教程处理 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”
所以是的,只是想弄清楚如何获取该数据集中的图层以及其他图层的名称
解决方案
您只需输入以下代码即可找出模型架构(包括层名称)。
#Model denotes the Inception model
model.summary()
或者将复杂的关系可视化,
tf.keras.utils.plot_model(model, to_file='model.png')
推荐阅读
- javascript - 在我可以设置图像的 src 之前反应组件渲染
- roku - 任务节点执行超时
- android - 在 Android9 中编写 HAL 以访问硬件的最佳方法是什么
- hex - 汇编语言十六进制地址
- javascript - iOS 13 上 Safari WKWebView 中带有固定 div 的不需要的额外滚动空间
- r - 如何使用 dplyr 在 R 中的不同子集上运行一段代码
- amazon-web-services - golang中的AWS lambda参数为空
- html - 无法让 type="email" 中的输入正则表达式模式正常工作
- php - 警告:mime_content_type():空文件名或路径
- javascript - 如何清除/重置 react.js 表单中的输入数据?