mxnet-center-loss icon indicating copy to clipboard operation
mxnet-center-loss copied to clipboard

请问center_loss.py中每个label的center是如何更新的?

Open LeeJuly30 opened this issue 6 years ago • 7 comments

您好,我在center_loss.py里没有看到有关center的更新,只是在每次forward的时候传入center 但是在main,pyforward的时候loss_center = center_loss(features, label)也没有传入center,不知道在训练的时候每个label的center是如何更新的? 感谢帮助

LeeJuly30 avatar Apr 10 '18 07:04 LeeJuly30

Hi,

The centers are maitained in the in parameters in CenterLoss class. As we know, the centers are updated when the network backpropagates. In MXNet, it automatically computes the gradients and update the parameters (managed in autograd package). It does not require you to update the centers manually.

Does it anwer your question?

ShownX avatar Apr 10 '18 22:04 ShownX

但是基于TensorFlow的实现都设置了centerstrainable=False,然后利用每个batch的数据去更新每个label的center,而不是利用bp反传的梯度更新center,而且我感觉直接用数据更新center而不是用梯度更新更make sense - -

LeeJuly30 avatar Apr 11 '18 10:04 LeeJuly30

会更新中心的。你就认为最终的聚类中心是最优点,每一次反向传播时候,使用梯度下降法使得当前的聚类中心向最优点移动。

zhyj3038 avatar Apr 23 '18 11:04 zhyj3038

center最初是怎么计算出来的,在哪里实现的?

yanglong-intellif avatar Oct 22 '18 03:10 yanglong-intellif

有个center class,里面存储的就是feature center,最初是随机初始化得到的。

wangx404 avatar Nov 27 '18 06:11 wangx404

center最初是怎么计算出来的,在哪里实现的?

我用另一种方式实现了center loss,欢迎使用讨论。

wangx404 avatar Dec 03 '18 08:12 wangx404

in line 77 and 79 in main.py, there is a little problem.

fpath=os.path.join(args.out_dir, '%s-train-epoch-%s.png' % (args.prefix, e)))

Isn't it better to use "epoch-%d.png" rather than "epoch-%s.png"?

wangx404 avatar Mar 27 '19 09:03 wangx404