2017-08-07 12 views
0

私がしようとしているのは、インポートされたVGG16モデルの前にUpsampling2Dレイヤーを追加することです。しかし、私はそれにどのように考えて、インターネットのどこでも言及されたことを見たことがない。私が実行しようとしました何Keras - モデルの前にレイヤーを追加する

:しかし何のためにこのモデルを使用しようとして

VGG = VGG16() 
model = Sequential() 
model.add(UpSampling2D((32,32), input_shape=(7,7,3))) 
model.add(VGG) 

は、次のエラーが発生します。

AttributeError: Layer model_1 has multiple inbound nodes, hence the notion of "layer output" is ill-defined. Use get_output_at(node_index) instead.

任意のアイデアなぜですか?

答えて

0

input_tensor引数はVGG16()に指定できます。 VGG.summary()を実行することにより

from keras.applications.vgg16 import VGG16 
from keras.layers import Input, UpSampling2D 
input_tensor = Input(shape=(7, 7, 3)) 
upsampled = UpSampling2D((32, 32))(input_tensor) 
VGG = VGG16(input_tensor=upsampled) 

、あなたのようなものが表示されるはずです。

_________________________________________________________________ 
Layer (type)     Output Shape    Param # 
================================================================= 
input_1 (InputLayer)   (None, 7, 7, 3)   0 
_________________________________________________________________ 
up_sampling2d_1 (UpSampling2 (None, 224, 224, 3)  0 
_________________________________________________________________ 
block1_conv1 (Conv2D)  (None, 224, 224, 64)  1792 
_________________________________________________________________ 
block1_conv2 (Conv2D)  (None, 224, 224, 64)  36928 
_________________________________________________________________ 
block1_pool (MaxPooling2D) (None, 112, 112, 64)  0 
_________________________________________________________________ 

... 
関連する問題