|
8 | 8 | "# Reparameterization"
|
9 | 9 | ]
|
10 | 10 | },
|
| 11 | + { |
| 12 | + "cell_type": "markdown", |
| 13 | + "id": "9725e211", |
| 14 | + "metadata": {}, |
| 15 | + "source": [ |
| 16 | + "\n", |
| 17 | + "### What is Reparameterization ?\n", |
| 18 | + "Reparameterization is used to reduce trainable BoF modules into deploy model for fast inference. For example merge BN to conv, merge YOLOR to conv, ..etc\n", |
| 19 | + "However, before reparameterization, the model has more parameters and computation cost.reparameterized model (cfg/deploy) used for deployment purpose\n", |
| 20 | + "\n", |
| 21 | + "\n", |
| 22 | + "\n", |
| 23 | + "### Steps required for model conversion.\n", |
| 24 | + "1.train custom model & you will get your own weight i.e custom_weight.pt / use (pretrained weight which is available i.e yolov7_traing.pt)\n", |
| 25 | + "\n", |
| 26 | + "2.Converting this weight using Reparameterization method.\n", |
| 27 | + "\n", |
| 28 | + "3.Trained model (cfg/training) and reparameterized model (cfg/deploy) will get same prediction results.\n", |
| 29 | + "However, before reparameterization, the model has more parameters and computation cost.\n", |
| 30 | + "\n", |
| 31 | + "4.Convert reparameterized weight into onnx & tensorrt\n", |
| 32 | + "For faster inference & deployment purpose." |
| 33 | + ] |
| 34 | + }, |
11 | 35 | {
|
12 | 36 | "cell_type": "markdown",
|
13 | 37 | "id": "13393b70",
|
|
32 | 56 | "\n",
|
33 | 57 | "device = select_device('0', batch_size=1)\n",
|
34 | 58 | "# model trained by cfg/training/*.yaml\n",
|
35 |
| - "ckpt = torch.load('cfg/training/yolov7.pt', map_location=device)\n", |
| 59 | + "ckpt = torch.load('cfg/training/yolov7_training.pt', map_location=device)\n", |
36 | 60 | "# reparameterized model in cfg/deploy/*.yaml\n",
|
37 | 61 | "model = Model('cfg/deploy/yolov7.yaml', ch=3, nc=80).to(device)\n",
|
38 | 62 | "\n",
|
|
94 | 118 | "\n",
|
95 | 119 | "device = select_device('0', batch_size=1)\n",
|
96 | 120 | "# model trained by cfg/training/*.yaml\n",
|
97 |
| - "ckpt = torch.load('cfg/training/yolov7x.pt', map_location=device)\n", |
| 121 | + "ckpt = torch.load('cfg/training/yolov7x_trainig.pt', map_location=device)\n", |
98 | 122 | "# reparameterized model in cfg/deploy/*.yaml\n",
|
99 | 123 | "model = Model('cfg/deploy/yolov7x.yaml', ch=3, nc=80).to(device)\n",
|
100 | 124 | "\n",
|
|
156 | 180 | "\n",
|
157 | 181 | "device = select_device('0', batch_size=1)\n",
|
158 | 182 | "# model trained by cfg/training/*.yaml\n",
|
159 |
| - "ckpt = torch.load('cfg/training/yolov7-w6.pt', map_location=device)\n", |
| 183 | + "ckpt = torch.load('cfg/training/yolov7-w6_trainig.pt', map_location=device)\n", |
160 | 184 | "# reparameterized model in cfg/deploy/*.yaml\n",
|
161 | 185 | "model = Model('cfg/deploy/yolov7-w6.yaml', ch=3, nc=80).to(device)\n",
|
162 | 186 | "\n",
|
|
328 | 352 | "\n",
|
329 | 353 | "device = select_device('0', batch_size=1)\n",
|
330 | 354 | "# model trained by cfg/training/*.yaml\n",
|
331 |
| - "ckpt = torch.load('cfg/training/yolov7-d6.pt', map_location=device)\n", |
| 355 | + "ckpt = torch.load('cfg/training/yolov7-d6_trainig.pt', map_location=device)\n", |
332 | 356 | "# reparameterized model in cfg/deploy/*.yaml\n",
|
333 | 357 | "model = Model('cfg/deploy/yolov7-d6.yaml', ch=3, nc=80).to(device)\n",
|
334 | 358 | "\n",
|
|
414 | 438 | "\n",
|
415 | 439 | "device = select_device('0', batch_size=1)\n",
|
416 | 440 | "# model trained by cfg/training/*.yaml\n",
|
417 |
| - "ckpt = torch.load('cfg/training/yolov7-e6e.pt', map_location=device)\n", |
| 441 | + "ckpt = torch.load('cfg/training/yolov7-e6e_trainig.pt', map_location=device)\n", |
418 | 442 | "# reparameterized model in cfg/deploy/*.yaml\n",
|
419 | 443 | "model = Model('cfg/deploy/yolov7-e6e.yaml', ch=3, nc=80).to(device)\n",
|
420 | 444 | "\n",
|
|
487 | 511 | ],
|
488 | 512 | "metadata": {
|
489 | 513 | "kernelspec": {
|
490 |
| - "display_name": "Python 3.7.0 ('py37')", |
| 514 | + "display_name": "Python 3 (ipykernel)", |
491 | 515 | "language": "python",
|
492 | 516 | "name": "python3"
|
493 | 517 | },
|
|
501 | 525 | "name": "python",
|
502 | 526 | "nbconvert_exporter": "python",
|
503 | 527 | "pygments_lexer": "ipython3",
|
504 |
| - "version": "3.7.0" |
| 528 | + "version": "3.9.7" |
505 | 529 | },
|
506 | 530 | "vscode": {
|
507 | 531 | "interpreter": {
|
|
0 commit comments