Skip to content

Commit

Permalink
fix bug getting imagenet data (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudvl authored May 2, 2019
1 parent 75aba9b commit 339cd3e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions alibi/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def imagenet(category: str = 'Persian cat', nb_images: int = 10, target_size: tu
image = np.asarray(bytearray(resp.read()), dtype="uint8")
resp.close()
image = cv2.imdecode(image, cv2.IMREAD_COLOR)
if image is None:
continue
image = np.expand_dims(cv2.resize(image, target_size), axis=0)
if np.std(image) < min_std: # do not include empty images
continue
Expand Down
15 changes: 8 additions & 7 deletions examples/anchor_image_imagenet.ipynb

Large diffs are not rendered by default.

0 comments on commit 339cd3e

Please sign in to comment.