Skip to content
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

focal-loss = 87.3365 #1

Open
liangzimei opened this issue Aug 17, 2017 · 5 comments
Open

focal-loss = 87.3365 #1

liangzimei opened this issue Aug 17, 2017 · 5 comments

Comments

@liangzimei
Copy link

liangzimei commented Aug 17, 2017

when i change softmaxwithloss to focal-loss, in the beginning of training, the loss becomes 87.3365.
When using softmaxwithloss, there is no such a problem.
Is the code still under the testing phase?

@zimenglan-sysu-512
Copy link
Owner

zimenglan-sysu-512 commented Aug 17, 2017

hi @liangzimei,

sorry about that. i just finish the code. i will test it in the next few days.

btw, can u give how do define the focal loss in your train.prototxt?

@zimenglan-sysu-512
Copy link
Owner

zimenglan-sysu-512 commented Aug 18, 2017

hi @liangzimei,

i have fixed the bugs: the loss and the gradient. now it can work. please have a try.

for more details, u can see #2

@liangzimei
Copy link
Author

@zimenglan-sysu-512 , thanks for your reminder.
my train.prototxt is
layer {
name "fc3_new_1"
type: InnerProduct
......
}
layer {
name: "loss_focal"
type: "FocalLoss"
bottom: "fc3_new_1"
bottom: "label"
top: "loss_focal"
loss_param{
normalize: true
normalization: FULL
}
}
when i update the cpp and cu just now, the loss become nan in the training process.

@zimenglan-sysu-512
Copy link
Owner

zimenglan-sysu-512 commented Aug 18, 2017

hi @liangzimei,

If i try small dataset using pvanet, it's ok, but it encounters the NAN, when i use larger dataset. I still try to fix it.

@zimenglan-sysu-512
Copy link
Owner

zimenglan-sysu-512 commented Aug 18, 2017

hi @liangzimei,

i fix the NaN problem. i guess that, the op (1 - p_t)^gamma / (1 - p_t) causes the problem, when 1 - p_t is so small.

now you can have a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants