alibi icon indicating copy to clipboard operation
alibi copied to clipboard

i run alibi example anchor_image_imagenet.ipynb and it failed

Open heimao63531 opened this issue 5 years ago • 4 comments

data, labels = fetch_imagenet(category, nb_images=10, target_size=image_shape[:2], seed=2, return_X_y=True) <-- failed in this line. Imagenet API down Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/alibi/datasets.py", line 98, in fetch_imagenet page.raise_for_status() File "/usr/local/lib/python3.7/dist-packages/requests/models.py", line 941, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://www.image-net.org/api/text/imagenet.synset.geturls?wnid=n02123394

HTTPError Traceback (most recent call last) in () 1 category = 'Persian cat' 2 image_shape = (224, 224, 3) ----> 3 data, labels = fetch_imagenet(category, nb_images=3, target_size=image_shape[:2], seed=2, return_X_y=True) 4 print(f'Images shape: {data.shape}') 5 data = (data / 255).astype('float32') 1 frames /usr/local/lib/python3.7/dist-packages/requests/models.py in raise_for_status(self) 939 940 if http_error_msg: --> 941 raise HTTPError(http_error_msg, response=self) 942 943 def close(self): HTTPError: 404 Client Error: Not Found for url: http://www.image-net.org/api/text/imagenet.synset.geturls?wnid=n02123394

heimao63531 avatar Mar 17 '21 12:03 heimao63531

This is because the Imagenet API has been discontinued. We have submitted a PR (#365) which replaces this with a small sample of images for use in examples which should be merged very soon. In the meantime, I would suggest testing the example with some custom images (cropped to resolution (299, 299)) for the Anchor example.

jklaise avatar Mar 17 '21 13:03 jklaise

We've merged the PR that fixes this, if you install Alibi from the latest master then the examples are up to date.

jklaise avatar Mar 18 '21 18:03 jklaise

have you update the alibi package ? i tried and falled with following error.

ImportError Traceback (most recent call last) in () 4 from alibi.explainers import IntegratedGradients 5 from tensorflow.keras.applications.resnet_v2 import ResNet50V2 ----> 6 from alibi.datasets import load_cats 7 from alibi.utils.visualization import visualize_image_attr 8 print('TF version: ', tf.version)

ImportError: cannot import name 'load_cats' from 'alibi.datasets' (/usr/local/lib/python3.7/dist-packages/alibi/datasets.py)


NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the "Open Examples" button below.

heimao63531 avatar Mar 19 '21 02:03 heimao63531

@heimao63531 you need to install the development version of alibi using pip install git+https://github.com/SeldonIO/alibi.git we will release a new version likely next week.

jklaise avatar Mar 19 '21 11:03 jklaise