一个用来调节loss weights的函数

本文介绍了在SE-SSD中用于调整一致性权重的sigmoid_rampup函数,该函数灵感来源于Antti Tarvainen和Harri Valpola的论文。训练过程中采用ADAM优化器,使用余弦退火学习率,并在前15个epoch内以sigmoid函数逐渐从0增加到1。
摘要由CSDN通过智能技术生成
def sigmoid_rampup(current_epoch):
    current = np.clip(current_epoch, 0.0, 15.0)
    phase = 1.0 - current / 15.0
    return np.exp(-5.0 * phase * phase).astype(np.float32)

if __name__ == '__main__':
    x = np.linspace(1,20, num=20)
    y = sigmoid_rampup(x)
    plt.plot(x,y)
    plt.show()

 在SE-SSD 的代码中看到了 sigmoid_rampup 函数, 它用来调节 consistency_weight 在整个loss中的权重. 

这个思想来自于 Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In NeurIPS, pages
1195–1204, 2017. 2, 6

Training details We adopt the ADAM optimizer and cosine annealing learning rate [18] with a batch size of four for 60 epochs. We follow [27] to ramp up µt (Eq. (5)) from 0 to 1 in the first 15 epoches using a sigmoid-shaped function e−5(1−x)2. 

e^{-5(1-x)^{2}}

consistency_weight = 1.0 * self.sigmoid_rampup(self.epoch)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值