added benchmark notebooks

This commit is contained in:
H.T. Kruitbosch 2018-01-18 09:41:18 +01:00
parent 29a55be2ff
commit fa4c4c57f0
3 changed files with 730 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,188 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"import matplotlib\n",
"%matplotlib inline\n",
"matplotlib.rcParams['figure.figsize'] = (20, 10)\n",
"matplotlib.rcParams['font.size'] = 24\n",
"matplotlib.rcParams['lines.linewidth'] = 5\n",
"matplotlib.rcParams['lines.markersize'] = 20\n",
"\n",
"import tensorflow as tf\n",
"from tensorflow.python.client import device_lib\n",
"\n",
"import time\n",
"import numpy as np\n",
"from matplotlib import pyplot\n",
"from collections import defaultdict\n",
"from ipy_table import make_table, set_row_style, set_column_style\n",
"from jupyter_progressbar import ProgressBar\n",
"\n",
"from sklearn.preprocessing import LabelEncoder\n",
"from sklearn.model_selection import train_test_split\n",
"from keras.models import Sequential\n",
"from keras.layers import Activation\n",
"from keras.optimizers import SGD, Adam\n",
"from keras.layers import Dense, Dropout, Flatten\n",
"from keras.regularizers import l1, l2\n",
"from keras import regularizers\n",
"import numpy\n",
"import pickle\n",
"import tensorflow as tf"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"border:black; border-collapse:collapse;\"><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\"><b>name</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\"><b>type</b></td></tr><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">/device:CPU:0</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">CPU</td></tr><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">/device:GPU:0</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">GPU</td></tr></table>"
],
"text/plain": [
"<ipy_table.ipy_table.IpyTable at 0x7f8d84227cc0>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"devices = device_lib.list_local_devices()\n",
"\n",
"make_table([[\"name\", \"type\"]] + [\n",
" [device.name, device.device_type]\n",
" for device in devices\n",
"])\n",
"set_row_style(0, bold=True)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"6250/6250 [==============================] - 1s 167us/step\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\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\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n"
]
}
],
"source": [
"results = defaultdict(dict)\n",
"\n",
"for device in devices:\n",
" with tf.device(device.name):\n",
" with open(\"CatsAndDogs.pickle\", 'rb') as f:\n",
" data = pickle.load(f)\n",
"\n",
" X = data[\"dataset\"]\n",
" y = data[\"labels\"]\n",
" del data\n",
"\n",
" (X_train, X_test, y_train, y_test) = train_test_split(\n",
" X, y, test_size = 0.25, random_state = 42)\n",
"\n",
" model = Sequential()\n",
" model.add(Flatten(input_shape=X_train.shape[1:]))\n",
"\n",
" model.add(Dense(768, kernel_initializer=\"uniform\", activation=\"relu\"))\n",
" model.add(Dropout(0.2))\n",
"\n",
" model.add(Dense(384, kernel_initializer=\"uniform\", activation=\"relu\"))\n",
" model.add(Dropout(0.2))\n",
"\n",
" model.add(Dense(128, kernel_initializer=\"uniform\", activation=\"relu\"))\n",
" model.add(Dropout(0.2))\n",
"\n",
" model.add(Dense(2, activation=\"softmax\"))\n",
"\n",
" model.compile(loss=\"binary_crossentropy\", optimizer=Adam(lr=0.001), metrics=[\"accuracy\"])\n",
" \n",
" t0 = time.time()\n",
" model.fit(X_train, y_train, validation_split=0.25, epochs=5, batch_size=128, verbose=0)\n",
" t1 = time.time()\n",
" (loss, accuracy) = model.evaluate(X_test, y_test, verbose=0)\n",
" t2 = time.time()\n",
" \n",
" results[device.name]['training'] = t1 - t0\n",
" results[device.name]['evaluating'] = t2 - t1"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"border:black; border-collapse:collapse;\"><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>device</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>execution&nbsp;time&nbsp;(s)&nbsp;training</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>execution&nbsp;time&nbsp;(s)&nbsp;evaluating</b></td></tr><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>/device:GPU:0</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">8.3381</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">0.3781</td></tr><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>/device:CPU:0</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">38.5678</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">1.0451</td></tr></table>"
],
"text/plain": [
"<ipy_table.ipy_table.IpyTable at 0x7f8d7faa7b00>"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"make_table([[\"device\", \"execution time (s) training\", \"execution time (s) evaluating\"]] + [\n",
" [device, result['training'], result['evaluating']]\n",
" for device, result in results.items()\n",
"])\n",
"set_column_style(0, bold=True, align='right')\n",
"set_row_style(0, bold=True, align='right')"
]
}
],
"metadata": {
"hide_input": false,
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View File

@ -0,0 +1,256 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using TensorFlow backend.\n"
]
}
],
"source": [
"import os.path\n",
"import pickle\n",
"\n",
"from sklearn.model_selection import train_test_split\n",
"from sklearn.linear_model import LogisticRegression\n",
"from sklearn.metrics import classification_report\n",
"\n",
"from jupyter_progressbar import ProgressBar\n",
"import numpy as np\n",
"\n",
"from keras.models import Sequential\n",
"from keras.layers import Dense, Flatten, GlobalAveragePooling2D\n",
"from keras.optimizers import SGD\n",
"from keras import backend as K\n",
"from keras.applications.inception_v3 import preprocess_input as preprocess, InceptionV3\n",
"\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"%matplotlib inline\n",
"matplotlib.rcParams['figure.figsize'] = (20, 10)\n",
"matplotlib.rcParams['font.size'] = 24\n",
"matplotlib.rcParams['lines.linewidth'] = 5\n",
"matplotlib.rcParams['lines.markersize'] = 20\n",
"\n",
"import tensorflow as tf\n",
"from tensorflow.python.client import device_lib\n",
"\n",
"import time\n",
"from matplotlib import pyplot\n",
"from collections import defaultdict\n",
"from ipy_table import make_table, set_row_style, set_column_style\n",
"from jupyter_progressbar import ProgressBar\n",
"\n",
"# Disable progressbar VGG-batches\n",
"ProgressBar = lambda x: x"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"border:black; border-collapse:collapse;\"><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\"><b>name</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\"><b>type</b></td></tr><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">/device:CPU:0</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">CPU</td></tr><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">/device:GPU:0</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">GPU</td></tr></table>"
],
"text/plain": [
"<ipy_table.ipy_table.IpyTable at 0x7fc8a18d95f8>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"devices = device_lib.list_local_devices()\n",
"\n",
"make_table([[\"name\", \"type\"]] + [\n",
" [device.name, device.device_type]\n",
" for device in devices\n",
"])\n",
"set_row_style(0, bold=True)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"with open('creepycrawly_and_cats.p3', 'rb') as f:\n",
" X, y = pickle.load(f)\n",
"classes = ['creepy crawly', 'cat']"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"import numpy\n",
"from skimage.transform import resize\n",
"\n",
"def resize_for_model(X, model):\n",
" target = tuple([x.value for x in model.input.get_shape()][1:3])\n",
" if target[0] is None or target[1] is None:\n",
" return X\n",
" result = numpy.zeros((X.shape[0], target[0], target[1], X.shape[3]), dtype=X.dtype)\n",
" \n",
" for i in range(X.shape[0]):\n",
" result[i] = resize(X[i], target + (X.shape[3], ))\n",
" return result"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [],
"source": [
"results = defaultdict(dict)\n",
"for device in devices:\n",
" from keras.applications.inception_v3 import InceptionV3, preprocess_input, decode_predictions\n",
" \n",
" with tf.device(device.name):\n",
" model = InceptionV3(weights='imagenet')\n",
" X_ = preprocess_input(resize_for_model(X, model))\n",
" t0 = time.time()\n",
" preds = model.predict(X_, verbose=0)\n",
" t1 = time.time()\n",
" \n",
" results[device.name]['inceptionv3'] = t1 - t0\n",
" K.clear_session()\n",
" \n",
" from keras.applications.resnet50 import ResNet50, preprocess_input, decode_predictions\n",
" with tf.device(device.name):\n",
" model = ResNet50(weights='imagenet')\n",
" X_ = preprocess_input(resize_for_model(X, model))\n",
" t0 = time.time()\n",
" preds = model.predict(X_, verbose=0)\n",
" t1 = time.time()\n",
" \n",
" results[device.name]['resnet50'] = t1 - t0\n",
" K.clear_session()\n",
"\n",
" vgg_batch_size = 2\n",
" \n",
" from keras.applications.vgg16 import VGG16, preprocess_input, decode_predictions\n",
" with tf.device(device.name):\n",
" model = VGG16(weights='imagenet', include_top=True)\n",
" X_ = preprocess_input(resize_for_model(X, model))\n",
" t0 = time.time()\n",
" for start, end in zip(\n",
" range(0, len(X), vgg_batch_size),\n",
" ProgressBar(range(vgg_batch_size, len(X), vgg_batch_size))\n",
" ):\n",
" model.predict(X_[start:end], verbose=0)\n",
" t1 = time.time()\n",
" \n",
" results[device.name]['vgg16'] = t1 - t0\n",
" K.clear_session()\n",
" \n",
" from keras.applications.vgg19 import VGG19, preprocess_input, decode_predictions\n",
" \n",
" with tf.device(device.name):\n",
" model = VGG19(weights='imagenet', include_top=True)\n",
" X_ = preprocess_input(resize_for_model(X, model))\n",
" t0 = time.time()\n",
" for start, end in zip(\n",
" range(0, len(X), vgg_batch_size),\n",
" ProgressBar(range(vgg_batch_size, len(X), vgg_batch_size))\n",
" ):\n",
" model.predict(X_[start:end], verbose=0)\n",
" t1 = time.time()\n",
" \n",
" results[device.name]['vgg19'] = t1 - t0\n",
" K.clear_session()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false,
"deletable": true,
"editable": true
},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"border:black; border-collapse:collapse;\"><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>device</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>resnet50</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>vgg19</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>inceptionv3</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>vgg16</b></td></tr><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>/device:GPU:0</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">59.2201</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">156.9875</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">15.0459</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">129.3934</td></tr><tr><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;text-align:right;\"><b>/device:CPU:0</b></td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">605.1631</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">1857.0126</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">89.1597</td><td style=\"border-left: 1px solid;border-right: 1px solid;border-top: 1px solid;border-bottom: 1px solid;\">1445.7997</td></tr></table>"
],
"text/plain": [
"<ipy_table.ipy_table.IpyTable at 0x7fc88813c860>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model_names = list(next(iter(results.values())).keys())\n",
"\n",
"make_table([[\"device\"] + model_names] + [\n",
" [device] + [result[model_name] for model_name in model_names]\n",
" for device, result in results.items()\n",
"])\n",
"set_column_style(0, bold=True, align='right')\n",
"set_row_style(0, bold=True, align='right')"
]
}
],
"metadata": {
"hide_input": false,
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}