fastbook/clean/02_production.ipynb

1095 lines
1.3 MiB
Plaintext
Raw Normal View History

2020-03-06 18:19:03 +00:00
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#hide\n",
"from utils import *\n",
"from fastai2.vision.widgets import *"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"# From Model to Production"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"## The Practice of Deep Learning"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"### Starting Your Project"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"### The State of Deep Learning"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Computer vision"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Text (natural language processing)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Combining text and images"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Tabular data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Recommendation systems"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"#### Other data types"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"### The Drivetrain Approach"
2020-03-06 18:19:03 +00:00
]
},
2020-03-24 18:18:16 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"## Gathering Data"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To download images with Bing Image Search, sign up at Microsoft for a free account. You will be given a key, which you can copy and enter in a cell as follows (replacing 'XXX' with your key and executing it):"
2020-03-24 18:18:16 +00:00
]
},
2020-03-06 18:19:03 +00:00
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"key = 'XXX'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<function utils.search_images_bing(key, term, min_sz=128)>"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"search_images_bing"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"150"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"results = search_images_bing(key, 'grizzly bear')\n",
"ims = results.attrgot('content_url')\n",
"len(ims)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [],
"source": [
"#hide\n",
"ims = ['http://3.bp.blogspot.com/-S1scRCkI3vY/UHzV2kucsPI/AAAAAAAAA-k/YQ5UzHEm9Ss/s1600/Grizzly%2BBear%2BWildlife.jpg']"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dest = 'images/grizzly.jpg'\n",
"download_url(ims[0], dest)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAG0AAACACAIAAACOQHBdAAAAZGVYSWZJSSoACAAAAAMAMQECAAcAAAAyAAAAEgIDAAIAAAACAAIAaYcEAAEAAAA6AAAAAAAAAEdvb2dsZQAAAwAAkAcABAAAADAyMjACoAQAAQAAAE4DAAADoAQAAQAAAOgDAAAAAAAAoiUjmgAAb2NJREFUeJws/deuJluSJoiZ2VIuf7VF7B0RJ45MnVVZiuxmzwAzQ/CKHPBV+BB8GF4SBIa84QAkMcR0D7uquqpSVGYeFXqrX7tcyowXUYDDAQf8Zrnbss/ss2+Z4f/5//J/Ulpt7HpO86rZQErvuvfMbKxpXf2bV/9+198/nu93w1YpXbuWgBTpOYx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5PAv/w3f+7n57G5FNiwnJRXJ/9yWhb2uow7n9589e/f/+fEdTKLffT7i9f/Lv9+cN23DVuOc1PQSIwZ8khBquMUVYHEIWgFFmAAJ5Fa1VQ7JpyEZM/zSdrqykNBhVn0WTLorCqIFKVru+7165YrN1VzL6tVtaUJKytHSNPaYqQBJlQzXGfMNVmUav6RdVcFJdXF99U7bUrquSP8+H9dNg/vv1w2m4nPz3e75qLzWdfvajb1TzIZ79szqdBcsopnrcfugk/vNlbOfsprKpyXlRz4PNcXSyXL75szlNYFHB7ey1pWl4tMsn2cez3U9HUuqznzmxeRaWz9sPPbr9E0r/74X8+jPdKQ1UsQXLOvKoufJpb0xZAKafr9vLD+f1Pr35qJDz096A
"text/plain": [
"<PIL.Image.Image image mode=RGB size=109x128 at 0x7F78BCDD5390>"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"im = Image.open(dest)\n",
"im.to_thumb(128,128)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"bear_types = 'grizzly','black','teddy'\n",
"path = Path('bears')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"if not path.exists():\n",
" path.mkdir()\n",
" for o in bear_types:\n",
" dest = (path/o)\n",
" dest.mkdir(exist_ok=True)\n",
" results = search_images_bing(key, f'{o} bear')\n",
" download_images(dest, urls=results.attrgot('content_url'))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(#421) [Path('bears/black/00000095.jpg'),Path('bears/black/00000133.jpg'),Path('bears/black/00000062.jpg'),Path('bears/black/00000023.jpg'),Path('bears/black/00000029.jpg'),Path('bears/black/00000094.jpg'),Path('bears/black/00000124.jpg'),Path('bears/black/00000056.jpeg'),Path('bears/black/00000046.jpg'),Path('bears/black/00000045.jpg')...]"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fns = get_image_files(path)\n",
"fns"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"(#0) []"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"failed = verify_images(fns)\n",
"failed"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"failed.map(Path.unlink);"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"### Sidebar: Getting Help in Jupyter Notebooks"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### End sidebar"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"## From Data to DataLoaders"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"bears = DataBlock(\n",
" blocks=(ImageBlock, CategoryBlock), \n",
" get_items=get_image_files, \n",
2020-05-14 12:18:31 +00:00
" splitter=RandomSplitter(valid_pct=0.2, seed=42),\n",
2020-03-06 18:19:03 +00:00
" get_y=parent_label,\n",
" item_tfms=Resize(128))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dls = bears.dataloaders(path)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAqwAAACvCAYAAAA4yYy3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nOy9aextWXre9XvXsPc+5/ynO9TQ1WPcCXYaASKxiSUciEQQAmECUSA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aFZyGSmD6gWQpdSnLZGiUDLMyEVzEw2zcnDaiZLWsjD9Acg1wdg+dxEsARBCElRyXByDoXs5Xk/ZEVyPSathPGE8GUUjROpn0gpiJQblrPMhDsnRVGMUYxCNpCTlCdrPcNciarmShpTIlXCbUQw1pZzqOR4+qP1MxlQzTNpzzljjCFVUT3HOJNYgJRzIS4yHYGUO6KVFKuQskz/JANJMzGW/VljsM5h57tsSFHJTPfxvYUx5XKmnEGm6wbWlnsW6/nHeDw+q2WggxEQQ06JEAKmknyDluviFG9c/cG78h3KgMeY8p2cRmIO5NqGcp3LKP+q909MvT9lcFSO25a9iEEM82CAOlgxdZ/WOaxYrDGYeiwA4jzOWHKKoBnR8tua2n5WRcRizERYyzWK9fcWcyKJkkTJKAklqmLqADWkBOOAimKsw9Pgki8XfL72hrZpOc8JkzPDRPABpwan9ZysYtWSNRFCRGvbtGS8M1hraZsWNtA2DcMw1mtgMGLr712O51b7kJgz5admUMAZQxYhT9cYARGss6ysI1B+s76Sbucc5FwG4wsWLHhHSBr
"text/plain": [
"<Figure size 864x216 with 4 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
2020-03-19 13:21:55 +00:00
"dls.valid.show_batch(max_n=4, nrows=1)"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAqwAAACvCAYAAAA4yYy3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nOy9aexuWXbe9Vt7OOe873+699bQXV3uwbaCB4kpyMFCBiIGIRAmYAWSQKxEQfAFFCwRiASJAjjAFxIhEAIki+DYcWIgCcghIAWCMSEIJ45xcJCsyOl2d9fUVXXvf3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WLdRyWHYfn3TCLnh762h5KW+mCvRBNyIw1CoZSZIAqqlUyWAqZtyxi7HGMpmZKVIgYzj4ACWSvhKo28QqI9rxpZvUdwc33ozWRMpJKaUgRyrsSC069fikBRxJi6D/QewazfLwVyUsRUQl2K0E69nlMulJQo1uKcRQvkRsSLVvJUryWEnCGlZfs5Z1BpByTkUgluzLmRdVARnIBOmaIZUHIy5GyX+yECikVTQRXyPVJeFwoGQVDNIBEt9b4xXw0jyzGCIPNG27UqRcnv06PXOYexFi26PP1zyZRG1AGsEYqCthufUyLlREyZUgrWe6x3SLvzRTNaHNZajICgIOW02DKGGCMpJQRwYsAYROoiAyCK4JLFOMFbj7EeK4W24iHGI6UkSjtuEYOIXX4/IgYxFozBWLv8sa7+lK11WOtwzmNdhzUGzQlpN65owZRSt1mELJmQK0kGyCgZpRQlpMRhmui7wLarx+/Ug1RifN5vIBesWNz86zAGazMhZWIIYME7x3aokzc
"text/plain": [
"<Figure size 864x216 with 4 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"bears = bears.new(item_tfms=Resize(128, ResizeMethod.Squish))\n",
"dls = bears.dataloaders(path)\n",
2020-03-19 13:21:55 +00:00
"dls.valid.show_batch(max_n=4, nrows=1)"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAqwAAACvCAYAAAA4yYy3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nOy9a6wt2Xbf9RvzUVVrrb33Oacft+/Ldnzt2NgSIIxM8sHEkQyCRDYhUUISiEkEAj4QgSUeliBReATxiQiBECBFCsbGiQkhIAeTKAQZJwQlIZggI2KCE7/u7e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uZxWXIDLnTMwzisVYgxEhzoEoJWA23pFjJMZECIFpfMz23sfpfDl/zZF8fEyaJ2IOaM5sb17BbB9A19XrHRDxtLi10fjq0zSsja85TcPa+KjSNKxnVlP/nAi3b3B48+eZbz+P5lL0JGTEgBMt8tOc8ICaEhAGucekljlmQkqYrHgNUPfPqqBatadCVqny2CV9qeXnlKpuVshIXTAAjGYUAZHyPwaMBSkBp6RMFCU5DzhEBMn5vJSrCMYasBbU0PdXGGfpbTn/jczEeSaRqxJBwPeY4T7u6gEA/dUr+OEBxro1M/wh0jSsjY8cTcPaaDQaja8Y1UQ4vcHhrV9gfPImVk93wmvRhMkzXjI2jRi1nOzLAIwIc5zJUqfxs5Yp/1yLpmrxlohBVdBsKLHkeaq/TPeXbWCp46qa1WzIKuRLt0YR8lJ0hSBGsTGQJQGCiiXGqsFVxTkHOZOrx2vOyuTLUq/Z3tJpRK0hZ0EVNB3QcY8/lSxzONyyudnT37yK6674gGPGRuO
"text/plain": [
"<Figure size 864x216 with 4 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"bears = bears.new(item_tfms=Resize(128, ResizeMethod.Pad, pad_mode='zeros'))\n",
"dls = bears.dataloaders(path)\n",
2020-03-19 13:21:55 +00:00
"dls.valid.show_batch(max_n=4, nrows=1)"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAqwAAACvCAYAAAA4yYy3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nOy92bM9WXbf9Vlr751nuMNvqEFVXdXdUre6pW7LsoQRSKaNjWXZBFjYQYAJjBUQRPDECw/AA+BgjOBP4IUgwsgoCI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ikmB5pBKLWAZsYzVjJiRh5HDuAegjCP9zTVX9x9gYU2OG2pYE2KkW7t9FzNKztzcXJOiooBqmB2LMWf6/kAtRpBINT9ejc22JSBm6DhSa8EIdOsV27QBYLNdk8iUsSd1CU2RXCul90nfug4NilFAjFoyItVt0M/STaQ2t7T9y8m9NKtUDE7sVdvgLhawUsCK208Ms5353o/Xu5i2iQqMyjGqM9CArC8J5TliD2V4BM0pF1FEVohsGQdhGDNlFKzE9n4gxjjvz5+7J23Rn5svb5+/H6RSLdw9/v67eh4FrKPWQlWfmCsZfxaa41Eq1Iq1oK9awQTGcXBnFSGoUrI/P0ED2oLYcXfASqX0A9s29udxZBwGzi8vGS0x5MqDxwfOz/y+xrSiv9lR+t7H3pqp+xu0+vGtzAiDUa/h5iqwCsJht598PqwvKImQOiorailogdQm9nh4zPjGp9nVK8b9Y2JUdHVGzn4V674nlkqwiKrPHR70GlLa2C4RCdXHdQxt44nNl14R1IN
"text/plain": [
"<Figure size 864x216 with 4 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"bears = bears.new(item_tfms=RandomResizedCrop(128, min_scale=0.3))\n",
"dls = bears.dataloaders(path)\n",
2020-03-31 20:57:32 +00:00
"dls.train.show_batch(max_n=4, nrows=1, unique=True)"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"### Data Augmentation"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAqwAAAFhCAYAAAC1XPjHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nOy9a6xtWXbX9xtjrrX23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G4tgyHO/UdlHbVg64gb/HuNr7Zon24eqWTFynaIUnAFEqPSINRaptllEMlgYpowTyR0irecdgj/Y5cjHT/hu7yLsPMKFaQdJxKpS7SbgWTAZUM1uPDrh6/QMtj2D8MEWt9AtKABhl01rgoYHFPLbgfwCoZswK2CyFLCy4N4oI0CdcqzGTDB4OmjgN1vBwFfXGZJDYfKYpo9GWAYnURNtwN0RQkfKjC3KqNc7NBcTTFgqltVML6LCGrlm6A3aWxvTTOdwN9fX7bKquVkr0qLDwW/baJ559sGlZdwgooHvO8+VTH7pCz0RJD/jA4nmHi4wiFOtwznJ8XtCu8+MKKXKJvZTVKzhQMlwGnxzxTSpTBSihckD7eVUZBsh6vy6mbYthxTbsyNzGtjaGYiZ/oO46bITbf5fPZQa5wgbnCaDrhqjIMC2FpJJD1nImyugdpndZqQaQqk2Q2XkSu0ZDxfoKII1e+m4ryFrg6WT1BP+TasUq4j+SX2h7HdSTeOx2v8lkbT4T86nOfXH1uKmkVcG46d0Y4r7G6o2AgMpFbv6ZwnInPV757Z2V7Olk9Hnv6fd6WsEL
"text/plain": [
"<Figure size 864x432 with 8 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"bears = bears.new(item_tfms=Resize(128), batch_tfms=aug_transforms(mult=2))\n",
"dls = bears.dataloaders(path)\n",
2020-03-31 20:57:32 +00:00
"dls.train.show_batch(max_n=8, nrows=2, unique=True)"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"## Training Your Model, and Using It to Clean Your Data"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"bears = bears.new(\n",
" item_tfms=RandomResizedCrop(224, min_scale=0.5),\n",
" batch_tfms=aug_transforms())\n",
"dls = bears.dataloaders(path)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: left;\">\n",
" <th>epoch</th>\n",
" <th>train_loss</th>\n",
" <th>valid_loss</th>\n",
" <th>error_rate</th>\n",
" <th>time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>1.235733</td>\n",
" <td>0.212541</td>\n",
" <td>0.087302</td>\n",
" <td>00:05</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: left;\">\n",
" <th>epoch</th>\n",
" <th>train_loss</th>\n",
" <th>valid_loss</th>\n",
" <th>error_rate</th>\n",
" <th>time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <td>0</td>\n",
" <td>0.213371</td>\n",
" <td>0.112450</td>\n",
" <td>0.023810</td>\n",
" <td>00:05</td>\n",
" </tr>\n",
" <tr>\n",
" <td>1</td>\n",
" <td>0.173855</td>\n",
" <td>0.072306</td>\n",
" <td>0.023810</td>\n",
" <td>00:06</td>\n",
" </tr>\n",
" <tr>\n",
" <td>2</td>\n",
" <td>0.147096</td>\n",
" <td>0.039068</td>\n",
" <td>0.015873</td>\n",
" <td>00:06</td>\n",
" </tr>\n",
" <tr>\n",
" <td>3</td>\n",
" <td>0.123984</td>\n",
" <td>0.026801</td>\n",
" <td>0.015873</td>\n",
" <td>00:06</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"learn = cnn_learner(dls, resnet18, metrics=error_rate)\n",
"learn.fine_tune(4)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
"<I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s+QcLGaWnIPFzJJzsJhZcg4WM0vOwWJmyTlYzCw5B4uZJedgMbPkHCxmlpyDxcySc7CYWXIOFjNLzsFiZsk5WMwsOQeLmSXnYDGz5BwsZpacg8XMknOwmFlyDhYzS87BYmbJOVjMLDkHi5kl52Axs+Sqii6gCIN6deXx8WOLLqPidNv+1KJLqFj/mnx50SU0K+6xmFlyDhYzS87BYmbJOVjMLDkHi5kl52Axs+QcLGaWnIPFzJJzsJhZcg4WM0vOwWJmyTlYzCw5B4uZJedgMbPkHCxmlpyDxcySc7CYWXIOFjNLzsFiZsk5WMwsOQeLmSXnYDGz5BwsZpZcnd8rJOkuIOoaHxH7rpaKzKzZq+8Lyy5psirMbI1SZ7BExJ+ashAzW3M0+BWrkrYAfgz0B9YutUdEr9VYl5k1Y405eHst8GvgM2AX4AbgxtVZlJk1b40JlnYR8QigiJgVERcCu67essysOWtwVwj4WFIrYLqkU4A5wPqrtywza84a02M5DWgPnAoMBo4EvrU6izKz5q3BHktETM7fLgDGrt5yWo4Tjz+G+++7h27d1mfSs9OKLqdwrVqJJ28+i7nvvM+B3/4ND19zGh07ZOcK1l+3E1NefIODT7+q4CqL9eAD93PG6d9myZIljDn6WM486+yiS6pTY84KPUotF8pFRJLjLJJOAD6KiBtWYJ4xwJCIOCVFDUU44shv8W8nnszxx4wpupSKcMrhu/DKzH/QKQ+T3Y/5xdJx4y85lrsea9nhu2TJEk479WTuue8hqnv0YNj2Qxk1al+27N+/6NJq1ZhdoTOAM/PX+cDzwJQUK5dUFRG/WZFQWVMMG74TXbqsW3QZFaF6/XXYa9gArr3jqeXGdWzflhFD+3DXoy07WCZPmkTv3puzWa9
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"interp = ClassificationInterpretation.from_learner(learn)\n",
"interp.plot_confusion_matrix()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBOR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nev9j1DLIKb5IRkcrQEQDfLPMT3NonROSRuHYC+Fb59wnAf6jqq1X1R3FhlwAXicgmETkH59z8ozJ09AJcWwQc3nDk2cCuNfYQMnANTxeRifLziwfyvzVU/koR2VJ+ft5A+k04ozEu//+0crOP/8XyPB9ARHYAjyvTbly6+KpZSpcA3lz+fTqHQyHfsQbn9Hg8ng2PN7w8Hs+GR1U7HF7j9SrgfnE7Fh7AbeSwMFj9O9xaFQN8RURu4vBanpX4A1zI2Thwo4h8V0T2cXgtDThvG8CrReSbIvInS8h7J/BP5X9/RUTuAO4GzsFtovAHq5RpgcV2/FswqqaBSFVl4cBtTALwEhGJcYPde8u095c72N3JgzcHWbi2x4jIDSKyENL4daBVfr5aRL64hPwLIX5PFZFbceuWTl3Fta3kTboCZ/AOHj+DWxO4YCS8r7zX38AZTIdwm3oA/BkwJSJ3iMi1uE1PAHbj2u5K4A5xux5eh/s9qtrCNZVG3o8DH1vFtRwpr8OFJ54K3FW222sWrklVvztUvgLcXpZbWMP2QVW9C2d8LRjznxaR77Ky7v+GiHwP9ww1cDr2Fw/lgkoWdOmnRORaGdghsgzd/SruPiXAN1X15kXq8Hg8nhMOb3h5PJ6HBar65zjv0ddwO9SdiwvPewfwj2WZfbhB8g24gZ3F7VK4mvq/gtvt7mO4HfnOw21mcM1AsVcDC4Phx3B4Y4bF+CXgt3Frtk7FDTK/ADxVVT+1GpkGeNCOfyJS57DH4+NDuxxCueYJ95tfP6mqUziP1D9weNe+UR684+MbgX/HGVmP4vDGG9O4jSxuxXkwAh68cccCv4F
"text/plain": [
"<Figure size 1080x288 with 5 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
2020-03-19 13:21:55 +00:00
"interp.plot_top_losses(5, nrows=1)"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d547f14e0f7848f39627ebb88d457e64",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(Dropdown(options=('black', 'grizzly', 'teddy'), value='black'), Dropdown(options=('Train', 'Val…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"cleaner = ImageClassifierCleaner(learn)\n",
"cleaner"
]
},
2020-03-24 12:47:36 +00:00
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#hide\n",
"# for idx in cleaner.delete(): cleaner.fns[idx].unlink()\n",
2020-03-31 00:49:36 +00:00
"# for idx,cat in cleaner.change(): shutil.move(str(cleaner.fns[idx]), path/cat)"
2020-03-24 12:47:36 +00:00
]
},
2020-03-06 18:19:03 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"## Turning Your Model into an Online Application"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"### Using the Model for Inference"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"learn.export()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(#1) [Path('export.pkl')]"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"path = Path()\n",
"path.ls(file_exts='.pkl')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"learn_inf = load_learner(path/'export.pkl')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"('grizzly', tensor(1), tensor([9.0767e-06, 9.9999e-01, 1.5748e-07]))"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"learn_inf.predict('images/grizzly.jpg')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(#3) ['black','grizzly','teddy']"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"learn_inf.dls.vocab"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"### Creating a Notebook App from the Model"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e0c4141e3c76425c98ae9994ccf9a748",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"FileUpload(value={}, description='Upload')"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"btn_upload = widgets.FileUpload()\n",
"btn_upload"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [],
"source": [
"#hide\n",
"# For the book, we can't actually click an upload button, so we fake it\n",
"btn_upload = SimpleNamespace(data = ['images/grizzly.jpg'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"img = PILImage.create(btn_upload.data[-1])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"out_pl = widgets.Output()\n",
"out_pl.clear_output()\n",
"with out_pl: display(img.to_thumb(128,128))\n",
"out_pl"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"pred,pred_idx,probs = learn_inf.predict(img)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "08509e39d3454701b5fed10439970e84",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Label(value='Prediction: grizzly; Probability: 1.0000')"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"lbl_pred = widgets.Label()\n",
"lbl_pred.value = f'Prediction: {pred}; Probability: {probs[pred_idx]:.04f}'\n",
"lbl_pred"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "5948c2dc026d43cb9afdce7dee8fa425",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Button(description='Classify', style=ButtonStyle())"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"btn_run = widgets.Button(description='Classify')\n",
"btn_run"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def on_click_classify(change):\n",
" img = PILImage.create(btn_upload.data[-1])\n",
" out_pl.clear_output()\n",
" with out_pl: display(img.to_thumb(128,128))\n",
" pred,pred_idx,probs = learn_inf.predict(img)\n",
" lbl_pred.value = f'Prediction: {pred}; Probability: {probs[pred_idx]:.04f}'\n",
"\n",
"btn_run.on_click(on_click_classify)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#hide\n",
"#Putting back btn_upload to a widget for next cell\n",
"btn_upload = widgets.FileUpload()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e9e7b05555a44125ac0e5365e17ea59d",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(Label(value='Select your bear!'), FileUpload(value={}, description='Upload'), Button(descriptio…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"VBox([widgets.Label('Select your bear!'), \n",
" btn_upload, btn_run, out_pl, lbl_pred])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"### Turning Your Notebook into a Real App"
2020-03-06 18:19:03 +00:00
]
},
2020-03-24 12:47:36 +00:00
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#hide\n",
"# !pip install voila\n",
2020-05-19 01:18:45 +00:00
"# !jupyter serverextension enable voila —sys-prefix"
2020-03-24 12:47:36 +00:00
]
},
2020-03-06 18:19:03 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Deploying your app"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"## How to Avoid Disaster"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"### Unforeseen Consequences and Feedback Loops"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"## Get Writing!"
2020-03-06 18:19:03 +00:00
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Questionnaire"
]
},
2020-03-18 00:34:07 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"1. Provide an example of where the bear classification model might work poorly in production, due to structural or style differences in the training data.\n",
2020-03-18 00:34:07 +00:00
"1. Where do text models currently have a major deficiency?\n",
"1. What are possible negative societal implications of text generation models?\n",
"1. In situations where a model might make mistakes, and those mistakes could be harmful, what is a good alternative to automating a process?\n",
"1. What kind of tabular data is deep learning particularly good at?\n",
"1. What's a key downside of directly using a deep learning model for recommendation systems?\n",
2020-05-14 12:18:31 +00:00
"1. What are the steps of the Drivetrain Approach?\n",
"1. How do the steps of the Drivetrain Approach map to a recommendation system?\n",
2020-03-18 00:34:07 +00:00
"1. Create an image recognition model using data you curate, and deploy it on the web.\n",
"1. What is `DataLoaders`?\n",
"1. What four things do we need to tell fastai to create `DataLoaders`?\n",
"1. What does the `splitter` parameter to `DataBlock` do?\n",
"1. How do we ensure a random split always gives the same validation set?\n",
"1. What letters are often used to signify the independent and dependent variables?\n",
2020-05-14 12:18:31 +00:00
"1. What's the difference between the crop, pad, and squish resize approaches? When might you choose one over the others?\n",
2020-03-18 00:34:07 +00:00
"1. What is data augmentation? Why is it needed?\n",
"1. What is the difference between `item_tfms` and `batch_tfms`?\n",
"1. What is a confusion matrix?\n",
"1. What does `export` save?\n",
"1. What is it called when we use a model for getting predictions, instead of training?\n",
"1. What are IPython widgets?\n",
"1. When might you want to use CPU for deployment? When might GPU be better?\n",
"1. What are the downsides of deploying your app to a server, instead of to a client (or edge) device such as a phone or PC?\n",
2020-05-14 12:18:31 +00:00
"1. What are three examples of problems that could occur when rolling out a bear warning system in practice?\n",
"1. What is \"out-of-domain data\"?\n",
2020-03-18 00:34:07 +00:00
"1. What is \"domain shift\"?\n",
2020-05-14 12:18:31 +00:00
"1. What are the three steps in the deployment process?"
2020-03-18 00:34:07 +00:00
]
},
2020-03-06 18:19:03 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"### Further Research"
2020-03-06 18:19:03 +00:00
]
},
2020-03-18 00:34:07 +00:00
{
"cell_type": "markdown",
"metadata": {},
"source": [
2020-05-14 12:18:31 +00:00
"1. Consider how the Drivetrain Approach maps to a project or problem you're interested in.\n",
"1. When might it be best to avoid certain types of data augmentation?\n",
"1. For a project you're interested in applying deep learning to, consider the thought experiment \"What would happen if it went really, really well?\"\n",
"1. Start a blog, and write your first blog post. For instance, write about what you think deep learning might be useful for in a domain you're interested in."
2020-03-18 00:34:07 +00:00
]
},
2020-03-06 18:19:03 +00:00
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
2020-03-19 13:21:55 +00:00
"jupytext": {
"split_at_heading": true
},
2020-03-06 18:19:03 +00:00
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}