Keras 如何在分支模型中加载训练权重

Keras 如何在分支模型中加载训练权重,keras,Keras,我正在尝试向原始模型添加一个额外的分支,以提高其性能。 更具体地说,原始模型如下所示: input1 = Input() x1 = branch1(x1) x1 = residualnet(x1) model = Model(inputs = [input1], outputs = x1) input1 = Input() input2 = Input() x1 = branch1(x1) #1 x2 = branch2(x2) #2 x1 = concat([x1, x2]) x

我正在尝试向原始模型添加一个额外的分支,以提高其性能。 更具体地说,原始模型如下所示:

input1 = Input()
x1 = branch1(x1)
x1 = residualnet(x1)
model = Model(inputs = [input1], outputs = x1)
input1 = Input()
input2 = Input()


x1 = branch1(x1)  #1
x2 = branch2(x2)  #2

x1 = concat([x1, x2])

x1 = residualnet(x1) #3
model = Model(inputs = [input1, input2], outputs = x1)
我的改进如下:

input1 = Input()
x1 = branch1(x1)
x1 = residualnet(x1)
model = Model(inputs = [input1], outputs = x1)
input1 = Input()
input2 = Input()


x1 = branch1(x1)  #1
x2 = branch2(x2)  #2

x1 = concat([x1, x2])

x1 = residualnet(x1) #3
model = Model(inputs = [input1, input2], outputs = x1)

在这种情况下,我已经将重量训练为
#1
#3
。将经过训练的权重应用于这些层的最佳方法是什么?

residualnet经过训练以接收dim N的输入,但您强制它接收dim N+M的输入(由于concat操作)@MarcoCerliani I随后将添加1x1 Conv层以减少dim。谢谢你有关于加载训练重量的建议吗?branch1/2和ResistualNet子模型?