RDG*_*RDG 3 deep-learning keras
我想尝试使用 Keras 库提供的一些预训练 CNN 模型(例如 Exception、ResNet50 等)进行特征提取。我试图找出我的数据集的输入维度是否需要匹配用于训练原始 CNN 的图像的维度。
例如; 我应该使用在 210x210 RGB 图像上预先训练的网络模型,这是否意味着如果我想将其用于特征提取,网络将仅适用于相同维度的图像(即 (210, 210, 3))?或者在这方面有一些灵活性吗?
尝试搜索 Google 并检查 Keras 文档,但找不到有关此问题的明确答案!任何有这方面经验的人的意见将不胜感激。
不,这是可能的,您可以更改input_shape预训练模型的 。它甚至在 keras.aplications文档中被提及。
在自定义输入张量上构建 InceptionV3
from keras.applications.inception_v3 import InceptionV3
from keras.layers import Input
# this could also be the output a different Keras model or layer
# this assumes K.image_data_format() == 'channels_last'
input_tensor = Input(shape=(224, 224, 3))
model = InceptionV3(input_tensor=input_tensor, weights='imagenet',
include_top=False)
Run Code Online (Sandbox Code Playgroud)
请注意,如果您想使用具有与训练图像大小不同的图像的模型,则必须设置include_top为False,因为模型的全连接层仅限于接受具有正确维度的特征,即原始训练产生的特征图像大小。
| 归档时间: |
|
| 查看次数: |
1671 次 |
| 最近记录: |