diff options
author | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-11-05 19:22:40 +0100 |
---|---|---|
committer | Gustaf Rydholm <gustaf.rydholm@gmail.com> | 2021-11-05 19:22:40 +0100 |
commit | c141f422d7c8c7569c2d7f87117fdaf3b6bbb461 (patch) | |
tree | 99f799bb036d973c80ed21d19b1b37d3c0de358b /notebooks | |
parent | 2b4fa9f331731054666884e4df343d3d9de23a97 (diff) |
Try new efficientnet in notebook
Diffstat (limited to 'notebooks')
-rw-r--r-- | notebooks/04-efficientnet.ipynb | 232 |
1 files changed, 138 insertions, 94 deletions
diff --git a/notebooks/04-efficientnet.ipynb b/notebooks/04-efficientnet.ipynb index 4148e7d..c371142 100644 --- a/notebooks/04-efficientnet.ipynb +++ b/notebooks/04-efficientnet.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "7c02ae76-b540-4b16-9492-e9210b3b9249", "metadata": {}, "outputs": [], @@ -28,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "ccdb6dde-47e5-429a-88f2-0764fb7e259a", "metadata": {}, "outputs": [], @@ -40,7 +40,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 10, "id": "3cf50475-39f2-4642-a7d1-5bcbc0a036f7", "metadata": {}, "outputs": [], @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 11, "id": "e52ecb01-c975-4e55-925d-1182c7aea473", "metadata": {}, "outputs": [], @@ -61,17 +61,17 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 12, "id": "f939aa37-7b1d-45cc-885c-323c4540bda1", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "{'_target_': 'text_recognizer.networks.encoders.efficientnet.EfficientNet', 'arch': 'b0', 'out_channels': 1280, 'stochastic_dropout_rate': 0.2, 'bn_momentum': 0.99, 'bn_eps': 0.001}" + "{'_target_': 'text_recognizer.networks.encoders.efficientnet.EfficientNet', 'arch': 'b0', 'stochastic_dropout_rate': 0.2, 'bn_momentum': 0.99, 'bn_eps': 0.001}" ] }, - "execution_count": 6, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -82,7 +82,17 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 13, + "id": "42caaae5-7ee6-43fe-97eb-46c2a6915739", + "metadata": {}, + "outputs": [], + "source": [ + "cfg.arch = \"b2\"" + ] + }, + { + "cell_type": "code", + "execution_count": 14, "id": "aaeab329-aeb0-4a1b-aa35-5a2aab81b1d0", "metadata": {}, "outputs": [], @@ -92,7 +102,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 15, "id": "618b997c-e6a6-4487-b70c-9d260cb556d3", "metadata": {}, "outputs": [], @@ -102,7 +112,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 16, "id": "25759b7b-8deb-4163-b75d-a1357c9fe88f", "metadata": {}, "outputs": [ @@ -124,98 +134,132 @@ "│ │ └─Sequential: 3-1 [2, 32, 288, 320] 352\n", "│ │ └─Sequential: 3-2 [2, 32, 288, 320] 552\n", "│ │ └─Sequential: 3-3 [2, 16, 288, 320] 544\n", - "│ └─MBConvBlock: 2-6 [2, 24, 144, 160] --\n", - "│ │ └─Sequential: 3-4 [2, 96, 288, 320] 1,728\n", - "│ │ └─Sequential: 3-5 [2, 96, 144, 160] 1,056\n", - "│ │ └─Sequential: 3-6 [2, 96, 144, 160] 4,728\n", - "│ │ └─Sequential: 3-7 [2, 24, 144, 160] 2,352\n", + "│ └─MBConvBlock: 2-6 [2, 16, 288, 320] --\n", + "│ │ └─Sequential: 3-4 [2, 16, 288, 320] 176\n", + "│ │ └─Sequential: 3-5 [2, 16, 288, 320] 148\n", + "│ │ └─Sequential: 3-6 [2, 16, 288, 320] 288\n", "│ └─MBConvBlock: 2-7 [2, 24, 144, 160] --\n", - "│ │ └─Sequential: 3-8 [2, 144, 144, 160] 3,744\n", - "│ │ └─Sequential: 3-9 [2, 144, 144, 160] 1,584\n", - "│ │ └─Sequential: 3-10 [2, 144, 144, 160] 10,548\n", - "│ │ └─Sequential: 3-11 [2, 24, 144, 160] 3,504\n", - "│ └─MBConvBlock: 2-8 [2, 40, 72, 80] --\n", - "│ │ └─Sequential: 3-12 [2, 144, 144, 160] 3,744\n", - "│ │ └─Sequential: 3-13 [2, 144, 72, 80] 3,888\n", - "│ │ └─Sequential: 3-14 [2, 144, 72, 80] 10,548\n", - "│ │ └─Sequential: 3-15 [2, 40, 72, 80] 5,840\n", - "│ └─MBConvBlock: 2-9 [2, 40, 72, 80] --\n", - "│ │ └─Sequential: 3-16 [2, 240, 72, 80] 10,080\n", - "│ │ └─Sequential: 3-17 [2, 240, 72, 80] 6,480\n", - "│ │ └─Sequential: 3-18 [2, 240, 72, 80] 29,100\n", - "│ │ └─Sequential: 3-19 [2, 40, 72, 80] 9,680\n", - "│ └─MBConvBlock: 2-10 [2, 80, 36, 40] --\n", - "│ │ └─Sequential: 3-20 [2, 240, 72, 80] 10,080\n", - "│ │ └─Sequential: 3-21 [2, 240, 36, 40] 2,640\n", - "│ │ └─Sequential: 3-22 [2, 240, 36, 40] 29,100\n", - "│ │ └─Sequential: 3-23 [2, 80, 36, 40] 19,360\n", - "│ └─MBConvBlock: 2-11 [2, 80, 36, 40] --\n", - "│ │ └─Sequential: 3-24 [2, 480, 36, 40] 39,360\n", - "│ │ └─Sequential: 3-25 [2, 480, 36, 40] 5,280\n", - "│ │ └─Sequential: 3-26 [2, 480, 36, 40] 115,800\n", - "│ │ └─Sequential: 3-27 [2, 80, 36, 40] 38,560\n", - "│ └─MBConvBlock: 2-12 [2, 80, 36, 40] --\n", - "│ │ └─Sequential: 3-28 [2, 480, 36, 40] 39,360\n", - "│ │ └─Sequential: 3-29 [2, 480, 36, 40] 5,280\n", - "│ │ └─Sequential: 3-30 [2, 480, 36, 40] 115,800\n", - "│ │ └─Sequential: 3-31 [2, 80, 36, 40] 38,560\n", - "│ └─MBConvBlock: 2-13 [2, 112, 36, 40] --\n", - "│ │ └─Sequential: 3-32 [2, 480, 36, 40] 39,360\n", - "│ │ └─Sequential: 3-33 [2, 480, 36, 40] 12,960\n", - "│ │ └─Sequential: 3-34 [2, 480, 36, 40] 115,800\n", - "│ │ └─Sequential: 3-35 [2, 112, 36, 40] 53,984\n", - "│ └─MBConvBlock: 2-14 [2, 112, 36, 40] --\n", - "│ │ └─Sequential: 3-36 [2, 672, 36, 40] 76,608\n", - "│ │ └─Sequential: 3-37 [2, 672, 36, 40] 18,144\n", - "│ │ └─Sequential: 3-38 [2, 672, 36, 40] 226,632\n", - "│ │ └─Sequential: 3-39 [2, 112, 36, 40] 75,488\n", - "│ └─MBConvBlock: 2-15 [2, 112, 36, 40] --\n", - "│ │ └─Sequential: 3-40 [2, 672, 36, 40] 76,608\n", - "│ │ └─Sequential: 3-41 [2, 672, 36, 40] 18,144\n", - "│ │ └─Sequential: 3-42 [2, 672, 36, 40] 226,632\n", - "│ │ └─Sequential: 3-43 [2, 112, 36, 40] 75,488\n", - "│ └─MBConvBlock: 2-16 [2, 192, 18, 20] --\n", - "│ │ └─Sequential: 3-44 [2, 672, 36, 40] 76,608\n", - "│ │ └─Sequential: 3-45 [2, 672, 18, 20] 18,144\n", - "│ │ └─Sequential: 3-46 [2, 672, 18, 20] 226,632\n", - "│ │ └─Sequential: 3-47 [2, 192, 18, 20] 129,408\n", - "│ └─MBConvBlock: 2-17 [2, 192, 18, 20] --\n", - "│ │ └─Sequential: 3-48 [2, 1152, 18, 20] 223,488\n", - "│ │ └─Sequential: 3-49 [2, 1152, 18, 20] 31,104\n", - "│ │ └─Sequential: 3-50 [2, 1152, 18, 20] 664,992\n", - "│ │ └─Sequential: 3-51 [2, 192, 18, 20] 221,568\n", - "│ └─MBConvBlock: 2-18 [2, 192, 18, 20] --\n", - "│ │ └─Sequential: 3-52 [2, 1152, 18, 20] 223,488\n", - "│ │ └─Sequential: 3-53 [2, 1152, 18, 20] 31,104\n", - "│ │ └─Sequential: 3-54 [2, 1152, 18, 20] 664,992\n", - "│ │ └─Sequential: 3-55 [2, 192, 18, 20] 221,568\n", - "│ └─MBConvBlock: 2-19 [2, 192, 18, 20] --\n", - "│ │ └─Sequential: 3-56 [2, 1152, 18, 20] 223,488\n", - "│ │ └─Sequential: 3-57 [2, 1152, 18, 20] 31,104\n", - "│ │ └─Sequential: 3-58 [2, 1152, 18, 20] 664,992\n", - "│ │ └─Sequential: 3-59 [2, 192, 18, 20] 221,568\n", - "│ └─MBConvBlock: 2-20 [2, 320, 18, 20] --\n", - "│ │ └─Sequential: 3-60 [2, 1152, 18, 20] 223,488\n", - "│ │ └─Sequential: 3-61 [2, 1152, 18, 20] 12,672\n", - "│ │ └─Sequential: 3-62 [2, 1152, 18, 20] 664,992\n", - "│ │ └─Sequential: 3-63 [2, 320, 18, 20] 369,280\n", - "├─Sequential: 1-3 [2, 1280, 18, 20] --\n", - "│ └─Conv2d: 2-21 [2, 1280, 18, 20] 409,600\n", - "│ └─BatchNorm2d: 2-22 [2, 1280, 18, 20] 2,560\n", + "│ │ └─Sequential: 3-7 [2, 96, 288, 320] 1,728\n", + "│ │ └─Sequential: 3-8 [2, 96, 144, 160] 1,056\n", + "│ │ └─Sequential: 3-9 [2, 96, 144, 160] 4,728\n", + "│ │ └─Sequential: 3-10 [2, 24, 144, 160] 2,352\n", + "│ └─MBConvBlock: 2-8 [2, 24, 144, 160] --\n", + "│ │ └─Sequential: 3-11 [2, 144, 144, 160] 3,744\n", + "│ │ └─Sequential: 3-12 [2, 144, 144, 160] 1,584\n", + "│ │ └─Sequential: 3-13 [2, 144, 144, 160] 10,548\n", + "│ │ └─Sequential: 3-14 [2, 24, 144, 160] 3,504\n", + "│ └─MBConvBlock: 2-9 [2, 24, 144, 160] --\n", + "│ │ └─Sequential: 3-15 [2, 144, 144, 160] 3,744\n", + "│ │ └─Sequential: 3-16 [2, 144, 144, 160] 1,584\n", + "│ │ └─Sequential: 3-17 [2, 144, 144, 160] 10,548\n", + "│ │ └─Sequential: 3-18 [2, 24, 144, 160] 3,504\n", + "│ └─MBConvBlock: 2-10 [2, 48, 72, 80] --\n", + "│ │ └─Sequential: 3-19 [2, 144, 144, 160] 3,744\n", + "│ │ └─Sequential: 3-20 [2, 144, 72, 80] 3,888\n", + "│ │ └─Sequential: 3-21 [2, 144, 72, 80] 10,548\n", + "│ │ └─Sequential: 3-22 [2, 48, 72, 80] 7,008\n", + "│ └─MBConvBlock: 2-11 [2, 48, 72, 80] --\n", + "│ │ └─Sequential: 3-23 [2, 288, 72, 80] 14,400\n", + "│ │ └─Sequential: 3-24 [2, 288, 72, 80] 7,776\n", + "│ │ └─Sequential: 3-25 [2, 288, 72, 80] 41,832\n", + "│ │ └─Sequential: 3-26 [2, 48, 72, 80] 13,920\n", + "│ └─MBConvBlock: 2-12 [2, 48, 72, 80] --\n", + "│ │ └─Sequential: 3-27 [2, 288, 72, 80] 14,400\n", + "│ │ └─Sequential: 3-28 [2, 288, 72, 80] 7,776\n", + "│ │ └─Sequential: 3-29 [2, 288, 72, 80] 41,832\n", + "│ │ └─Sequential: 3-30 [2, 48, 72, 80] 13,920\n", + "│ └─MBConvBlock: 2-13 [2, 88, 36, 40] --\n", + "│ │ └─Sequential: 3-31 [2, 288, 72, 80] 14,400\n", + "│ │ └─Sequential: 3-32 [2, 288, 36, 40] 3,168\n", + "│ │ └─Sequential: 3-33 [2, 288, 36, 40] 41,832\n", + "│ │ └─Sequential: 3-34 [2, 88, 36, 40] 25,520\n", + "│ └─MBConvBlock: 2-14 [2, 88, 36, 40] --\n", + "│ │ └─Sequential: 3-35 [2, 528, 36, 40] 47,520\n", + "│ │ └─Sequential: 3-36 [2, 528, 36, 40] 5,808\n", + "│ │ └─Sequential: 3-37 [2, 528, 36, 40] 140,052\n", + "│ │ └─Sequential: 3-38 [2, 88, 36, 40] 46,640\n", + "│ └─MBConvBlock: 2-15 [2, 88, 36, 40] --\n", + "│ │ └─Sequential: 3-39 [2, 528, 36, 40] 47,520\n", + "│ │ └─Sequential: 3-40 [2, 528, 36, 40] 5,808\n", + "│ │ └─Sequential: 3-41 [2, 528, 36, 40] 140,052\n", + "│ │ └─Sequential: 3-42 [2, 88, 36, 40] 46,640\n", + "│ └─MBConvBlock: 2-16 [2, 88, 36, 40] --\n", + "│ │ └─Sequential: 3-43 [2, 528, 36, 40] 47,520\n", + "│ │ └─Sequential: 3-44 [2, 528, 36, 40] 5,808\n", + "│ │ └─Sequential: 3-45 [2, 528, 36, 40] 140,052\n", + "│ │ └─Sequential: 3-46 [2, 88, 36, 40] 46,640\n", + "│ └─MBConvBlock: 2-17 [2, 120, 36, 40] --\n", + "│ │ └─Sequential: 3-47 [2, 528, 36, 40] 47,520\n", + "│ │ └─Sequential: 3-48 [2, 528, 36, 40] 14,256\n", + "│ │ └─Sequential: 3-49 [2, 528, 36, 40] 140,052\n", + "│ │ └─Sequential: 3-50 [2, 120, 36, 40] 63,600\n", + "│ └─MBConvBlock: 2-18 [2, 120, 36, 40] --\n", + "│ │ └─Sequential: 3-51 [2, 720, 36, 40] 87,840\n", + "│ │ └─Sequential: 3-52 [2, 720, 36, 40] 19,440\n", + "│ │ └─Sequential: 3-53 [2, 720, 36, 40] 260,100\n", + "│ │ └─Sequential: 3-54 [2, 120, 36, 40] 86,640\n", + "│ └─MBConvBlock: 2-19 [2, 120, 36, 40] --\n", + "│ │ └─Sequential: 3-55 [2, 720, 36, 40] 87,840\n", + "│ │ └─Sequential: 3-56 [2, 720, 36, 40] 19,440\n", + "│ │ └─Sequential: 3-57 [2, 720, 36, 40] 260,100\n", + "│ │ └─Sequential: 3-58 [2, 120, 36, 40] 86,640\n", + "│ └─MBConvBlock: 2-20 [2, 120, 36, 40] --\n", + "│ │ └─Sequential: 3-59 [2, 720, 36, 40] 87,840\n", + "│ │ └─Sequential: 3-60 [2, 720, 36, 40] 19,440\n", + "│ │ └─Sequential: 3-61 [2, 720, 36, 40] 260,100\n", + "│ │ └─Sequential: 3-62 [2, 120, 36, 40] 86,640\n", + "│ └─MBConvBlock: 2-21 [2, 208, 18, 20] --\n", + "│ │ └─Sequential: 3-63 [2, 720, 36, 40] 87,840\n", + "│ │ └─Sequential: 3-64 [2, 720, 18, 20] 19,440\n", + "│ │ └─Sequential: 3-65 [2, 720, 18, 20] 260,100\n", + "│ │ └─Sequential: 3-66 [2, 208, 18, 20] 150,176\n", + "│ └─MBConvBlock: 2-22 [2, 208, 18, 20] --\n", + "│ │ └─Sequential: 3-67 [2, 1248, 18, 20] 262,080\n", + "│ │ └─Sequential: 3-68 [2, 1248, 18, 20] 33,696\n", + "│ │ └─Sequential: 3-69 [2, 1248, 18, 20] 780,312\n", + "│ │ └─Sequential: 3-70 [2, 208, 18, 20] 260,000\n", + "│ └─MBConvBlock: 2-23 [2, 208, 18, 20] --\n", + "│ │ └─Sequential: 3-71 [2, 1248, 18, 20] 262,080\n", + "│ │ └─Sequential: 3-72 [2, 1248, 18, 20] 33,696\n", + "│ │ └─Sequential: 3-73 [2, 1248, 18, 20] 780,312\n", + "│ │ └─Sequential: 3-74 [2, 208, 18, 20] 260,000\n", + "│ └─MBConvBlock: 2-24 [2, 208, 18, 20] --\n", + "│ │ └─Sequential: 3-75 [2, 1248, 18, 20] 262,080\n", + "│ │ └─Sequential: 3-76 [2, 1248, 18, 20] 33,696\n", + "│ │ └─Sequential: 3-77 [2, 1248, 18, 20] 780,312\n", + "│ │ └─Sequential: 3-78 [2, 208, 18, 20] 260,000\n", + "│ └─MBConvBlock: 2-25 [2, 208, 18, 20] --\n", + "│ │ └─Sequential: 3-79 [2, 1248, 18, 20] 262,080\n", + "│ │ └─Sequential: 3-80 [2, 1248, 18, 20] 33,696\n", + "│ │ └─Sequential: 3-81 [2, 1248, 18, 20] 780,312\n", + "│ │ └─Sequential: 3-82 [2, 208, 18, 20] 260,000\n", + "│ └─MBConvBlock: 2-26 [2, 352, 18, 20] --\n", + "│ │ └─Sequential: 3-83 [2, 1248, 18, 20] 262,080\n", + "│ │ └─Sequential: 3-84 [2, 1248, 18, 20] 13,728\n", + "│ │ └─Sequential: 3-85 [2, 1248, 18, 20] 780,312\n", + "│ │ └─Sequential: 3-86 [2, 352, 18, 20] 440,000\n", + "│ └─MBConvBlock: 2-27 [2, 352, 18, 20] --\n", + "│ │ └─Sequential: 3-87 [2, 2112, 18, 20] 747,648\n", + "│ │ └─Sequential: 3-88 [2, 2112, 18, 20] 23,232\n", + "│ │ └─Sequential: 3-89 [2, 2112, 18, 20] 2,232,912\n", + "│ │ └─Sequential: 3-90 [2, 352, 18, 20] 744,128\n", + "├─Sequential: 1-3 [2, 1408, 18, 20] --\n", + "│ └─Conv2d: 2-28 [2, 1408, 18, 20] 495,616\n", + "│ └─BatchNorm2d: 2-29 [2, 1408, 18, 20] 2,816\n", "==========================================================================================\n", - "Total params: 7,142,272\n", - "Trainable params: 7,142,272\n", + "Total params: 14,268,928\n", + "Trainable params: 14,268,928\n", "Non-trainable params: 0\n", - "Total mult-adds (G): 11.27\n", + "Total mult-adds (G): 20.53\n", "==========================================================================================\n", "Input size (MB): 2.95\n", - "Forward/backward pass size (MB): 1922.96\n", - "Params size (MB): 28.57\n", - "Estimated Total Size (MB): 1954.48\n", + "Forward/backward pass size (MB): 2847.17\n", + "Params size (MB): 57.08\n", + "Estimated Total Size (MB): 2907.19\n", "==========================================================================================" ] }, - "execution_count": 9, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } |