问题描述
模型1
model1 = VGG16(input_shape=img_input_shape,weights='imagenet',include_top=False)
model1.trainable = Fasle
inp1 = Input(shape=(224,224,3))
model1_out = model1(inp1)
x = Conv2D(64,2,activation='relu')(model1_out)
x = GlobalAveragePooling2D()(x)
模型2
inp2 = Input(shape=(max_length,))
model2 = Embedding(len(word_index)+1,EMbedDING_DIM,weights=[glove_twitter_200],trainable=True)(inp2)
y = Dropout(0.5)(model2)
y = Bidirectional(LSTM(200,return_sequences=True),merge_mode='concat')(y)
y = Dropout(0.5)(y)
y = Conv1D(filters=32,kernel_size=8,activation='relu')(y)
y = GlobalAveragePooling1D()(y)
y= Dense(64,activation='sigmoid')(y)
串联
merged = concatenate([x,y])
out = Dense(64,activation='softmax')(merged)
out = Dense(2,activation='softmax')(out)
model = Model(inputs=[inp1,inp2],outputs=out)
def data_generator(samples,batch_size,shuffle_data=True):
..... preprocess here
yield [image,text],label
发电机
train_gen= data_generator(train,64)
会给予
但是我该如何称呼两个模型和两个输入适合,以便图像数据流经图像模型而文本数据流经另一个模型?
为此苦苦挣扎...即使我适合这些模型,但如何确认图像通过模型1和文本通过模型2?
任何针对此问题的解决方案....
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)