Keras如何处理多个输出中的反向传播 [英] How does Keras handle backpropagation in multiple outputs

查看:608
本文介绍了Keras如何处理多个输出中的反向传播的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于这样的网络体系结构:

For a network architecture like this:

          +---+   
input1--->| CNN | -------|
           +---+         |  
                         |
           +---+      +-------+          +-------+ 
input2--->| CNN | ----| Concat|-----|----|  VGG  |---- Main_out
           +---+      +-------+     |    +-------+   
                          |         |
           +---+          |         |
input3--->| CNN | --------|        Aux_out
           +---+   

反向传播流程如何进行?我的意思是,有两个反向传播步骤?或来自Main_out的唯一一个更新权重.

How does the backpropagation flow go? I mean, there are two backpropagation steps? Or the only one that comes from the Main_out updates the weights.

我为每个输出使用损失权重:

I am using loss weights for each output:

model.compile(loss="categorical_crossentropy",optimizer=OPT,metrics=["accuracy"],
            loss_weights={'main_output': 1., 'aux_output': 0.2}

推荐答案

根据loss_weights

final_loss = loss_main + 0.2*loss_aux

将在每次迭代时通过一个反向传播步骤来针对此损失更新参数.

the parameters will be updated with respect to this loss by one backpropagation step at each iteration.

这篇关于Keras如何处理多个输出中的反向传播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆