Fastai implementation for FocalLoss

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)


This one works well

1 Like