Plot_multi_top_losses() Pull Request

(Andrea de Luca) #21

ok, now please copy and paste the output of losses[:3] and losses2[:3]. Thanks!

0 Likes

(moran) #22

print(losses[:3])

tensor([6.5066, 6.1514, 5.9205])

print(losses2[:3])

tensor([6.5066, 6.1514, 5.9205])

0 Likes

(Andrea de Luca) #23

Ok, your losses are of the same shape of the planet dataset’s (btw, you don’t need to provide data.c).

plot_multi_top_losses() should work out of the box. Are you sure you are using fastai 1.0.42 (or newer)?

If you do have 1.0.42 or newer, please tell me where to download the dataset. I’ll conduct extensive experiments, keeping you posted.

0 Likes

(moran) #24

Hi
I upgraded from 1.0.42 to 1.0.43, And now it works
Thanks a lot!!!

1 Like

(Sapir Gershov) #25

Dear Andrea,
Thank you so much for your contribution!
If I may, I’m in need for your help. I’ve tried your function and followed your instructions, but still I was unsuccessful to plot my top losses. The error I received was RAM out of memory. Any ideas?

Take care,
Sapir

1 Like

(Andrea de Luca) #26

You are welcome. Can you post a screenshot of the error? Apart from this, can you check the memory occupation status as the error manifest itself? Do you have a swap partition? More generally, what is your hardware setup?

Thanks.

0 Likes

(Sapir Gershov) #27

I’m are working with GeForce GTX 1080 Ti, and we do have a swap partition

0 Likes

(Andrea de Luca) #28

Thank you, @SapirGershov.

In line 152 the method tries to gather all the informations it collected by using the ClassificationInterpretation api, which in turn calls Pytorch internals. Now, I never encountered such an error, but it doesn’t seem to be related with GPU memory shortages. More probably, it’s a ram problem.

How much ram did you install in your pc? Can you try and replicate the error upon a machine with more ram?

0 Likes

(moran) #29

Dear Andrea

Following my previous emails, i’m trying to run plot_multi_top_losses,
new with fast.ai v 1.0.48
Running:

data = (src.transform(tfms, size=256)
.databunch().normalize(imagenet_stats))

learn.data = data
data.train_ds[0][0].shape
.
.
learn.export()
preds,y,losses = learn.get_preds(with_loss=True)
interp = ClassificationInterpretation(learn, preds, y, losses)
losses, id =interp.top_losses(interp.data.c)
losses2, id2 =interp.top_losses(10)
interp.plot_multi_top_losses(3)

I get the following error message
image

Is there a problem with my input / software update related? and by the way, is there now any option to plot the multi confusion matrix?
Many tanks
Moran

0 Likes

(moran) #30

My losses are of the same shape of the planet datasets
preds and y variables are at equal size
Do you have any idea why it went wrong or how to debug the problem?
Thanks
Moran

0 Likes

(Andrea de Luca) #31

Sorry for the delayed response, I’m having a bad flu.

Now, as you may see, the problem starts at line 189 as it constructs the list of mismatched examples.

The next instruction makes reference to fastai datablock api, so my hypothesis right now is that they changed it a bit, and that broke plot_multi_top_losses().
But I could very well be wrong. As soon as I recover just a bit, hopefully within a couple of days, I’ll try and address the problem.

Thanks!

0 Likes

(moran) #32

Sorry I bothered you
Thanks a lot, and get well soon :slight_smile:

1 Like

(Andrea de Luca) #33

Not at all, thanks for helping me in detecting bugs :wink:

0 Likes

(moran) #34

Hi
Hope you are feeling better!
And i think it works
The problem was that a test data with very simple task
This results with only 1 misclassified sample.
Whereas i tried to plot the 3 top losses
interp.plot_multi_top_losses(3)
Assignment of 1 solved the problem :slight_smile:
Regards the confusion_matrix
Is there anyway print / plot it as multi_confusion_matrix?

Many thanks again for the help and I apologize for the many questions,
I’m working on medical image analysis and really excited by that that things work very well !

0 Likes

(Andrea de Luca) #35

Ah, perfect! :slight_smile:

It has yet to be implemented. It wouldn’t be too difficult to implement, having a bit of time at hand, though…

0 Likes

(moran) #36

Hi!
I upgraded fast.ai to 1.0.52, and now having again problems the interp.plot_multi_top_losses(1)
image
Any chance its not compatible with v 1.0.52?


Thanks!
Moran

0 Likes

(Andrea de Luca) #37

Hi! I’ll check as soon as possible. Meanwhile, you could try and run the planet notebook with 1.0.52 as a rapid check.

0 Likes