Confusion Matrix for Segmentation

Hi all,

I am working on to generate confusion matrix for my unet model.

Unfortunately, SegmentationInterpretation._generate_confusion was available for V1 but apparently it was not carried to V2. I tried to adopt it but I failed.

Is there any example for confusion matrix generation for segmentation?


1 Like

did you find any solution? @cercan

1 Like

I’m facing the same problem. Please let me know if you have found a solution?

I posted my question even on StackOverflow and nobody has responded yet. I will let you know when I find any solution.

Hello Willemien and Shae, I see your problems. I have not a solution right now but I would like to ask your help.
Actually, I am rather new in the Segmentation area: I used mainly FastAI for Image classifications using the detailed explanations in Jeremy’s lessons and in the book.
Segmentation is instead a much less covered subject. Where did you learn what you know to implement what you have? I think that I am missing something.
In the following I try to illustrate my train of thoughts and where I am presently stuck.
I am going as well to use Unet, of course. Yet, you both are at a much more advanced stage than me. I would like to get there.
Ok: I arrive to build a learner:
opt = ranger
learn = unet_learner(dls, resnet34, metrics=acc_Segm, self_attention=True, act_cls=Mish, opt_func=opt)
The summary looks ‘normal’ but then when and if I try to fit or to run an lr_find it complains saying ‘values are out of range’ .
I realized that there are problems in my implementation concerning the vocab and name2id. Plus, I am currently on Windows and therefore it uses only one worker.
Shall I move to Linux?
I inserted new vocab values, but I am not sure yet if it uses them correctly. Welll, it does not complain that ‘values are out of bound’ as it did before, so I believe that the algorithms finds and read them. I thought that it should take them from the masks, no? this is at least what seems in the CAMVID notebook, which is currently my bible.
I wrote myself a small routine to create a valid and training set. Which it needs otherwise dls and learner are not built.
But this learner seems to use only the valid.txt and the Inames containing the names of all images. If I put other than valid.txt in the dataloader, it does not progress to a databunch.
After I build the learner, with only one worker, and bs=1 in the dls, if I try lr_find or a fitting like:
learn.fit_flat_cos(10, lr=0.00001)
But the program gets stuck complaining in both cases with this:
ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 512, 1, 1])

Now, do you have any suggestions as to where I can find a more complete tutorial/notebook for image segmentation? Or just maybe, can you point to me some of the mistakes in what I wrote above?
I know that what I wrote would take a lot of your time. Therefore I am not asking for specific answers. Maybe, if you could share your implementation or, please, just point me in a useful direction to find information on how to set up such segmentation scheme … because I think something is missing or misplaced in my current implementation.
Every suggestion would be much appreciated!!
I thank you very much from now for your time!!!