I am trying to apply shap Explainable AI on my custom dataset while using the pytorch in my python code. I found this tutorial on the shap website: https://shap.readthedocs.io/en/latest/example_notebooks/image_examples/image_classification/Explain%20MobilenetV2%20using%20the%20Partition%20explainer%20%28PyTorch%29.html
how i can use the same code but by apply it on my custom dataset that uploaded on google drive.
in this part:
model = torchvision.models.mobilenet_v2(pretrained=True, progress=False)
model.to(device)
model.eval()
X, y = shap.datasets.imagenet50()
they take the X, y from imagenet50 dataset i want to replace it with the images and labels of my datatset. what is the shape and dimentions should be?
also in this part:
# Getting ImageNet 1000 class names
url = "https://s3.amazonaws.com/deep-learning-models/image-models/imagenet_class_index.json"
with open(shap.datasets.cache(url)) as file:
class_names = [v[1] for v in json.load(file).values()]
print("Number of ImageNet classes:", len(class_names))
#print("Class names:", class_names)
they downloaded the classes names from jason file i dont neet this step because the classes of my project are binary [yes,no]
anyone can help please?
I tried to insert the dataset as imagefolders, but no results found. then tried to insert the images as tensors, no results. finally tried to insert images as nparray, and also no results.