pycaffe problem: loss doesn't display correctly by using python loss layer on caffe

本文介绍了解决Caffe中Python Loss Layer不被正确识别的问题。通过在配置文件中为Python Loss Layer添加loss_weight参数,可以确保损失值被正确记录。

In general, the caffe log will print out two losses:
1. Iteration x, loss = …
2. Train net output #x: loss = …

The problem is only the second loss displays correctly when we use a python loss layer in pycaffe, which means in low-level c++ code, the smooth_loss is always zero in solver.cpp.

This problem comes out because the caffe doesn’t realize the python loss layer is a loss layer and then doesn’t receive the loss from it and treat it as an normal layer.

The solution is as simply as to modify one line of code in prototxt by adding loss_weight: 1 to the python loss layer. The both loss will display as expected.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值