Skip to content

Instantly share code, notes, and snippets.

@mtambos
Created July 7, 2017 06:42
Show Gist options
  • Save mtambos/2dd9f242e9b1b2cdd3c2a25f3dce3e5f to your computer and use it in GitHub Desktop.
Save mtambos/2dd9f242e9b1b2cdd3c2a25f3dce3e5f to your computer and use it in GitHub Desktop.
comparison of input formats
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Populating the interactive namespace from numpy and matplotlib\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using TensorFlow backend.\n"
]
}
],
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
"%pylab inline\n",
"\n",
"import glob\n",
"from pathlib import Path\n",
"\n",
"import cv2\n",
"from keras import applications\n",
"from keras.applications.vgg16 import decode_predictions\n",
"from keras.preprocessing.image import array_to_img, img_to_array, load_img\n",
"from skimage.transform import resize\n",
"import seaborn as sns\n",
"\n",
"sns.set(style='ticks', context='poster')"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"cnn_model = applications.VGG16(input_shape=(224, 224, 3))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"img_nr = 8\n",
"img_fnames = glob.glob('/data/master_thesis/Flicker8k_Dataset/*.jpg')\n",
"img_fnames = np.random.choice(img_fnames, img_nr, replace=False)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment