Closed sakaia closed 5 years ago
On Colab, I execute following script. image_data should be include on python package. Then following git clone command will be removed.
!pip install tensorwatch
!pip install lime
!git clone http://github.com/microsoft/tensorwatch
!cp -r tensorwatch/data ..
%matplotlib inline
from tensorwatch.saliency import saliency
from tensorwatch import image_utils, imagenet_utils, pytorch_utils
model = pytorch_utils.get_model('resnet50')
img = image_utils.open_image('../data/test_images/dogs.png', convert_mode='RGB')
image_utils.show_image(img)
probabilities = imagenet_utils.predict(model=model, images=[img])
imagenet_utils.probabilities2classes(probabilities, topk=5)
input_tensor = imagenet_utils.image2batch(img)
prediction_tensor = pytorch_utils.int2tensor(239)
results = saliency.get_image_saliency_results(model, img, input_tensor, prediction_tensor)
figure = saliency.get_image_saliency_plot(results)
Thanks for reporting the issue. We have modified setup.py to include the missing file and address other issues. So if you do
pip install tensorwatch --upgrade
then you should be good to go!
I also created Colab Notebook but for some reason it is erroring out in last step. This is not reproducible in my local box with either PyTorch 1.0 or 1.1 so its strange...
Thank you, It works fine for Colab. But I cannot comment on your local machine behavior.
I try to execute following cnn_pred_explain notebook on Colab. https://github.com/microsoft/tensorwatch/blob/master/notebooks/cnn_pred_explain.ipynb
But I failed to execute it, because following error appeared.
In my guess, python pip package misses json file inclusion.
Reference A Simple Guide for Python Packaging https://medium.com/small-things-about-python/lets-talk-about-python-packaging-6d84b81f1bb5