-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add 2 weight functions in multi-label #2952
base: develop
Are you sure you want to change the base?
Conversation
Thanks for your contribution! |
@@ -3,7 +3,14 @@ | |||
import paddle.nn.functional as F | |||
|
|||
|
|||
def ratio2weight(targets, ratio): | |||
def ratio2weight_1(targets, ratio): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的1、2、3是官方repo的命名方式吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/valencebond/Rethinking_of_PAR/blob/master/tools/function.py 官方 repo 只有一个,命名中无后缀。1、2、3 是按论文给的顺序给出来的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议这里只定义一个函数ratio2weight,里边增加参数mode,mode可以是1,2,3,在注释中说明下区别
|
根据 #2951 新增两个 ratio2weight 函数。代码里延续论文中的命名,所以原
ratios2weight
改为ratios2weight_1
。Type 3 示例:
Type 2/1 示例:
但是 https://github.com/PaddlePaddle/PaddleClas/blob/release/2.5/ppcls/loss/dmlloss.py 中 import 了
ratio2weight
这个函数,目前的解决方案是在 dmlloss 中开启 weight_type 和 weight_alpha 这两个参数,与 multilabelloss 中保持一致,然后计算对应的 loss。