How to use FastAI V2 Dice metric with UNet Learner

I am passing FastAI V2 Dice metric to my FastAI V2 unet_learner as follows:

learn = unet_learner(dls, models.resnet34, metrics=[Dice],wd=1e-2,pretrained=True,normalize=True)

When the method fit_one_cycle starts validation it throws me the next error:
__init__() takes from 1 to 2 positional arguments but 3 were given

So I think that I am using it incorrectly!

Thank you very much.

I am looking forward to hearing from you soon!

1 Like

Call it as an instance, IE metrics=[Dice()] and it should work. Also in the future, for fastai2 related questions please use the subforum. To access it from “create a new topic” I’ve illustrated below :slight_smile:

image

1 Like

Next time I am going to use the subforum!!!

I didn’t knew there was a subforum.

So, sorry! :cry:

1 Like

All good! :slight_smile: