mirror of
https://github.com/mrdbourke/pytorch-deep-learning.git
synced 2026-11-27 06:07:09 +00:00
add annotations
This commit is contained in:
1 parent
ec8b5fd0d5
commit
f27cbb3477
1 file changed
+395
-139
+395
-139
@@ -600,7 +600,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "e8606aa1c4a94b36b7a8137e5e590eec",
|
||||
"model_id": "9171086cac6142ef85ba3e184af50b50",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@@ -1085,7 +1085,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "67b634d5be214e978bef6a13c92ad08a",
|
||||
"model_id": "b30e2d01b8a74fedb7b27e0d6c9669a7",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@@ -1534,7 +1534,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "f1bf6c55e4254beaac971e0ccb980f53",
|
||||
"model_id": "b7b6afb33c9d4ee0bc97e6704e2762c7",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@@ -1576,13 +1576,13 @@
|
||||
" 'class_name': 'steak',\n",
|
||||
" 'pred_prob': 0.9293,\n",
|
||||
" 'pred_class': 'steak',\n",
|
||||
" 'time_for_pred': 0.0625,\n",
|
||||
" 'time_for_pred': 0.0554,\n",
|
||||
" 'correct': True},\n",
|
||||
" {'image_path': PosixPath('data/pizza_steak_sushi_20_percent/test/steak/3100563.jpg'),\n",
|
||||
" 'class_name': 'steak',\n",
|
||||
" 'pred_prob': 0.9534,\n",
|
||||
" 'pred_class': 'steak',\n",
|
||||
" 'time_for_pred': 0.0378,\n",
|
||||
" 'time_for_pred': 0.0306,\n",
|
||||
" 'correct': True}]"
|
||||
]
|
||||
},
|
||||
@@ -1650,7 +1650,7 @@
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.9293</td>\n",
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.0625</td>\n",
|
||||
" <td>0.0554</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
@@ -1659,7 +1659,7 @@
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.9534</td>\n",
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.0378</td>\n",
|
||||
" <td>0.0306</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
@@ -1668,7 +1668,7 @@
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.7531</td>\n",
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.0370</td>\n",
|
||||
" <td>0.0293</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
@@ -1677,7 +1677,7 @@
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.5935</td>\n",
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.0372</td>\n",
|
||||
" <td>0.0302</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
@@ -1686,7 +1686,7 @@
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.8959</td>\n",
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.0368</td>\n",
|
||||
" <td>0.0309</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
@@ -1702,11 +1702,11 @@
|
||||
"4 data/pizza_steak_sushi_20_percent/test/steak/7... steak 0.8959 \n",
|
||||
"\n",
|
||||
" pred_class time_for_pred correct \n",
|
||||
"0 steak 0.0625 True \n",
|
||||
"1 steak 0.0378 True \n",
|
||||
"2 steak 0.0370 True \n",
|
||||
"3 steak 0.0372 True \n",
|
||||
"4 steak 0.0368 True "
|
||||
"0 steak 0.0554 True \n",
|
||||
"1 steak 0.0306 True \n",
|
||||
"2 steak 0.0293 True \n",
|
||||
"3 steak 0.0302 True \n",
|
||||
"4 steak 0.0309 True "
|
||||
]
|
||||
},
|
||||
"execution_count": 34,
|
||||
@@ -1773,7 +1773,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"EffNetB2 average time per prediction: 0.0313 seconds\n"
|
||||
"EffNetB2 average time per prediction: 0.0307 seconds\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -1806,7 +1806,7 @@
|
||||
" 'test_acc': 0.96875,\n",
|
||||
" 'number_of_parameters': 7705221,\n",
|
||||
" 'model_size (MB)': 29,\n",
|
||||
" 'time_per_pred_cpu': 0.0313}"
|
||||
" 'time_per_pred_cpu': 0.0307}"
|
||||
]
|
||||
},
|
||||
"execution_count": 37,
|
||||
@@ -1841,7 +1841,7 @@
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "577092f160e7452ca115079fd3fc6c48",
|
||||
"model_id": "dd42602257f84daa800d9b7e2e46aaed",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@@ -1883,13 +1883,13 @@
|
||||
" 'class_name': 'steak',\n",
|
||||
" 'pred_prob': 0.9933,\n",
|
||||
" 'pred_class': 'steak',\n",
|
||||
" 'time_for_pred': 0.1396,\n",
|
||||
" 'time_for_pred': 0.1267,\n",
|
||||
" 'correct': True},\n",
|
||||
" {'image_path': PosixPath('data/pizza_steak_sushi_20_percent/test/steak/3100563.jpg'),\n",
|
||||
" 'class_name': 'steak',\n",
|
||||
" 'pred_prob': 0.9893,\n",
|
||||
" 'pred_class': 'steak',\n",
|
||||
" 'time_for_pred': 0.065,\n",
|
||||
" 'time_for_pred': 0.0651,\n",
|
||||
" 'correct': True}]"
|
||||
]
|
||||
},
|
||||
@@ -1953,7 +1953,7 @@
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.9933</td>\n",
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.1396</td>\n",
|
||||
" <td>0.1267</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
@@ -1962,7 +1962,7 @@
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.9893</td>\n",
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.0650</td>\n",
|
||||
" <td>0.0651</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
@@ -1971,7 +1971,7 @@
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.9971</td>\n",
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.0641</td>\n",
|
||||
" <td>0.0640</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
@@ -1980,7 +1980,7 @@
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.7685</td>\n",
|
||||
" <td>steak</td>\n",
|
||||
" <td>0.0647</td>\n",
|
||||
" <td>0.0648</td>\n",
|
||||
" <td>True</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
@@ -2005,10 +2005,10 @@
|
||||
"4 data/pizza_steak_sushi_20_percent/test/steak/7... steak 0.9499 \n",
|
||||
"\n",
|
||||
" pred_class time_for_pred correct \n",
|
||||
"0 steak 0.1396 True \n",
|
||||
"1 steak 0.0650 True \n",
|
||||
"2 steak 0.0641 True \n",
|
||||
"3 steak 0.0647 True \n",
|
||||
"0 steak 0.1267 True \n",
|
||||
"1 steak 0.0651 True \n",
|
||||
"2 steak 0.0640 True \n",
|
||||
"3 steak 0.0648 True \n",
|
||||
"4 steak 0.0653 True "
|
||||
]
|
||||
},
|
||||
@@ -2076,7 +2076,7 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"ViT average time per prediction: 0.0659 seconds\n"
|
||||
"ViT average time per prediction: 0.0656 seconds\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -2109,7 +2109,7 @@
|
||||
" 'test_acc': 0.984659090909091,\n",
|
||||
" 'number_of_parameters': 85800963,\n",
|
||||
" 'model_size (MB)': 327,\n",
|
||||
" 'time_per_pred_cpu': 0.0659}"
|
||||
" 'time_per_pred_cpu': 0.0656}"
|
||||
]
|
||||
},
|
||||
"execution_count": 43,
|
||||
@@ -2179,7 +2179,7 @@
|
||||
" <td>96.88</td>\n",
|
||||
" <td>7705221</td>\n",
|
||||
" <td>29</td>\n",
|
||||
" <td>0.0313</td>\n",
|
||||
" <td>0.0307</td>\n",
|
||||
" <td>EffNetB2</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
@@ -2188,7 +2188,7 @@
|
||||
" <td>98.47</td>\n",
|
||||
" <td>85800963</td>\n",
|
||||
" <td>327</td>\n",
|
||||
" <td>0.0659</td>\n",
|
||||
" <td>0.0656</td>\n",
|
||||
" <td>ViT</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
@@ -2201,8 +2201,8 @@
|
||||
"1 0.064182 98.47 85800963 327 \n",
|
||||
"\n",
|
||||
" time_per_pred_cpu model \n",
|
||||
"0 0.0313 EffNetB2 \n",
|
||||
"1 0.0659 ViT "
|
||||
"0 0.0307 EffNetB2 \n",
|
||||
"1 0.0656 ViT "
|
||||
]
|
||||
},
|
||||
"execution_count": 44,
|
||||
@@ -2276,7 +2276,7 @@
|
||||
" <td>1.016412</td>\n",
|
||||
" <td>11.135432</td>\n",
|
||||
" <td>11.275862</td>\n",
|
||||
" <td>2.105431</td>\n",
|
||||
" <td>2.136808</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
@@ -2287,7 +2287,7 @@
|
||||
"ViT to EffNetB2 ratios 0.228173 1.016412 11.135432 \n",
|
||||
"\n",
|
||||
" model_size (MB) time_per_pred_cpu \n",
|
||||
"ViT to EffNetB2 ratios 11.275862 2.105431 "
|
||||
"ViT to EffNetB2 ratios 11.275862 2.136808 "
|
||||
]
|
||||
},
|
||||
"execution_count": 45,
|
||||
@@ -2325,6 +2325,8 @@
|
||||
"\n",
|
||||
"However, our EffNetB2 model makes performs predictions faster and has a much small model size.\n",
|
||||
"\n",
|
||||
"> **Note:** Performance or inference time is also often referred to as \"latency\".\n",
|
||||
"\n",
|
||||
"How about we make this fact visual?\n",
|
||||
"\n",
|
||||
"We can do so by creating a plot with matplotlib:\n",
|
||||
@@ -2341,7 +2343,7 @@
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAt8AAAH7CAYAAAAU3/N5AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/YYfK9AAAACXBIWXMAAAsTAAALEwEAmpwYAABarUlEQVR4nO3deZgcVdmw8fvJRkKGQDAw7An7voREXpUtYUcQAiiCQABRFD59RQUXQIyIuIBvXFABBSEQCcgqIAZZwq6SYIhIAAkkEJawRyYbSeZ8f1RN6HR6ZnqWriTD/buuvma66tSpU6drep4+/dSpSCkhSZIkqfa6Le8GSJIkSR8UBt+SJElSQQy+JUmSpIIYfEuSJEkFMfiWJEmSCmLwLUmSJBXE4FvqZBExLCJSRJywPOqIiAkRMb29+14R5Md+RQe2H5XXMajzWtXi/laNiF9ExAsRsXhl73+1riv8nXWGiNgpIu6OiLfzv7lRy7tN0orO4FsrrZIAtbnHR5Z3GwEi4o95e3ZqoUxExPMR8U5E9CmweTVREvymiPhkM2UOKykzquAmlrbjirwNAzpQzTeBLwPXAicAp3VC07qciNgkIi6NiKciYm4esD0ZEVdGxPDl3b6VWTPvhw0RMSkivhIR3Wuwzx7ADcDmwHeA44AbO3s/UlfTY3k3QOoE1wB/rrD82aIb0ozLgE8CJwJfaabMcGAQcElKaV5E3A/0ARa2Y3/7AdGO7WphPtlxX19h3Wfz9b0rrOsDLO7Afs8DfgQs6EAdbbEv8K+U0hkF7W+lEx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J2B/Wj9Hyj+oVzov29KZv8W29tFaO6t9P/g92bdHl5J9Q/IWWbrWx8hel0pZAN3670fLNoNv9XRT85/bVFi3df7z2S6U3apC2UrLWlxGdhHYCWRfe64FfD9VeQFjyqbeuiF/EBGnkH3teiKtX5DVkeOqi5TSkxHxMFkqxkMppafqub9u4j/5z1kd/Mq+3DNk/+BX6GI9lTxFNuXj9sA/2ij3H7L5uP+Wajz9W0opRcTfyYLvdctWb11ePiLWJktbaTlnXyf7Rmlglf3zH7LR8rtTfsFmG6aSXSA4sHT0OyJWJBvdrTSyu4SU0mMR8RhwdER8mywIf4cszaO87MvAb8kuhu5NfqFeRPwkT33oqv+QvebPp5SW+GahRqYC+0XEqhW+ydmaLGWnvTS7moiIVckC76tSSl8oW7dXF6tf6n8/WjaZ862e7lGyi6hOiGxuaWDRLAYtFxDe3ImyE8lGrE8onWklsmkDF3uDL5VSepRsFPRTwBfzOn9XzYFUmNGlpc2QBfKt6chx1dM3yfJRv1XAvrqDcWRfq38zIpZ4fSKif5RNiVZJSulNshzxQ6PCXVsjs0YLine truncated
|
||||
"text/plain": [
|
||||
"<Figure size 864x576 with 1 Axes>"
|
||||
]
|
||||
@@ -2633,11 +2635,11 @@
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"[INFO] Predicting on image at path: data/pizza_steak_sushi_20_percent/test/sushi/124279.jpg\n",
|
||||
"[INFO] Predicting on image at path: data/pizza_steak_sushi_20_percent/test/sushi/715227.jpg\n",
|
||||
"\n",
|
||||
"Prediction label and probability dictionary: \n",
|
||||
"{'pizza': 0.19765837490558624, 'steak': 0.24549660086631775, 'sushi': 0.5568450093269348}\n",
|
||||
"Prediction time: 0.02701 seconds\n"
|
||||
"{'pizza': 0.17773976922035217, 'steak': 0.10127590596675873, 'sushi': 0.7209843397140503}\n",
|
||||
"Prediction time: 0.03034 seconds\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -2699,9 +2701,9 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"[['data/pizza_steak_sushi_20_percent/test/pizza/380739.jpg'],\n",
|
||||
" ['data/pizza_steak_sushi_20_percent/test/sushi/1600999.jpg'],\n",
|
||||
" ['data/pizza_steak_sushi_20_percent/test/pizza/2582289.jpg']]"
|
||||
"[['data/pizza_steak_sushi_20_percent/test/pizza/441659.jpg'],\n",
|
||||
" ['data/pizza_steak_sushi_20_percent/test/pizza/138961.jpg'],\n",
|
||||
" ['data/pizza_steak_sushi_20_percent/test/sushi/1404154.jpg']]"
|
||||
]
|
||||
},
|
||||
"execution_count": 51,
|
||||
@@ -2763,7 +2765,7 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Running on local URL: http://127.0.0.1:7860/\n",
|
||||
"Running on public URL: https://34462.gradio.app\n",
|
||||
"Running on public URL: https://43133.gradio.app\n",
|
||||
"\n",
|
||||
"This share link expires in 72 hours. For free permanent hosting, check out Spaces: https://huggingface.co/spaces\n"
|
||||
]
|
||||
@@ -2771,7 +2773,7 @@
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div><iframe src=\"https://34462.gradio.app\" width=\"900\" height=\"500\" allow=\"autoplay; camera; microphone;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
||||
"<div><iframe src=\"https://43133.gradio.app\" width=\"900\" height=\"500\" allow=\"autoplay; camera; microphone;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
||||
],
|
||||
"text/plain": [
|
||||
"<IPython.core.display.HTML object>"
|
||||
@@ -2783,9 +2785,9 @@
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(<gradio.routes.App at 0x7f9b614c66d0>,\n",
|
||||
"(<gradio.routes.App at 0x7f0a90bd2160>,\n",
|
||||
" 'http://127.0.0.1:7860/',\n",
|
||||
" 'https://34462.gradio.app')"
|
||||
" 'https://43133.gradio.app')"
|
||||
]
|
||||
},
|
||||
"execution_count": 52,
|
||||
@@ -2871,7 +2873,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Deployed Gradio app structure overview\n",
|
||||
"### TK - Deployed Gradio app structure overview\n",
|
||||
"\n",
|
||||
"To upload our demo Gradio app, we'll want to put everything relating to it into a single directory.\n",
|
||||
"\n",
|
||||
@@ -3379,15 +3381,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"TK - does a `flagged/` directory actually appear?\n",
|
||||
"\n",
|
||||
"The `flagged/` directory contains samples that have been \"flagged\". \n",
|
||||
"\n",
|
||||
"For example, if someone tries the demo and the model produces an incorrect result, the sample can be \"flagged\" and reviewed for later.\n",
|
||||
"\n",
|
||||
"For more on flagging in Gradio, see the [flagging documentation](https://gradio.app/docs/#flagging).\n",
|
||||
"\n",
|
||||
"As for the rest of the files, these are all files that we've created!\n",
|
||||
"These are all files that we've created!\n",
|
||||
"\n",
|
||||
"To begin uploading our files to Hugging Face, let's now download them from Google Colab (or wherever you're running this notebook).\n",
|
||||
"\n",
|
||||
@@ -3421,13 +3415,12 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"updating: 09_pretrained_effnetb2_feature_extractor_pizza_steak_sushi_20_percent.pth (deflated 8%)\n",
|
||||
"updating: app.py (deflated 55%)\n",
|
||||
"updating: app.py (deflated 57%)\n",
|
||||
"updating: examples/ (stored 0%)\n",
|
||||
"updating: examples/3622237.jpg (deflated 0%)\n",
|
||||
"updating: examples/592799.jpg (deflated 1%)\n",
|
||||
"updating: examples/2582289.jpg (deflated 17%)\n",
|
||||
"updating: flagged/ (stored 0%)\n",
|
||||
"updating: model.py (deflated 55%)\n",
|
||||
"updating: model.py (deflated 56%)\n",
|
||||
"updating: requirements.txt (deflated 4%)\n",
|
||||
"Not running in Google Colab, can't use google.colab.files.download(), please manually download.\n"
|
||||
]
|
||||
@@ -3460,31 +3453,74 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true,
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"### TK - Running our FoodVision Mini demo locally\n",
|
||||
"\n",
|
||||
"If you download the `foodvision_mini.zip` file, you can test it locally by:\n",
|
||||
"1. Unzipping the file.\n",
|
||||
"2. Opening terminal or a command line prompt.\n",
|
||||
"3. Changing into the `foodvision_mini` directory (`cd foodvision_mini`).\n",
|
||||
"4. Installing the requirements (`pip install requirements.txt`).\n",
|
||||
"5. Run the app (`python app.py`).\n",
|
||||
"\n",
|
||||
"This should result in a Gradio demo just like the one we built above running locally on your machine.\n",
|
||||
"\n",
|
||||
"> **Note:** If you run the app locally and you notice a `flagged/` directory appear, it contains samples that have been \"flagged\". \n",
|
||||
">\n",
|
||||
"> For example, if someone tries the demo and the model produces an incorrect result, the sample can be \"flagged\" and reviewed for later.\n",
|
||||
"> \n",
|
||||
"> For more on flagging in Gradio, see the [flagging documentation](https://gradio.app/docs/#flagging).\n",
|
||||
"\n",
|
||||
"TK image - gif of the above workflow: Google Colab -> Download `foodvision_mini.zip` -> unzip -> install dependencies -> run locally "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {
|
||||
"jp-MarkdownHeadingCollapsed": true,
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"### TK - Uploading to Hugging Face\n",
|
||||
"\n",
|
||||
"UPTOHERE: going through steps to upload to Hugging Face\n",
|
||||
"* Next: practice going through all the steps again and make sure it works when uploading files to Hugging Face... no errors baby!\n",
|
||||
"We've verfied our FoodVision Mini app works locally, however, the fun of creating a machine learning demo is to show it to other people and allow them to use it.\n",
|
||||
"\n",
|
||||
"1. Sign up for a Hugging Face account \n",
|
||||
"2. Start a new Hugging Face Space\n",
|
||||
"3. Give the repo a name\n",
|
||||
"3. Clone the repo \n",
|
||||
"4. Copy the app files to the repo\n",
|
||||
"5. For larger files, e.g. files over 10MB, you'll need to install git lfs - https://git-lfs.github.com/ \n",
|
||||
" * `git lfs install`\n",
|
||||
"6. Run `git lfs track \"*.file_extension\"` to track models, for example, `git lfs track \"*.pth\"`\n",
|
||||
" * `git lfs track \"09_pretrained_effnetb2_feature_extractor_pizza_steak_sushi_20_percent.pth\".\n",
|
||||
"7. Track .gitattributes (automatically created when cloning from HuggingFace) - `git add .gitattributes`\n",
|
||||
"8. Add/commit files\n",
|
||||
" * `git add`\n",
|
||||
" * `git commit`\n",
|
||||
"9. Push to Hugging Face \n",
|
||||
" * `git push`\n",
|
||||
"10. Wait 3-5 minutes for the build to happen (future builds are faster) and if it all worked, your app should be available! \n",
|
||||
"To do so, we're going to upload our FoodVision Mini demo to Hugging Face. \n",
|
||||
"\n",
|
||||
"> **Note:** For more on Git, see here: https://youtu.be/RGOj5yH7evk "
|
||||
"> **Note:** The following series of steps uses a Git (a file tracking system) workflow. For more on how Git works, I'd recommend going through the [Git and GitHub for Beginners tutorial](https://youtu.be/RGOj5yH7evk) on freeCodeCamp.\n",
|
||||
"\n",
|
||||
"1. [Sign up](https://huggingface.co/join) for a Hugging Face account. \n",
|
||||
"2. Start a new Hugging Face Space by going to your profile and then [clicking \"New Space\"](https://huggingface.co/new-space).\n",
|
||||
" * **Note:** A Space in Hugging Face is also known as a \"code repository\" (a place to store your code/files) or \"repo\" for short.\n",
|
||||
"3. Give the Space a name, for example, mine is called `mrdbourke/foodvision_mini`, you can see it here: https://huggingface.co/spaces/mrdbourke/foodvision_mini\n",
|
||||
"4. Select a license (I used [MIT](https://opensource.org/licenses/MIT)).\n",
|
||||
"5. Select Gradio as the Space SDK (software development kit). \n",
|
||||
" * **Note:** You can use other options such as Streamlit but since our app is built with Gradio, we'll stick with that.\n",
|
||||
"6. Choose whether your Space is it's public or private (I selected public since I'd like my Space to be available to others).\n",
|
||||
"7. Click \"Create Space\".\n",
|
||||
"8. Clone the repo locally by running something like: `git clone https://huggingface.co/spaces/[YOUR_USERNAME]/[YOUR_SPACE_NAME]` in terminal or command prompt.\n",
|
||||
" * **Note:** You can also add files via uploading them under the \"Files and versions\" tab.\n",
|
||||
"9. Copy/move the contents of the downloaded `foodvision_mini` folder to the cloned repo folder.\n",
|
||||
"10. To upload and track larger files (e.g. files over 10MB or in our case, our PyTorch model file) you'll need to [install Git LFS](https://git-lfs.github.com/) (which stands for \"git large file storage\").\n",
|
||||
"11. After you've installed Git LFS, you can activate it by running `git lfs install`.\n",
|
||||
"12. In the `foodvision_mini`, track the files over 10MB with Git LFS with `git lfs track \"*.file_extension\"`.\n",
|
||||
" * To track our EffNetB2 PyTorch model you can run `git lfs track \"09_pretrained_effnetb2_feature_extractor_pizza_steak_sushi_20_percent.pth\"`.\n",
|
||||
"13. Track `.gitattributes` (automatically created when cloning from HuggingFace) using `git add .gitattributes` (this file will help ensure our larger files are tracked with Git LFS).\n",
|
||||
" * You can see an example `.gitattributes` file at https://huggingface.co/spaces/mrdbourke/foodvision_mini/blob/main/.gitattributes \n",
|
||||
"14. Add the rest of the `foodvision_mini` app files and commit them with: \n",
|
||||
" * `git add *`.\n",
|
||||
" * `git commit -m \"first commit\"`.\n",
|
||||
"15. Push (upload) the files to Hugging Face:\n",
|
||||
" * `git push`.\n",
|
||||
"16. Wait 3-5 minutes for the build to happen (future builds are faster) and your app to become live!\n",
|
||||
"\n",
|
||||
"If everything worked, you should see a live running example of our FoodVision Mini Gradio demo like the one here: https://huggingface.co/spaces/mrdbourke/foodvision_mini \n",
|
||||
"\n",
|
||||
"TK image - gif of the above workflow from Google Colab -> Hugging Face Space"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -3493,48 +3529,218 @@
|
||||
"source": [
|
||||
"## TK - Creating FoodVision Big\n",
|
||||
"\n",
|
||||
"* Keep experiments quick... want something deployable that can classify with 100x different classes...\n",
|
||||
"* Make a file with Gradio app demo in `demo/`, this can be uploaded to HuggingFace Spaces"
|
||||
"We've spent the past few sections and chapters working on bringing FoodVision Mini to life.\n",
|
||||
"\n",
|
||||
"And now we've seen it working in a live demo, how about we step things up a notch?\n",
|
||||
"\n",
|
||||
"How?\n",
|
||||
"\n",
|
||||
"FoodVision Big!\n",
|
||||
"\n",
|
||||
"Since FoodVision Mini is trained on pizza, steak and sushi images from the [Food101 dataset](https://pytorch.org/vision/main/generated/torchvision.datasets.Food101.html) (101 classes of food x 1000 images each), how about we make FoodVision Big by training a model on all 101 classes!\n",
|
||||
"\n",
|
||||
"We'll go from three classes to 101!\n",
|
||||
"\n",
|
||||
"From pizza, steak, sushi to pizza, steak, sushi, hot dog, apple pie, carrot cake, chocolate cake, french fires, garlic bread, ramen, nachos, tacos and more!\n",
|
||||
"\n",
|
||||
"How?\n",
|
||||
"\n",
|
||||
"Well, we've got all the steps in place, all we have to do is alter our EffNetB2 model slightly as well as prepare a different dataset.\n",
|
||||
"\n",
|
||||
"To finish Milestone Project 3, let's recreate a Gradio demo similar to FoodVision Mini (three classes) but for FoodVision Big (101 classes).\n",
|
||||
"\n",
|
||||
"TK image - FoodVision Mini -> FoodVision Big"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### TK - Creating a model and transforms for FoodVision Big\n",
|
||||
"\n",
|
||||
"When creating FoodVision Mini we saw that the EffNetB2 model was a good tradeoff between speed and performance (it performed well with a fast speed).\n",
|
||||
"\n",
|
||||
"So we'll continue using the same model for FoodVision Big.\n",
|
||||
"\n",
|
||||
"We can create an EffNetB2 feature extractor for Food101 by using our `create_effnetb2_model()` function we created above (TK - what section?) and passing it the parameter `num_classes=101` (since Food101 has 101 classes)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 55,
|
||||
"execution_count": 76,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"effnetb2_food101, effnetb2_transforms = create_effnetb2_model(num_classes=101)\n",
|
||||
"# Create EffNetB2 model capable of fitting to 101 classes for Food101\n",
|
||||
"effnetb2_food101, effnetb2_transforms = create_effnetb2_model(num_classes=101)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Beautiful!\n",
|
||||
"\n",
|
||||
"train_transforms = torchvision.transforms.Compose([\n",
|
||||
"Let's now get a summary of our model."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 86,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"============================================================================================================================================\n",
|
||||
"Layer (type (var_name)) Input Shape Output Shape Param # Trainable\n",
|
||||
"============================================================================================================================================\n",
|
||||
"EfficientNet (EfficientNet) [1, 3, 224, 224] [1, 101] -- Partial\n",
|
||||
"├─Sequential (features) [1, 3, 224, 224] [1, 1408, 7, 7] -- False\n",
|
||||
"│ └─Conv2dNormActivation (0) [1, 3, 224, 224] [1, 32, 112, 112] -- False\n",
|
||||
"│ │ └─Conv2d (0) [1, 3, 224, 224] [1, 32, 112, 112] (864) False\n",
|
||||
"│ │ └─BatchNorm2d (1) [1, 32, 112, 112] [1, 32, 112, 112] (64) False\n",
|
||||
"│ │ └─SiLU (2) [1, 32, 112, 112] [1, 32, 112, 112] -- --\n",
|
||||
"│ └─Sequential (1) [1, 32, 112, 112] [1, 16, 112, 112] -- False\n",
|
||||
"│ │ └─MBConv (0) [1, 32, 112, 112] [1, 16, 112, 112] (1,448) False\n",
|
||||
"│ │ └─MBConv (1) [1, 16, 112, 112] [1, 16, 112, 112] (612) False\n",
|
||||
"│ └─Sequential (2) [1, 16, 112, 112] [1, 24, 56, 56] -- False\n",
|
||||
"│ │ └─MBConv (0) [1, 16, 112, 112] [1, 24, 56, 56] (6,004) False\n",
|
||||
"│ │ └─MBConv (1) [1, 24, 56, 56] [1, 24, 56, 56] (10,710) False\n",
|
||||
"│ │ └─MBConv (2) [1, 24, 56, 56] [1, 24, 56, 56] (10,710) False\n",
|
||||
"│ └─Sequential (3) [1, 24, 56, 56] [1, 48, 28, 28] -- False\n",
|
||||
"│ │ └─MBConv (0) [1, 24, 56, 56] [1, 48, 28, 28] (16,518) False\n",
|
||||
"│ │ └─MBConv (1) [1, 48, 28, 28] [1, 48, 28, 28] (43,308) False\n",
|
||||
"│ │ └─MBConv (2) [1, 48, 28, 28] [1, 48, 28, 28] (43,308) False\n",
|
||||
"│ └─Sequential (4) [1, 48, 28, 28] [1, 88, 14, 14] -- False\n",
|
||||
"│ │ └─MBConv (0) [1, 48, 28, 28] [1, 88, 14, 14] (50,300) False\n",
|
||||
"│ │ └─MBConv (1) [1, 88, 14, 14] [1, 88, 14, 14] (123,750) False\n",
|
||||
"│ │ └─MBConv (2) [1, 88, 14, 14] [1, 88, 14, 14] (123,750) False\n",
|
||||
"│ │ └─MBConv (3) [1, 88, 14, 14] [1, 88, 14, 14] (123,750) False\n",
|
||||
"│ └─Sequential (5) [1, 88, 14, 14] [1, 120, 14, 14] -- False\n",
|
||||
"│ │ └─MBConv (0) [1, 88, 14, 14] [1, 120, 14, 14] (149,158) False\n",
|
||||
"│ │ └─MBConv (1) [1, 120, 14, 14] [1, 120, 14, 14] (237,870) False\n",
|
||||
"│ │ └─MBConv (2) [1, 120, 14, 14] [1, 120, 14, 14] (237,870) False\n",
|
||||
"│ │ └─MBConv (3) [1, 120, 14, 14] [1, 120, 14, 14] (237,870) False\n",
|
||||
"│ └─Sequential (6) [1, 120, 14, 14] [1, 208, 7, 7] -- False\n",
|
||||
"│ │ └─MBConv (0) [1, 120, 14, 14] [1, 208, 7, 7] (301,406) False\n",
|
||||
"│ │ └─MBConv (1) [1, 208, 7, 7] [1, 208, 7, 7] (686,868) False\n",
|
||||
"│ │ └─MBConv (2) [1, 208, 7, 7] [1, 208, 7, 7] (686,868) False\n",
|
||||
"│ │ └─MBConv (3) [1, 208, 7, 7] [1, 208, 7, 7] (686,868) False\n",
|
||||
"│ │ └─MBConv (4) [1, 208, 7, 7] [1, 208, 7, 7] (686,868) False\n",
|
||||
"│ └─Sequential (7) [1, 208, 7, 7] [1, 352, 7, 7] -- False\n",
|
||||
"│ │ └─MBConv (0) [1, 208, 7, 7] [1, 352, 7, 7] (846,900) False\n",
|
||||
"│ │ └─MBConv (1) [1, 352, 7, 7] [1, 352, 7, 7] (1,888,920) False\n",
|
||||
"│ └─Conv2dNormActivation (8) [1, 352, 7, 7] [1, 1408, 7, 7] -- False\n",
|
||||
"│ │ └─Conv2d (0) [1, 352, 7, 7] [1, 1408, 7, 7] (495,616) False\n",
|
||||
"│ │ └─BatchNorm2d (1) [1, 1408, 7, 7] [1, 1408, 7, 7] (2,816) False\n",
|
||||
"│ │ └─SiLU (2) [1, 1408, 7, 7] [1, 1408, 7, 7] -- --\n",
|
||||
"├─AdaptiveAvgPool2d (avgpool) [1, 1408, 7, 7] [1, 1408, 1, 1] -- --\n",
|
||||
"├─Sequential (classifier) [1, 1408] [1, 101] -- True\n",
|
||||
"│ └─Dropout (0) [1, 1408] [1, 1408] -- --\n",
|
||||
"│ └─Linear (1) [1, 1408] [1, 101] 142,309 True\n",
|
||||
"============================================================================================================================================\n",
|
||||
"Total params: 7,843,303\n",
|
||||
"Trainable params: 142,309\n",
|
||||
"Non-trainable params: 7,700,994\n",
|
||||
"Total mult-adds (M): 657.78\n",
|
||||
"============================================================================================================================================\n",
|
||||
"Input size (MB): 0.60\n",
|
||||
"Forward/backward pass size (MB): 156.80\n",
|
||||
"Params size (MB): 31.37\n",
|
||||
"Estimated Total Size (MB): 188.77\n",
|
||||
"============================================================================================================================================"
|
||||
]
|
||||
},
|
||||
"execution_count": 86,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Get a summary of EffNetB2 feature extractor for Food101\n",
|
||||
"from torchinfo import summary\n",
|
||||
"summary(effnetb2_food101, \n",
|
||||
" input_size=(1, 3, 224, 224),\n",
|
||||
" col_names=[\"input_size\", \"output_size\", \"num_params\", \"trainable\"],\n",
|
||||
" col_width=20,\n",
|
||||
" row_settings=[\"var_names\"])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"TK image - turn summary into image\n",
|
||||
"\n",
|
||||
"Nice!\n",
|
||||
"\n",
|
||||
"See how just like our EffNetB2 model for FoodVision Mini the base layers are frozen (these are pretrained on ImageNet) and the outer layers (the `classifier` layers) are trainble with an ouput shape of `[batch_size, 101]` (`101` for 101 classes in Food101). \n",
|
||||
"\n",
|
||||
"Now since we're going to be dealing with a fair bit more data than usual, how about we add a little data augmentation to our transforms (`effnetb2_transforms`) to augment the training data.\n",
|
||||
"\n",
|
||||
"> **Note:** Data augmentation is a technique used to alter the appearance of an input training sample (e.g. rotating an image or slightly skewing it) to artificially increase the diversity of a training dataset to hopefully prevent overfitting. You can see more on data augmentation in [04. PyTorch Custom Datasets section 6](https://www.learnpytorch.io/04_pytorch_custom_datasets/#6-other-forms-of-transforms-data-augmentation).\n",
|
||||
"\n",
|
||||
"Let's compose a `torchvision.transforms` pipeline to use [`torchvision.transforms.TrivialAugmentWide()`](https://pytorch.org/vision/main/generated/torchvision.transforms.TrivialAugmentWide.html) (the same data augmentation used by the PyTorch team in their [computer vision recipes](https://pytorch.org/blog/how-to-train-state-of-the-art-models-using-torchvision-latest-primitives/#break-down-of-key-accuracy-improvements)) as well as the `effnetb2_transforms` to transform our training images. "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 87,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Create Food101 training data transforms (only perform data augmentation on the training images)\n",
|
||||
"food101_train_transforms = torchvision.transforms.Compose([\n",
|
||||
" torchvision.transforms.TrivialAugmentWide(),\n",
|
||||
" effnetb2_transforms,\n",
|
||||
"])"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Epic!\n",
|
||||
"\n",
|
||||
"Now let's compare `food101_train_transforms` (for the training data) and `effnetb2_transforms` (for the testing/inference data). "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 56,
|
||||
"execution_count": 90,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"ImageClassification(\n",
|
||||
" crop_size=[288]\n",
|
||||
" resize_size=[288]\n",
|
||||
" mean=[0.485, 0.456, 0.406]\n",
|
||||
" std=[0.229, 0.224, 0.225]\n",
|
||||
" interpolation=InterpolationMode.BICUBIC\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
"execution_count": 56,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Training transforms:\n",
|
||||
"Compose(\n",
|
||||
" TrivialAugmentWide(num_magnitude_bins=31, interpolation=InterpolationMode.NEAREST, fill=None)\n",
|
||||
" ImageClassification(\n",
|
||||
" crop_size=[288]\n",
|
||||
" resize_size=[288]\n",
|
||||
" mean=[0.485, 0.456, 0.406]\n",
|
||||
" std=[0.229, 0.224, 0.225]\n",
|
||||
" interpolation=InterpolationMode.BICUBIC\n",
|
||||
")\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"Testing transforms:\n",
|
||||
"ImageClassification(\n",
|
||||
" crop_size=[288]\n",
|
||||
" resize_size=[288]\n",
|
||||
" mean=[0.485, 0.456, 0.406]\n",
|
||||
" std=[0.229, 0.224, 0.225]\n",
|
||||
" interpolation=InterpolationMode.BICUBIC\n",
|
||||
")\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"effnetb2_transforms"
|
||||
"print(f\"Training transforms:\\n{food101_train_transforms}\\n\") \n",
|
||||
"print(f\"Testing transforms:\\n{effnetb2_transforms}\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -3543,12 +3749,56 @@
|
||||
"source": [
|
||||
"### TK - Getting data for FoodVision Big\n",
|
||||
"\n",
|
||||
"> TK **Note:** If you're using Google Colab, the cell below will take ~5-10 minutes to fully run and download the Food101 images from PyTorch. This is because there is over 100,000 images being downloaded. If you restart your Google Colab runtime and come back to this cell, the images will have to redownload. Alternatively, if you're running this notebook locally, the images will be cached and stroed in the `root/` directory specified below. "
|
||||
"For FoodVision Mini, we made our own [custom data splits](https://github.com/mrdbourke/pytorch-deep-learning/blob/main/extras/04_custom_data_creation.ipynb) of the entire Food101 dataset.\n",
|
||||
"\n",
|
||||
"To get the whole Food101 dataset, we can use [`torchvision.datasets.Food101()`](https://pytorch.org/vision/main/generated/torchvision.datasets.Food101.html).\n",
|
||||
"\n",
|
||||
"We'll first setup a path to directory `data/` to store the images. \n",
|
||||
"\n",
|
||||
"Then we'll download and transform the training and testing dataset splits using `food101_train_transforms` and `effnetb2_transforms` to transform each dataset respectively. \n",
|
||||
"\n",
|
||||
"> **Note:** If you're using Google Colab, the cell below will take ~5-10 minutes to fully run and download the Food101 images from PyTorch. \n",
|
||||
">\n",
|
||||
"> This is because there is over 100,000 images being downloaded (101 classes x 1000 images per class). If you restart your Google Colab runtime and come back to this cell, the images will have to redownload. Alternatively, if you're running this notebook locally, the images will be cached and stored in the directory specified by the `root` parameter of `torchvision.datasets.Food101()`. "
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 57,
|
||||
"execution_count": 91,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from torchvision import datasets\n",
|
||||
"\n",
|
||||
"# Setup data directory\n",
|
||||
"from pathlib import Path\n",
|
||||
"data_dir = Path(\"data\")\n",
|
||||
"\n",
|
||||
"# Get training data (~750 images x 101 food classes)\n",
|
||||
"train_data = datasets.Food101(root=data_dir, # path to download data to\n",
|
||||
" split=\"train\", # dataset split to get\n",
|
||||
" transform=food101_train_transforms, # perform data augmentation on training data\n",
|
||||
" download=True) # want to download?\n",
|
||||
"\n",
|
||||
"# Get testing data (~250 images x 101 food classes)\n",
|
||||
"test_data = datasets.Food101(root=data_dir,\n",
|
||||
" split=\"test\",\n",
|
||||
" transform=effnetb2_transforms, # perform normal EffNetB2 transforms on test data\n",
|
||||
" download=True)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Data downloaded!\n",
|
||||
"\n",
|
||||
"Now we can get a list of all the class names using `train_data.classes`."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 92,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -3566,39 +3816,43 @@
|
||||
" 'breakfast_burrito']"
|
||||
]
|
||||
},
|
||||
"execution_count": 57,
|
||||
"execution_count": 92,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from torchvision import datasets\n",
|
||||
"from torchvision import transforms\n",
|
||||
"\n",
|
||||
"# Setup data directory\n",
|
||||
"import pathlib\n",
|
||||
"data_dir = pathlib.Path(\"data\")\n",
|
||||
"\n",
|
||||
"# Get training data\n",
|
||||
"train_data = datasets.Food101(root=data_dir,\n",
|
||||
" split=\"train\",\n",
|
||||
" transform=train_transforms,\n",
|
||||
" download=True)\n",
|
||||
"\n",
|
||||
"# Get testing data\n",
|
||||
"test_data = datasets.Food101(root=data_dir,\n",
|
||||
" split=\"test\",\n",
|
||||
" transform=effnetb2_transforms,\n",
|
||||
" download=True)\n",
|
||||
"\n",
|
||||
"# Get class names\n",
|
||||
"# Get Food101 class names\n",
|
||||
"food101_class_names = train_data.classes\n",
|
||||
"\n",
|
||||
"# View the first 10\n",
|
||||
"food101_class_names[:10]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Ho ho! Those are some delicious sounding foods (although I've never heard of \"beignets\"... update: after a quick Google search, beignets also look delicious). \n",
|
||||
" \n",
|
||||
"You can see a full list of the Food101 class names on the course GitHub under [`extras/food101_class_names.txt`](https://github.com/mrdbourke/pytorch-deep-learning/blob/main/extras/food101_class_names.txt)."
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### TK - Creating a subset of the Food101 dataset for faster experimenting \n",
|
||||
"\n",
|
||||
"TK - create a table showing the subset of datasets we're using\n",
|
||||
"* foodvision mini\n",
|
||||
"* food101 subset (this notebook) \n",
|
||||
"* food101 all"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 58,
|
||||
"execution_count": 79,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -3607,14 +3861,13 @@
|
||||
"(15150, 5050)"
|
||||
]
|
||||
},
|
||||
"execution_count": 58,
|
||||
"execution_count": 79,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# TK - Can split data into random splits with `random_split()`... https://pytorch.org/docs/stable/data.html\n",
|
||||
"# Make 10% split and use for training data \n",
|
||||
"# Do the same with testing data, use these splits to train a bigger model and use that as \"FoodVision Big\"\n",
|
||||
"def split_dataset(dataset, split_size:float=0.2, seed:int=42):\n",
|
||||
" length_1 = int(len(dataset) * split_size)\n",
|
||||
@@ -3624,9 +3877,11 @@
|
||||
" generator=torch.manual_seed(seed))\n",
|
||||
" return random_split_1, random_split_2\n",
|
||||
"\n",
|
||||
"# Create training 20% split of Food101\n",
|
||||
"train_data_food101_20_percent, _ = split_dataset(dataset=train_data,\n",
|
||||
" split_size=0.2)\n",
|
||||
"\n",
|
||||
"# Create testing 20% split of Food101\n",
|
||||
"test_data_food101_20_percent, _ = split_dataset(dataset=test_data,\n",
|
||||
" split_size=0.2)\n",
|
||||
"\n",
|
||||
@@ -3635,7 +3890,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 59,
|
||||
"execution_count": 80,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -3657,7 +3912,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### TK - Train big model\n",
|
||||
"### TK - Training FoodVision Big model\n",
|
||||
"\n",
|
||||
"* TK - Train a model on all Food101 classes (20% of the data).\n",
|
||||
"* TK - link to download the big model incase someone doesn't want to go through all the training process..."
|
||||
@@ -3665,13 +3920,13 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 60,
|
||||
"execution_count": 82,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"application/vnd.jupyter.widget-view+json": {
|
||||
"model_id": "dce4abcea85f4fa5a6e55e6917cb1172",
|
||||
"model_id": "054168c8921049269cdc70e65c10df3d",
|
||||
"version_major": 2,
|
||||
"version_minor": 0
|
||||
},
|
||||
@@ -3719,12 +3974,12 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### TK - Plot loss curves of the big model"
|
||||
"### TK - Inspecting loss curves of FoodVision Big model"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 61,
|
||||
"execution_count": 83,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -3748,7 +4003,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### TK - Save big model"
|
||||
"### TK - Saving and loading FoodVision Big"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -3778,7 +4033,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### TK - Load big model"
|
||||
"TK - Load FoodVision Big"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -3807,7 +4062,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### TK - Check big model file size"
|
||||
"### TK - Checking FoodVision Big model size"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -3835,7 +4090,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## TK - Turn big dog model into an app\n",
|
||||
"## TK - Turning our FoodVision Big model into a deployable app\n",
|
||||
"\n",
|
||||
"TK - Add README.md to app folder"
|
||||
]
|
||||
@@ -4088,7 +4343,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### TK - Download FoodVision Big app files"
|
||||
"### TK - Downloading our FoodVision Big app files"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -4128,7 +4383,7 @@
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Deploying our FoodVision Big app to HuggingFace Spaces\n",
|
||||
"## TK - Deploying our FoodVision Big app to HuggingFace Spaces\n",
|
||||
"\n",
|
||||
"See here for uploading to HuggingFace: https://huggingface.co/docs/hub/repositories-getting-started#getting-started-with-repositories\n",
|
||||
"\n",
|
||||
@@ -4148,6 +4403,7 @@
|
||||
"\n",
|
||||
"## TK - Extra-curriculum\n",
|
||||
"\n",
|
||||
"* More about Git and GitHub - \"Git and GitHub for Beginners - Crash Course\" on freeCodeCamp YouTube channel https://youtu.be/RGOj5yH7evk \n",
|
||||
"* More on Gradio: https://gradio.app/docs/ \n",
|
||||
" * Check out all the different kinds of file components... \n",
|
||||
" * Check out the Blocks API for more advanced workflows - https://gradio.app/docs/#blocks \n",
|
||||
|
||||
Reference in new issue
Block a user