Focal loss is proposed in the paperFocal Loss for Dense Object Detection. This paper was facing a task for binary classification, however there are other tasks need multiple class classification. There were few implementation about this task, so I implemented it with a NER task using Albert.
- python 3.6
- torch 1.4
python run_focal_loss.py
We use focal loss in Albert model for Ner task, we will public this part of code later, and the result is:
result | Albert | Albert+Focal loss |
---|---|---|
acc | 90.792207 | 91.001332 |
recall | 90.145559 | 90.406321 |
If you have any questions, please contact me at lion19930924@163.com, thanks a lot.