<jupyter_start><jupyter_text>[View in Colaboratory](https://colab.research.google.com/github/Puneethnaik/tensorflow_tuts/blob/master/vgg_pretrained.ipynb)<jupyter_code>#notebook to test out vgg pretrained image classifier in tensorflow
#dependencies
from keras.preprocessing.image import img_to_array, load_img
from keras.preprocessing.image import img_to_array
from keras.applications.vgg16 import preprocess_input
from keras.applications.vgg16 import decode_predictions
from keras.applications.vgg16 import VGG16
model = VGG16()<jupyter_output><empty_output><jupyter_text><jupyter_code>from google.colab import files

uploaded = files.upload()

for fn in uploaded.keys():
  print('User uploaded file "{name}" with length {length} bytes'.format(
      name=fn, length=len(uploaded[fn])))
image = load_img('./IMG_20180726_115714756.jpg', target_size=(224, 224))
image = img_to_array(image)
image = image.reshape((1, image.shape[0], image.shape[1], image.shape[2]))
image = preprocess_input(image)
yhat = model.predict(image)
# convert the probabilities to class labels
label = decode_predictions(yhat)
# retrieve the most likely result, e.g. highest probability
label = label[0][0]
# print the classification
print('%s (%.2f%%)' % (label[1], label[2]*100))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12052877138413685, 'fraction_numerical': 0.034992223950233284, 'mean_word_length': 7.303225806451613, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '212522', 'license': 'MIT', 'n_tokens_mistral': 460, 'n_tokens_neox': 430, 'n_words': 95, 'path': 'vgg_pretrained.ipynb', 'repo_name': 'Puneethnaik/tensorflow_tuts', 'size': '1286'}