mxnet-center-loss
mxnet-center-loss copied to clipboard
请问center_loss.py中每个label的center是如何更新的?
您好,我在center_loss.py
里没有看到有关center的更新,只是在每次forward
的时候传入center
但是在main,py
里forward
的时候loss_center = center_loss(features, label)
也没有传入center
,不知道在训练的时候每个label的center是如何更新的?
感谢帮助
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?
但是基于TensorFlow的实现都设置了centers
的trainable=False
,然后利用每个batch的数据去更新每个label的center,而不是利用bp反传的梯度更新center,而且我感觉直接用数据更新center而不是用梯度更新更make sense - -
会更新中心的。你就认为最终的聚类中心是最优点,每一次反向传播时候,使用梯度下降法使得当前的聚类中心向最优点移动。
center最初是怎么计算出来的,在哪里实现的?
有个center class,里面存储的就是feature center,最初是随机初始化得到的。
center最初是怎么计算出来的,在哪里实现的?
我用另一种方式实现了center loss,欢迎使用讨论。
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"?