Fastai implementation for FocalLoss

Hi
I have imbalanced data for classification task and I want to use FocalLoss for my learn.loss_func
I tried some of the suggestion for implementation posted in this forum without unsuccessfully [the code crashed]
Is there a fastai implementation of FocalLoss to be used in standard cnn_learner?
learn = cnn_learner(data, models.resnet50, metrics=accuracy,wd=0.001)

Thanks
Moran

This one works well
https://www.kaggle.com/rohitgr/fastaiv1-with-densenet121-and-focal-loss

1 Like