Instance segmentation

You need to write a function that passed your yb["mask"] to the metric function (in fastai) you want to use.

1 Like

Ahhh, okey. Could you link me the default function , please? So I can look at his code and override it.

I don’t know which functions should I redefine. Don’t know which line of code is calling metrics computation.

In that case all fastai metrics would work.


EDIT
@sgugger I am editing this post with a better explanation.

Learner class can receive as parameter an array of metrics. Somewhere in FastAI lib should be a function that pass the data to each metric (self.yb and self.preds). I have been looking for this code inside learner.py and in callbacks.

However, I didn’t manage to find it. Could you post here the function or a link that points there, please?

I discover what you were refering for.

I have seen 2 options for solve this issue:

  • Create differents metrics that get the mask from the dict. However, It will suppose duplicating code in each class.
  • Overriding Recorder.after_batch in line 417 for met in mets: met.accumulate(self.learn). Then no need to code cuplication

Do you think that is a better option to pass a deep_copy of self.learn or other object where pred and yb contains just the masks?

Which option looks better for you?

Thank you very much for the previous help! :smiley:

I don’t understand. Could you explain it a little more please?

Hi @WaterKnight do you have any github repo of your work that is sharable ? seems very interesting.

Hey,I am training MaskRCNN right now for binary segmentation. It is fully working with variable batch size. The only thing not working is Mixed Precission It is owed to an error on PyTorch

I’ll be sharing the repo in a month! This is my final degree project.

2 Likes

no worries – best of luck!

I hope that by the time PyTorch solves the problem with torch.cuda.amp.autocast and maskrcnn.

In this repo you will find semantic segmentation models too!

1 Like

I guess what i am interested to see if you ficgured out a way to use an error metric. Also, does lr_finder work well for MaskRCNN

Yes, I managed to get Dice, Jaccard Coeff and other metrics for segmentation. Lr_find is working. Frezzeing and unfreezing too.

Just the only issue is Mixed Precission.

1 Like

cool – so the code snippet you pasted above actually works ? Like if we just change the name of the data class MaskRCNN, as mentioned in the comments – it will actually work – or are there other changes.
Thanks for your inputs :slight_smile:

I needed to create a new TfdmList and some new transforms

I see, so adding to the aug_transforms in the maskrccnnDataBlock ?

@pinaki f you mean Augmentation transforms, I am using the ones from Albumentations library!

Hello. Wanted to know if you managed to advance on the MaskRCNN implementation.

1 Like

Yes, Mask-RCNN is working. However as is my final degree project I can’t publish it yet :sob:

3 Likes

Very keen to see this too, when you’re able to publish it

@WaterKnight this is a fascinating post. Are you now able to publish your project? I’d love to take a look. Thanks!

Yes, I have released it. I am going to create a new post and I am going to mention you all here with the link!

2 Likes

@muellerzr @rsomani95 @joneslloyd @pinaki @riven314 @lgvaz I opened a new post with the package:

6 Likes