记录一下:
# Three loss functions
category_predict1 = Dense(100, activation='softmax', name='ctg_out_1')(
Dropout(0.5)(feature1)
)
category_predict2 = Dense(100, activation='softmax', name='ctg_out_2')(
Dropout(0.5)(feature2)
)
dis = Lambda(eucl_dist, name='square')([feature1, feature2])
judge = Dense(2, activation='softmax', name='bin_out')(dis)
model = Model(inputs=[img1, img2], outputs=[category_predict1, category_predict2, judge])
model.compile(optimizer=SGD(lr=0.0001, momentum=0.9),
loss={
'ctg_out_1': 'categorical_crossentropy',
'ctg_out_2': 'categorical_crossentropy',
'bin_out': 'categorical_crossentropy'},
loss_weights={
'ctg_out_1': 1.,
'ctg_out_2': 1.,
'bin_out': 0.5
},
metrics=['accuracy'])
---------------------
作者:maocaisheng
来源:CSDN
原文:https://blog.csdn.net/u012938704/article/details/79904173
版权声明:本文为博主原创文章,转载请附上博文链接!