Closed puppetmonkey closed 1 month ago
你参考了我的代码吗,https://github.com/yuyi1005/yolov5-obb-pscOn 24 Jul 2024, at 3:16 PM, puppetmonkey @.**> wrote: 自己尝试在yolov8添加psc 但是损失不下降,能否请大佬帮忙看一下代码?已发仓库。 yolov5 已经复现出来。 训练最后一层没有sigmod 计算损失 2pred.sigmod-1,target_encoding 范围(-1,1) ltheta += self.BCEtheta(ps[:, class_index:class_index + 4].sigmoid() * 2 - 1, phase_shift_targets) 推理最后一层有sigmod angle_encoding(0,1) 直接解码 angle_cls = x[:, class_index:class_index + 4]
phase_cos = (angle_cls[:, 1] - angle_cls[:, 0]) / 2 phase_sin = (angle_cls[:, 3] - angle_cls[:, 2]) / 2 phase = torch.atan2(phase_sin, phase_cos) theta_pred = phase.view(-1, 1) / 2 想请教一下为什么?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
训练的时候也有sigmoid吧。其实psc的解码公式,编码是否加sigmoid都是等价的On 2 Aug 2024, at 9:29 PM, Yi @.> wrote:你参考了我的代码吗,https://github.com/yuyi1005/yolov5-obb-pscOn 24 Jul 2024, at 3:16 PM, puppetmonkey @.> wrote: 自己尝试在yolov8添加psc 但是损失不下降,能否请大佬帮忙看一下代码?已发仓库。 yolov5 已经复现出来。 训练最后一层没有sigmod 计算损失 2pred.sigmod-1,target_encoding 范围(-1,1) ltheta += self.BCEtheta(ps[:, class_index:class_index + 4].sigmoid() 2 - 1, phase_shift_targets) 推理最后一层有sigmod angle_encoding(0,1) 直接解码 angle_cls = x[:, class_index:class_index + 4]
phase_cos = (angle_cls[:, 1] - angle_cls[:, 0]) / 2 phase_sin = (angle_cls[:, 3] - angle_cls[:, 2]) / 2 phase = torch.atan2(phase_sin, phase_cos) theta_pred = phase.view(-1, 1) / 2 想请教一下为什么?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>
其实就是 训练做损失计算的编码值,(-1,1) 但是预测的编码值都是(0,1) 感觉有点矛盾。
小问题。
PSC的编码,全部加一个数,或者乘一个数,都不影响解码的。不过我应该写的是一致的呀,训练的应该都是-1到1On 2 Aug 2024, at 11:37 PM, puppetmonkey @.***> wrote: 其实就是 训练做损失计算的编码值,(-1,1) 但是预测的编码值都是(0,1) 感觉有点矛盾。 小问题。
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
yolov5 已经复现出来。 训练最后一层没有sigmod 计算损失 2pred.sigmod-1,target_encoding 范围(-1,1) ltheta += self.BCEtheta(ps[:, class_index:class_index + 4].sigmoid() 2 - 1, phase_shift_targets)
推理最后一层有sigmod angle_encoding(0,1) 直接解码 angle_cls = x[:, class_index:class_index + 4]
print(angle_cls.max(), angle_cls.min())
想请教一下为什么?