I want to use the Lime library to evaluate an image for explainability.
I have these lines of code;
iter = 3500
top_labels = 5
num_super_pixels = 10
fasterrcnn_model.eval()
explainer = lime_image.LimeImageExplainer()
explanation = explainer.explain_instance(img, fasterrcnn_model, top_labels = top_labels, hide_color = 0, num_samples = iter)
It seems line where I execute the explain_instance method, it does not like the image being a tensor.
When I convert it from a PILImage to a nump array, I have a problem because I need this image to have a dim attribute, which it does not have.
def get_image(file):
path = os.path.join(Constants.dir_individual_image, file)
p_img = PILImage.open(path)
img = np.array(p_img)
t_img = transform_img(img)
return t_img, img, path
I am wondering if I can use LIME for object detection and Pytorch?