2

I am trying to recover the weights used by LIME algorithm on the superpixels of an image. I am perfectly able to recover the map and the boundaries for the predictions, but not the weights.

I have tried the command print(explanation.as_list()) but I get the error 'ImageExplanation' object has no attribute 'as_list'.

Anyone knows how to do it?

Thanks in advance.

EDIT

My actual code is:

explainer = lime_image.LimeImageExplainer()

explanation = explainer.explain_instance(x[0], model.predict, top_labels=5, hide_color=0, num_samples=1000)

I need to recover the weights, but I can not find a way even from the documentation. Thanks!

EDIT 2

I don't know if it is helpful, but I used the v3 model in keras pretrained on Imagenet. x is the image to explain.

VGhidini
  • 31
  • 3

1 Answers1

1

I have found them using

      explanation.local_exp

which returns a dictionary, where the keys are the indexes of the classes being classified, and the elements are set of tuples containing (superpixel, Lime score).

The division of the image into superpixel is given in

    explanation.segments

where for every pixel of the image returns the index of the superpixel to which it belong.

VGhidini
  • 31
  • 3