Last active
October 2, 2018 16:09
-
-
Save joeyism/ff57b94997e41b8da7bb2f315662479d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import tensorflow_hub as hub | |
import urllib | |
import numpy as np | |
from skimage import data, transform | |
module = hub.Module("https://tfhub.dev/google/imagenet/mobilenet_v2_140_224/classification/2") | |
height, width = hub.get_expected_image_size(module) | |
cat = data.chelsea() | |
cat = transform.resize(cat, (height, width)) | |
images = module(np.array([cat])) | |
with tf.Session() as sess: | |
sess.run(tf.global_variables_initializer()) | |
classes = sess.run(images) | |
np.argmax(classes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment