|
|
@ -23,7 +23,7 @@
|
|
|
|
"colab_type": "text"
|
|
|
|
"colab_type": "text"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
|
"<a href=\"https://colab.research.google.com/github/rwightman/pytorch-image-models/blob/master/notebooks/EffResNetComparison.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
|
|
|
"<a href=\"https://colab.research.google.com/github/rwightman/pytorch-image-models/blob/master/notebook/EffResNetComparison.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
|
|
|
]
|
|
|
|
]
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1114,39 +1114,40 @@
|
|
|
|
"base_uri": "https://localhost:8080/",
|
|
|
|
"base_uri": "https://localhost:8080/",
|
|
|
|
"height": 357
|
|
|
|
"height": 357
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"outputId": "8240c5e3-98d5-4351-828d-3c133969d0d1"
|
|
|
|
"outputId": "f47bfaa1-d78a-4d2f-a325-8fe247acc46a"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
|
"print('Results by image rate:')\n",
|
|
|
|
"print('Results by image rate:')\n",
|
|
|
|
"results_by_rate = list(sorted(results.keys(), key=lambda x: results[x]['rate'], reverse=True))\n",
|
|
|
|
"results_by_rate = list(sorted(results.keys(), key=lambda x: results[x]['rate'], reverse=True))\n",
|
|
|
|
"for m in results_by_rate:\n",
|
|
|
|
"for m in results_by_rate:\n",
|
|
|
|
" print(' Model: {:34}, Rate: {:4.2f}, Top-1 {}, Top-5: {}'.format(m, results[m]['rate'], results[m]['top1'], results[m]['top5']))\n",
|
|
|
|
" print(' {:32} Rate: {:>6.2f}, Top-1 {:.2f}, Top-5: {:.2f}'.format(\n",
|
|
|
|
|
|
|
|
" m, results[m]['rate'], results[m]['top1'], results[m]['top5']))\n",
|
|
|
|
"print()\n"
|
|
|
|
"print()\n"
|
|
|
|
],
|
|
|
|
],
|
|
|
|
"execution_count": 13,
|
|
|
|
"execution_count": 44,
|
|
|
|
"outputs": [
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"output_type": "stream",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"text": [
|
|
|
|
"Results by image rate:\n",
|
|
|
|
"Results by image rate:\n",
|
|
|
|
" Model: efficientnet_b0-224 , Rate: 165.73, Top-1 64.58, Top-5: 85.89\n",
|
|
|
|
" efficientnet_b0-224 Rate: 165.73, Top-1 64.58, Top-5: 85.89\n",
|
|
|
|
" Model: resnet50-224 , Rate: 159.51, Top-1 66.81, Top-5: 87.0\n",
|
|
|
|
" resnet50-224 Rate: 159.51, Top-1 66.81, Top-5: 87.00\n",
|
|
|
|
" Model: dpn68b-224 , Rate: 155.15, Top-1 65.6, Top-5: 85.94\n",
|
|
|
|
" dpn68b-224 Rate: 155.15, Top-1 65.60, Top-5: 85.94\n",
|
|
|
|
" Model: resnet50-240-ttp , Rate: 154.35, Top-1 67.02, Top-5: 87.04\n",
|
|
|
|
" resnet50-240-ttp Rate: 154.35, Top-1 67.02, Top-5: 87.04\n",
|
|
|
|
" Model: efficientnet_b1-240 , Rate: 151.63, Top-1 67.55, Top-5: 87.29\n",
|
|
|
|
" efficientnet_b1-240 Rate: 151.63, Top-1 67.55, Top-5: 87.29\n",
|
|
|
|
" Model: gluon_seresnext50_32x4d-224 , Rate: 150.43, Top-1 68.67, Top-5: 88.32\n",
|
|
|
|
" gluon_seresnext50_32x4d-224 Rate: 150.43, Top-1 68.67, Top-5: 88.32\n",
|
|
|
|
" Model: efficientnet_b2-260 , Rate: 144.20, Top-1 67.8, Top-5: 88.2\n",
|
|
|
|
" efficientnet_b2-260 Rate: 144.20, Top-1 67.80, Top-5: 88.20\n",
|
|
|
|
" Model: tf_efficientnet_b2-260 , Rate: 142.73, Top-1 67.4, Top-5: 87.58\n",
|
|
|
|
" tf_efficientnet_b2-260 Rate: 142.73, Top-1 67.40, Top-5: 87.58\n",
|
|
|
|
" Model: resnet50-260-ttp , Rate: 135.92, Top-1 67.63, Top-5: 87.63\n",
|
|
|
|
" resnet50-260-ttp Rate: 135.92, Top-1 67.63, Top-5: 87.63\n",
|
|
|
|
" Model: gluon_seresnext101_32x4d-224 , Rate: 131.57, Top-1 70.01, Top-5: 88.91\n",
|
|
|
|
" gluon_seresnext101_32x4d-224 Rate: 131.57, Top-1 70.01, Top-5: 88.91\n",
|
|
|
|
" Model: gluon_seresnext50_32x4d-260-ttp , Rate: 126.52, Top-1 69.67, Top-5: 88.62\n",
|
|
|
|
" gluon_seresnext50_32x4d-260-ttp Rate: 126.52, Top-1 69.67, Top-5: 88.62\n",
|
|
|
|
" Model: tf_efficientnet_b3-300 , Rate: 119.13, Top-1 68.52, Top-5: 88.7\n",
|
|
|
|
" tf_efficientnet_b3-300 Rate: 119.13, Top-1 68.52, Top-5: 88.70\n",
|
|
|
|
" Model: gluon_seresnext50_32x4d-300-ttp , Rate: 104.69, Top-1 70.47, Top-5: 89.18\n",
|
|
|
|
" gluon_seresnext50_32x4d-300-ttp Rate: 104.69, Top-1 70.47, Top-5: 89.18\n",
|
|
|
|
" Model: gluon_seresnext101_32x4d-260-ttp , Rate: 95.84, Top-1 71.14, Top-5: 89.47\n",
|
|
|
|
" gluon_seresnext101_32x4d-260-ttp Rate: 95.84, Top-1 71.14, Top-5: 89.47\n",
|
|
|
|
" Model: ig_resnext101_32x8d-224 , Rate: 83.35, Top-1 73.83, Top-5: 92.28\n",
|
|
|
|
" ig_resnext101_32x8d-224 Rate: 83.35, Top-1 73.83, Top-5: 92.28\n",
|
|
|
|
" Model: gluon_seresnext101_32x4d-300-ttp , Rate: 74.87, Top-1 71.99, Top-5: 90.1\n",
|
|
|
|
" gluon_seresnext101_32x4d-300-ttp Rate: 74.87, Top-1 71.99, Top-5: 90.10\n",
|
|
|
|
" Model: tf_efficientnet_b4-380 , Rate: 69.10, Top-1 71.34, Top-5: 90.11\n",
|
|
|
|
" tf_efficientnet_b4-380 Rate: 69.10, Top-1 71.34, Top-5: 90.11\n",
|
|
|
|
" Model: ig_resnext101_32x8d-300-ttp , Rate: 43.62, Top-1 75.17, Top-5: 92.66\n",
|
|
|
|
" ig_resnext101_32x8d-300-ttp Rate: 43.62, Top-1 75.17, Top-5: 92.66\n",
|
|
|
|
"\n"
|
|
|
|
"\n"
|
|
|
|
],
|
|
|
|
],
|
|
|
|
"name": "stdout"
|
|
|
|
"name": "stdout"
|
|
|
@ -1240,38 +1241,39 @@
|
|
|
|
"base_uri": "https://localhost:8080/",
|
|
|
|
"base_uri": "https://localhost:8080/",
|
|
|
|
"height": 340
|
|
|
|
"height": 340
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"outputId": "d314f5d8-d860-4ff7-9ec8-beba349e616b"
|
|
|
|
"outputId": "d8d0db4a-ccca-4ac2-85e6-011535f29c1e"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
|
"print('Results by GPU memory usage:')\n",
|
|
|
|
"print('Results by GPU memory usage:')\n",
|
|
|
|
"results_by_mem = list(sorted(results.keys(), key=lambda x: results[x]['gpu_used'], reverse=False))\n",
|
|
|
|
"results_by_mem = list(sorted(results.keys(), key=lambda x: results[x]['gpu_used'], reverse=False))\n",
|
|
|
|
"for m in results_by_mem:\n",
|
|
|
|
"for m in results_by_mem:\n",
|
|
|
|
" print(' Model: {:34}, GPU Mem: {}, Rate: {:4.2f}, Top-1 {}, Top-5: {}'.format(m, results[m]['gpu_used'], results[m]['rate'], results[m]['top1'], results[m]['top5']))"
|
|
|
|
" print(' {:32} Mem: {}, Rate: {:>6.2f}, Top-1 {:.2f}, Top-5: {:.2f}'.format(\n",
|
|
|
|
|
|
|
|
" m, results[m]['gpu_used'], results[m]['rate'], results[m]['top1'], results[m]['top5']))"
|
|
|
|
],
|
|
|
|
],
|
|
|
|
"execution_count": 15,
|
|
|
|
"execution_count": 46,
|
|
|
|
"outputs": [
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"output_type": "stream",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"text": [
|
|
|
|
"Results by GPU memory usage:\n",
|
|
|
|
"Results by GPU memory usage:\n",
|
|
|
|
" Model: resnet50-224 , GPU Mem: 1530, Rate: 159.51, Top-1 66.81, Top-5: 87.0\n",
|
|
|
|
" resnet50-224 Mem: 1530, Rate: 159.51, Top-1 66.81, Top-5: 87.00\n",
|
|
|
|
" Model: gluon_seresnext50_32x4d-224 , GPU Mem: 1670, Rate: 150.43, Top-1 68.67, Top-5: 88.32\n",
|
|
|
|
" gluon_seresnext50_32x4d-224 Mem: 1670, Rate: 150.43, Top-1 68.67, Top-5: 88.32\n",
|
|
|
|
" Model: gluon_seresnext101_32x4d-224 , GPU Mem: 1814, Rate: 131.57, Top-1 70.01, Top-5: 88.91\n",
|
|
|
|
" gluon_seresnext101_32x4d-224 Mem: 1814, Rate: 131.57, Top-1 70.01, Top-5: 88.91\n",
|
|
|
|
" Model: resnet50-240-ttp , GPU Mem: 2084, Rate: 154.35, Top-1 67.02, Top-5: 87.04\n",
|
|
|
|
" resnet50-240-ttp Mem: 2084, Rate: 154.35, Top-1 67.02, Top-5: 87.04\n",
|
|
|
|
" Model: gluon_seresnext101_32x4d-260-ttp , GPU Mem: 2452, Rate: 95.84, Top-1 71.14, Top-5: 89.47\n",
|
|
|
|
" gluon_seresnext101_32x4d-260-ttp Mem: 2452, Rate: 95.84, Top-1 71.14, Top-5: 89.47\n",
|
|
|
|
" Model: resnet50-260-ttp , GPU Mem: 2532, Rate: 135.92, Top-1 67.63, Top-5: 87.63\n",
|
|
|
|
" resnet50-260-ttp Mem: 2532, Rate: 135.92, Top-1 67.63, Top-5: 87.63\n",
|
|
|
|
" Model: gluon_seresnext50_32x4d-260-ttp , GPU Mem: 2586, Rate: 126.52, Top-1 69.67, Top-5: 88.62\n",
|
|
|
|
" gluon_seresnext50_32x4d-260-ttp Mem: 2586, Rate: 126.52, Top-1 69.67, Top-5: 88.62\n",
|
|
|
|
" Model: dpn68b-224 , GPU Mem: 2898, Rate: 155.15, Top-1 65.6, Top-5: 85.94\n",
|
|
|
|
" dpn68b-224 Mem: 2898, Rate: 155.15, Top-1 65.60, Top-5: 85.94\n",
|
|
|
|
" Model: efficientnet_b0-224 , GPU Mem: 2930, Rate: 165.73, Top-1 64.58, Top-5: 85.89\n",
|
|
|
|
" efficientnet_b0-224 Mem: 2930, Rate: 165.73, Top-1 64.58, Top-5: 85.89\n",
|
|
|
|
" Model: gluon_seresnext101_32x4d-300-ttp , GPU Mem: 3252, Rate: 74.87, Top-1 71.99, Top-5: 90.1\n",
|
|
|
|
" gluon_seresnext101_32x4d-300-ttp Mem: 3252, Rate: 74.87, Top-1 71.99, Top-5: 90.10\n",
|
|
|
|
" Model: gluon_seresnext50_32x4d-300-ttp , GPU Mem: 3300, Rate: 104.69, Top-1 70.47, Top-5: 89.18\n",
|
|
|
|
" gluon_seresnext50_32x4d-300-ttp Mem: 3300, Rate: 104.69, Top-1 70.47, Top-5: 89.18\n",
|
|
|
|
" Model: efficientnet_b1-240 , GPU Mem: 3370, Rate: 151.63, Top-1 67.55, Top-5: 87.29\n",
|
|
|
|
" efficientnet_b1-240 Mem: 3370, Rate: 151.63, Top-1 67.55, Top-5: 87.29\n",
|
|
|
|
" Model: ig_resnext101_32x8d-224 , GPU Mem: 3382, Rate: 83.35, Top-1 73.83, Top-5: 92.28\n",
|
|
|
|
" ig_resnext101_32x8d-224 Mem: 3382, Rate: 83.35, Top-1 73.83, Top-5: 92.28\n",
|
|
|
|
" Model: efficientnet_b2-260 , GPU Mem: 3992, Rate: 144.20, Top-1 67.8, Top-5: 88.2\n",
|
|
|
|
" efficientnet_b2-260 Mem: 3992, Rate: 144.20, Top-1 67.80, Top-5: 88.20\n",
|
|
|
|
" Model: ig_resnext101_32x8d-300-ttp , GPU Mem: 4658, Rate: 43.62, Top-1 75.17, Top-5: 92.66\n",
|
|
|
|
" ig_resnext101_32x8d-300-ttp Mem: 4658, Rate: 43.62, Top-1 75.17, Top-5: 92.66\n",
|
|
|
|
" Model: tf_efficientnet_b2-260 , GPU Mem: 4690, Rate: 142.73, Top-1 67.4, Top-5: 87.58\n",
|
|
|
|
" tf_efficientnet_b2-260 Mem: 4690, Rate: 142.73, Top-1 67.40, Top-5: 87.58\n",
|
|
|
|
" Model: tf_efficientnet_b3-300 , GPU Mem: 8638, Rate: 119.13, Top-1 68.52, Top-5: 88.7\n",
|
|
|
|
" tf_efficientnet_b3-300 Mem: 8638, Rate: 119.13, Top-1 68.52, Top-5: 88.70\n",
|
|
|
|
" Model: tf_efficientnet_b4-380 , GPU Mem: 11754, Rate: 69.10, Top-1 71.34, Top-5: 90.11\n"
|
|
|
|
" tf_efficientnet_b4-380 Mem: 11754, Rate: 69.10, Top-1 71.34, Top-5: 90.11\n"
|
|
|
|
],
|
|
|
|
],
|
|
|
|
"name": "stdout"
|
|
|
|
"name": "stdout"
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1355,7 +1357,7 @@
|
|
|
|
"base_uri": "https://localhost:8080/",
|
|
|
|
"base_uri": "https://localhost:8080/",
|
|
|
|
"height": 187
|
|
|
|
"height": 187
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"outputId": "0b98b99e-c1f2-439c-f6fc-6b789f816a78"
|
|
|
|
"outputId": "83f55196-040a-4a2a-a49e-e6629c38ce83"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"source": [
|
|
|
|
"source": [
|
|
|
|
"def compare_results(results, namea, nameb):\n",
|
|
|
|
"def compare_results(results, namea, nameb):\n",
|
|
|
@ -1364,7 +1366,7 @@
|
|
|
|
" top5r = 100. * (resa['top5'] - resb['top5']) / resb['top5']\n",
|
|
|
|
" top5r = 100. * (resa['top5'] - resb['top5']) / resb['top5']\n",
|
|
|
|
" rater = 100. * (resa['rate'] - resb['rate']) / resb['rate']\n",
|
|
|
|
" rater = 100. * (resa['rate'] - resb['rate']) / resb['rate']\n",
|
|
|
|
" memr = 100. * (resa['gpu_used'] - resb['gpu_used']) / resb['gpu_used']\n",
|
|
|
|
" memr = 100. * (resa['gpu_used'] - resb['gpu_used']) / resb['gpu_used']\n",
|
|
|
|
" print('{:24} vs {:30} top1: {:+.3f}%, top5: {:+.3f}%, rate: {:+.2f}%, gpu memory: {:+.2f}%'.format(\n",
|
|
|
|
" print('{:22} vs {:28} top1: {:+4.2f}%, top5: {:+4.2f}%, rate: {:+4.2f}%, mem: {:+.2f}%'.format(\n",
|
|
|
|
" namea, nameb, top1r, top5r, rater, memr))\n",
|
|
|
|
" namea, nameb, top1r, top5r, rater, memr))\n",
|
|
|
|
" \n",
|
|
|
|
" \n",
|
|
|
|
"#compare_results(results, 'efficientnet_b0-224', 'seresnext26_32x4d-224')\n",
|
|
|
|
"#compare_results(results, 'efficientnet_b0-224', 'seresnext26_32x4d-224')\n",
|
|
|
@ -1379,21 +1381,21 @@
|
|
|
|
"print('\\nNote the cost of running with the SAME padding hack:')\n",
|
|
|
|
"print('\\nNote the cost of running with the SAME padding hack:')\n",
|
|
|
|
"compare_results(results, 'tf_efficientnet_b2-260', 'efficientnet_b2-260')"
|
|
|
|
"compare_results(results, 'tf_efficientnet_b2-260', 'efficientnet_b2-260')"
|
|
|
|
],
|
|
|
|
],
|
|
|
|
"execution_count": 17,
|
|
|
|
"execution_count": 34,
|
|
|
|
"outputs": [
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"output_type": "stream",
|
|
|
|
"output_type": "stream",
|
|
|
|
"text": [
|
|
|
|
"text": [
|
|
|
|
"efficientnet_b0-224 vs dpn68b-224 top1: -1.555%, top5: -0.058%, rate: +6.82%, gpu memory: +1.10%\n",
|
|
|
|
"efficientnet_b0-224 vs dpn68b-224 top1: -1.55%, top5: -0.06%, rate: +6.82%, mem: +1.10%\n",
|
|
|
|
"efficientnet_b1-240 vs resnet50-224 top1: +1.108%, top5: +0.333%, rate: -4.94%, gpu memory: +120.26%\n",
|
|
|
|
"efficientnet_b1-240 vs resnet50-224 top1: +1.11%, top5: +0.33%, rate: -4.94%, mem: +120.26%\n",
|
|
|
|
"efficientnet_b1-240 vs resnet50-240-ttp top1: +0.791%, top5: +0.287%, rate: -1.76%, gpu memory: +61.71%\n",
|
|
|
|
"efficientnet_b1-240 vs resnet50-240-ttp top1: +0.79%, top5: +0.29%, rate: -1.76%, mem: +61.71%\n",
|
|
|
|
"efficientnet_b2-260 vs gluon_seresnext50_32x4d-224 top1: -1.267%, top5: -0.136%, rate: -4.14%, gpu memory: +139.04%\n",
|
|
|
|
"efficientnet_b2-260 vs gluon_seresnext50_32x4d-224 top1: -1.27%, top5: -0.14%, rate: -4.14%, mem: +139.04%\n",
|
|
|
|
"tf_efficientnet_b3-300 vs gluon_seresnext50_32x4d-224 top1: -0.218%, top5: +0.430%, rate: -20.81%, gpu memory: +417.25%\n",
|
|
|
|
"tf_efficientnet_b3-300 vs gluon_seresnext50_32x4d-224 top1: -0.22%, top5: +0.43%, rate: -20.81%, mem: +417.25%\n",
|
|
|
|
"tf_efficientnet_b3-300 vs gluon_seresnext101_32x4d-224 top1: -2.128%, top5: -0.236%, rate: -9.45%, gpu memory: +376.19%\n",
|
|
|
|
"tf_efficientnet_b3-300 vs gluon_seresnext101_32x4d-224 top1: -2.13%, top5: -0.24%, rate: -9.45%, mem: +376.19%\n",
|
|
|
|
"tf_efficientnet_b4-380 vs ig_resnext101_32x8d-224 top1: -3.373%, top5: -2.352%, rate: -17.10%, gpu memory: +247.55%\n",
|
|
|
|
"tf_efficientnet_b4-380 vs ig_resnext101_32x8d-224 top1: -3.37%, top5: -2.35%, rate: -17.10%, mem: +247.55%\n",
|
|
|
|
"\n",
|
|
|
|
"\n",
|
|
|
|
"Note the cost of running with the SAME padding hack:\n",
|
|
|
|
"Note the cost of running with the SAME padding hack:\n",
|
|
|
|
"tf_efficientnet_b2-260 vs efficientnet_b2-260 top1: -0.590%, top5: -0.703%, rate: -1.02%, gpu memory: +17.48%\n"
|
|
|
|
"tf_efficientnet_b2-260 vs efficientnet_b2-260 top1: -0.59%, top5: -0.70%, rate: -1.02%, mem: +17.48%\n"
|
|
|
|
],
|
|
|
|
],
|
|
|
|
"name": "stdout"
|
|
|
|
"name": "stdout"
|
|
|
|
}
|
|
|
|
}
|
|
|
|