-
Notifications
You must be signed in to change notification settings - Fork 613
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
Add focal loss tutorial. #1440
Add focal loss tutorial. #1440
Conversation
Check out this pull request on You'll be able to see Jupyter notebook diff and discuss changes. Powered by ReviewNB. |
IIRC, focal loss is specifically formulated to help out for detection tasks (like PASCAL). It was also originally introduced for RetinaNet which wasn't doing simple classification. From the paper:
A tutorial on MNIST classification isn't suitable. It's better to do a simple detection task using a single short detector, or if that's too complex, we can artificially imbalance the dataset to show where focal loss really shines. |
Can we try on mnist that is labels are 1 or not. |
I agree with @Squadrick. I think an easy single stage anchor free object detector could be simple enough for a focal loss tutorial. I.e. see focal loss in https://github.com/xuannianz/keras-CenterNet |
@Squadrick @bhack I changed the dataset, now MNIST have just 3 categories 0, 1, and others, so dataset is imbalanced and loss graph are same as graph on paper. |
@@ -0,0 +1,467 @@ | |||
{ |
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.
It is good to add compile()
and fit()
in Train and Evaluate
and not in Building The Model
Reply via ReviewNB
Tbh I feel like this is may be an unnecessary tutorial.
I agree with @bhack that the most prominent use case for the focal loss is object detection. A tutorial on object detection which makes use of the focal loss would probably be a lot more informative. In that case it would also not be such a big problem to be less mathematically precise about the formulation of the focal loss itself. |
/cc @WindQAQ @seanpmorgan Probably we need to deprecate focal loss before the next release https://github.com/keras-team/keras-cv/blob/master/keras_cv/losses/focal_loss.py |
We have now a focal loss in Keras CV. I suggest you to port this in the Keras io repository: |
Related issue: #361