DIGITS-CNN/cars/architecture-investigations/architecture.ipynb

314 lines
128 KiB
Plaintext
Raw Normal View History

2021-04-10 12:20:26 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
2021-04-12 16:06:52 +01:00
"id": "682fef9a",
2021-04-10 12:20:26 +01:00
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib as mpl\n",
"from matplotlib import pyplot as plt"
]
},
{
"cell_type": "markdown",
2021-04-12 16:06:52 +01:00
"id": "75cc3c1d",
2021-04-10 12:20:26 +01:00
"metadata": {},
"source": [
"# Dense Layers\n",
"\n",
"Exponential LR Decay: 0.98\n",
"\n",
"100 Epochs\n",
"\n",
"## Index\n",
"0. fc layers\n",
"1. nodes per layer\n",
"2. top-1 accuracy\n",
"3. top-5 accuracy\n",
"4. last val loss\n",
"5. last val accuracy"
]
},
{
"cell_type": "code",
"execution_count": 2,
2021-04-12 16:06:52 +01:00
"id": "85cb4e35",
2021-04-10 12:20:26 +01:00
"metadata": {},
"outputs": [],
"source": [
"fc_results = np.array([\n",
" [1, 256, 52.44, 79.86, 2.49, 57.66],\n",
2021-04-10 12:20:26 +01:00
" [1, 512, 49.29, 73.93, 2.95, 53.25],\n",
" [1, 1024, 40.7, 68.38, 3.66, 45.22],\n",
" [1, 2048, 32.12, 58.93, 4.66, 35.72],\n",
" [1, 4096, 24.03, 46.76, 5.61, 27.94],\n",
" [1, 8192, 19.70, 41.01, 6.42, 23.96],\n",
" \n",
" [2, 256, 54.48, 81.22, 1.86, 57.11],\n",
2021-04-10 12:20:26 +01:00
" [2, 512, 56.64, 82.46, 1.94, 60.23],\n",
" [2, 1024, 56.39, 81.53, 2.08, 60.91],\n",
" [2, 2048, 51.39, 79.00, 2.38, 56.74],\n",
" [2, 4096, 44.41, 71.83, 3.04, 47.61], # DEFAULT ALEXNET\n",
" [2, 8192, 37.74, 64.36, 3.60, 42.40],\n",
" \n",
" [3, 256, 0.8, 2.1, 5.29, 0.55],\n",
2021-04-10 12:20:26 +01:00
" [3, 512, 30.7, 65.16, 2.57, 30.82],\n",
" [3, 1024, 48.36, 76.65, 2.30, 49.88],\n",
" [3, 2048, 54.11, 80.48, 2.38, 58.21],\n",
" [3, 4096, 54.48, 82.09, 2.39, 57.17],\n",
" [3, 8192, 50.71, 78.57, 2.55, 55.88],\n",
" \n",
" [4, 256, 0.8, 2.29, 5.29, 0.55],\n",
2021-04-10 12:20:26 +01:00
" [4, 512, 0.8, 2.1, 5.29, 0.55],\n",
" [4, 1024, 0.8, 2.1, 5.29, 0.55],\n",
" [4, 2048, 25.45, 60.9, 2.84, 28.55],\n",
" [4, 4096, 41.14, 73.81, 2.81, 46.32],\n",
" [4, 8192, 49.85, 77.58, 2.97, 53.92]\n",
"])\n",
"\n",
"fc_0_results = [0, 196, 28.91, 54.05, 6.52, 33.21]\n",
"\n",
"layers = [1, 2, 3, 4]\n",
"nodes = [256, 512, 1024, 2048, 4096, 8192]\n",
2021-04-10 12:20:26 +01:00
"\n",
"fc_matrix = np.zeros((len(layers), len(nodes)))\n",
2021-04-10 12:20:26 +01:00
"for i in fc_results:\n",
" fc_matrix[layers.index(i[0]), nodes.index(i[1])] = i[2]"
]
},
{
"cell_type": "code",
"execution_count": 9,
2021-04-12 16:06:52 +01:00
"id": "0fd9f416",
2021-04-10 12:20:26 +01:00
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAWUAAAEwCAYAAABvxmD/AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/Z1A+gAAAACXBIWXMAAAsTAAALEwEAmpwYAACwGElEQVR4nOydd3gc1dm377NVvViyZVm25CLJ6s2AgUAI1RQDocVAICT0BEJ5SYBAKCEJgZCQno8QakJCSQImhV5s04u6JcuWZMu2ZDWr121zvj92Z1lJW2bVbe99XXPZuzvlzGr2N8885ylCSkmIECFChJgf6OZ6ACFChAgR4gtC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/Voca3yV5z++Cack2jPT9zLmP3V4vR3f4Tz2sjH6Y5TeQdnKGSbEGLCk5xrIvIunNdTK84n1wvHr+eDw4FPhBCDOK+NG6WUOzVue8ChhpyEmCWEEHcDmVLKSwKuHGLStLa2mnDebM8SQiwxGo3RJpPpU+DB6Ojo6XAPHFAIIaJw3hQypJS75ng4IfxwIFnKBzwud8cVwKNzPZaDmdbW1mU4rbIzcfqo1dhtAfxgYGBg2RwOb9YQQpzpckNF4ox1rsZpGYeYx4REeZYQQlyFUyBelVIGEz0RQiOtra361tbWdThjaONxCpCdL3ypXTh9kT8YGBhYPhdjnGXOxjnBtg9nIsuFMvRoPO8JuS9CHBS0trYuwvkUkoVzRt+qfiaEKDEajeEmk0n1gcYDYThdGQetbzLEgUnIUg5xQNPa2qpraGg4ef/+/U/iDCfbhYcguxCMDdnqwRkKefvAwEDG7Iw0RAhthEQ
2021-04-10 12:20:26 +01:00
"text/plain": [
"<Figure size 432x288 with 2 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"X, Y = np.meshgrid(layers, nodes)\n",
"\n",
"# fig = plt.figure(figsize=(8, 5))\n",
"fig = plt.figure()\n",
"ax = plt.axes(projection='3d')\n",
"\n",
"surf = ax.plot_surface(X, Y, fc_matrix.T, cmap='viridis')\n",
"\n",
"ax.set_title('Accuracy with Different MLP Configurations')\n",
"ax.set_xlabel('Fully Connected Layers')\n",
"ax.set_ylabel('Nodes Per Layer')\n",
"ax.set_zlabel('Top-1 % Test Accuracy')\n",
"\n",
"ax.view_init(60, -130)\n",
2021-04-10 12:20:26 +01:00
"fig.colorbar(surf, shrink=0.3, aspect=6)\n",
"\n",
"plt.tight_layout()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 11,
2021-04-12 16:06:52 +01:00
"id": "dc9d04b1",
2021-04-10 12:20:26 +01:00
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEWCA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pXZC/aqTemqO/aqTemqO/aqrTF1AZtlFTZVuXoUCoWilaEMv0KhULQylOFXKBSKVoYy/AqFQtHKUIZfoVAoWhmt2/D//Q4crjCB9PA6rVyhUChaKK3b8IcPgG+nnjX+h9dp2+ED6l6XakQUCkUzoVlM4Go0Og6DaxfC0skQ1g+St8J5t0FuKuz9FVw8wNlD++viDi6e4OwOTq4gRPm6ShuR6xZp26WNSOm2QqFQ2Amt2/AX5sKWz6EoF478rZVtmFv7ecJRbww8tIagdN23PXw5kYFuEbAhDa7/UmtcFAqFwo5ovYY/7QB8fROc3qMZ7+i7IH4RXPkWhERBcR4UVViK87VGoihf366wn0Jw9cIr95B2jT+fhwvug8irwbH13mqFQmFftE5rlPgTrLhbc9e4esENX2lP5p1HnnXP1OdJXXfvHG07kfanfoPcU/Dd7fDnizD4Lhhwi3Y9hUKhsCGtq3PXVAJ/PKc96Qd1g/PvOGv0Qft73SJI3lL3ui18+oc73wKTl0FJIYz8H/i2hd+fhrcjYfWzkG1tfnGFQqFoeFrPE39uKiyfBkfWw3nTYPRrWidtRToOq9/TfvKWs28KR2PLNyK3/QLJ8fDvXNgwDzZ+AL2ugSH3QWjfc/xgCoVCUTdapuH/+x1tlE2pAT8eB0uuh8IzcPV86De54a859MHKZZaNSPhAuG4hZB6FTfO1TuWd32j7hzwAXS6pPFJIYXP+zP4T9xR3BoUOKiuLS4ljV/oupkVNs6EyhaL+tExXT+nQykN/waaPYcFoMGbBmLcax+jXBb/2MPpVeGg3XPqS1sn81bXwwWCtMSg
2021-04-10 12:20:26 +01:00
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"# plt.plot([196], fc_0_results[2], 'x-', label=f'0 Layers')\n",
"\n",
"for i in layers:\n",
" plt.plot(nodes, fc_matrix[i-1, :], 'x-', label=f'{i} Layers')\n",
"\n",
"plt.annotate('Standard\\nAlexNet', \n",
" (4096, fc_matrix[layers.index(2), nodes.index(4096)]),\n",
" textcoords=\"offset points\",\n",
" xytext=(40, 10),\n",
" ha='center',\n",
" arrowprops={'arrowstyle': 'simple'}\n",
2021-04-10 12:20:26 +01:00
" )\n",
" \n",
"plt.title('Accuracy for Varied Dense Layers')\n",
"plt.xlabel('Nodes Per Layer')\n",
"plt.ylabel('Top-1 % Test Accuracy')\n",
"\n",
"plt.grid()\n",
"plt.legend()\n",
"plt.show()"
]
2021-04-12 16:06:52 +01:00
},
{
"cell_type": "markdown",
"id": "340c4eb8",
"metadata": {},
"source": [
"# Convolutional Non-Linearity\n",
"\n",
"Exponential LR Decay: 0.98\n",
"\n",
"100 Epochs\n",
"\n",
"Taking conovlutional layers and distributing the standard number of filters into separate conv layers with ReLu nonlinearity\n",
"\n",
"## Index\n",
"0. convolutional layer\n",
"1. number of divisions\n",
"2. top-1 accuracy\n",
"3. top-5 accuracy\n",
"4. last val loss\n",
"5. last val accuracy"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "3426107c",
"metadata": {},
"outputs": [],
"source": [
"conv_nonlin_results = np.array([\n",
"# [1, 1, 44.41, 71.83, 3.04, 47.61], # STANDARD ALEXNET\n",
"# [1, 2],\n",
"# [1, 4],\n",
" \n",
" [4, 1, 44.41, 71.83, 3.04, 47.61], # STANDARD ALEXNET\n",
" [4, 2, 42.31, 71.96, 3.07, 49.75],\n",
" [4, 4, 0.8, 2.47, 5.29, 0.55],\n",
" \n",
" [5, 1, 44.41, 71.83, 3.04, 47.61], # STANDARD ALEXNET\n",
" [5, 2, 46.08, 73.87, 3.00, 49.20],\n",
" [5, 4, 0.8, 2.47, 5.29, 0.55]\n",
"])\n",
"\n",
"nonlin_layers = [4, 5]\n",
"nonlin_div = [1, 2, 4]\n",
"\n",
"conv_nonlin_matrix = np.zeros((len(nonlin_layers), len(nonlin_div)))\n",
"for i in conv_nonlin_results:\n",
" conv_nonlin_matrix[nonlin_layers.index(i[0]), nonlin_div.index(i[1])] = i[2]"
]
},
{
"cell_type": "code",
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ZWPfsXWPV3YCXhjlj1333tcVl5F+sumRPAGqxTT0f9seqG/8Sqq3w8bYSxLrIuAKqQg38oY93H3wHrCOck1j9lB4cqL2eX8zcQC5QAFjmMehrraDIO64c2JyfLxaoX3QmssU+5f8A6EsMYsxTrO1tmT7MsmxjnY223IVhHm0eBV4Ev7Uk+xToKWwnswboz45EcxLoI6+LoEWNd2E6Tk+W+gHUGeRorgV7egRhjLmDfSWJXTzRPV768bMtpWNUvB7HuTFvjxDwZMsbswSpvCYfBrwLrgM3A71gXj/PyQFh5rMTs+MrszDszmf5vkf1vMTvLsG6ZPiIijt//51hnPp/b29Nj5MoZqSrMRORFoKYxpl+2EyulPEJEdgEPGmN+8GQc7npwSLmQfTp6P9ZZgVKqABKRblj1/1menbqDVvUUciLyANaFy6XGmJWejkcpdS0RWYF1s8ND9jUGj9KqHqWUKmL0iF8ppYqYQlHHHxkZaSpXrpyrec+fP0+JEiWyn7AQ8JayeEs5QMtSUHlLWfJajvXr158wxkSlH14oEn/lypVZt25druZdsWIFrVu3zt+APMRbyuIt5QAtS0HlLWXJazlEJMMn2rWqRymlihhN/EopVcRo4ldKqSKmUNTxK6WKruTkZA4cOEBCQkL2E9vCwsLYtm2bC6NyD2fLERQURIUKFfD393dquZr4lVIF2oEDBwgJCaFy5co42xZbXFwcISGFvydIZ8phjOHkyZMcOHCAKlWqOLVcrepR7vHzu7An3YPFe1Zaw5XKQkJCAhEREU4n/aJGRIiIiMjRGZEmfuUe5RvBvEFXkv+eldbn8o08GZUqJDTpZy2n349W9SjXSLkECWfh4im4eBqSLkDDATCzF/WCa8Av+6D
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"for idx, i in enumerate(nonlin_layers):\n",
" plt.plot(nonlin_div, conv_nonlin_matrix[idx, :], 'x-', label=f'Layer {i}')\n",
"\n",
"plt.title('Accuracy for Varied Convolutional Non-Linearity')\n",
"plt.xlabel('Layer Divisor')\n",
"plt.ylabel('Top-1 % Test Accuracy')\n",
"\n",
"plt.grid()\n",
"plt.legend()\n",
"plt.show()"
]
2021-04-25 19:56:49 +01:00
},
{
"source": [
"# Convolutional Kernel Size\n",
"\n",
"Exponential LR Decay: 0.98\n",
"\n",
"100 Epochs\n",
"\n",
"## Index\n",
"0. convolutional layer\n",
"1. kernel size\n",
"2. top-1 accuracy\n",
"3. top-5 accuracy\n",
"4. last val loss\n",
"5. last val accuracy"
],
"cell_type": "markdown",
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"kernel_results = np.array([\n",
" [1, 3, 37.06, 64.73, 3.38, 44.36],\n",
" [1, 7, 44.72, 71.16, 3.00, 48.96],\n",
" [1, 11, 44.41, 71.83, 3.04, 47.61], # DEFAULT ALEXNET\n",
" [1, 15, 43.17, 71.59, 3.09, 47.55],\n",
"\n",
" [2, 3, 41.63, 67.63, 3.24, 45.53],\n",
" [2, 5, 44.41, 71.83, 3.04, 47.61], # DEFAULT ALEXNET\n",
" [2, 7, 45.15, 72.21, 2.97, 50.49],\n",
" [2, 9, 43.61, 71.34, 3.10, 47.37],\n",
" [2, 11, 39.35, 65.6, 3.36, 44.98],\n",
"\n",
" [3, 3, 44.41, 71.83, 3.04, 47.61], # DEFAULT ALEXNET\n",
" [3, 5],\n",
" [3, 7],\n",
" [3, 9],\n",
" [3, 11],\n",
"])"
]
2021-04-10 12:20:26 +01:00
}
],
"metadata": {
"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.9.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
2021-04-21 23:43:46 +01:00
}