|
33 | 33 | "## Install MMSegmentation\n", |
34 | 34 | "This step may take several minutes. \n", |
35 | 35 | "\n", |
36 | | - "We use PyTorch 1.10 and CUDA 11.1 for this tutorial. You may install other versions by change the version number in pip install command. " |
| 36 | + "We use PyTorch 1.12 and CUDA 11.3 for this tutorial. You may install other versions by change the version number in pip install command. " |
37 | 37 | ] |
38 | 38 | }, |
39 | 39 | { |
|
67 | 67 | "outputs": [], |
68 | 68 | "source": [ |
69 | 69 | "# Install PyTorch\n", |
70 | | - "!conda install pytorch=1.10.0 torchvision cudatoolkit=11.1 -c pytorch\n", |
| 70 | + "!conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.3 -c pytorch\n", |
71 | 71 | "# Install mim\n", |
72 | 72 | "!pip install -U openmim\n", |
73 | 73 | "# Install mmengine\n", |
74 | 74 | "!mim install mmengine\n", |
75 | 75 | "# Install MMCV\n", |
76 | | - "!mim install 'mmcv >= 2.0.0rc1'" |
| 76 | + "!mim install 'mmcv >= 2.0.0rc1'\n" |
77 | 77 | ] |
78 | 78 | }, |
79 | 79 | { |
|
500 | 500 | }, |
501 | 501 | "outputs": [], |
502 | 502 | "source": [ |
503 | | - "from mmseg.apis import inference_model, show_result_pyplot\n", |
| 503 | + "from mmseg.apis import init_model, inference_model, show_result_pyplot\n", |
504 | 504 | "\n", |
505 | | - "model=runner.model\n", |
506 | | - "model.cfg=cfg\n", |
| 505 | + "# Init the model from the config and the checkpoint\n", |
| 506 | + "checkpoint_path = './work_dirs/tutorial/iter_200.pth'\n", |
| 507 | + "model = init_model(cfg, checkpoint_path, 'cuda:0')\n", |
507 | 508 | "\n", |
508 | 509 | "img = mmcv.imread('iccv09Data/images/6000124.jpg')\n", |
509 | 510 | "result = inference_model(model, img)\n", |
510 | 511 | "plt.figure(figsize=(8, 6))\n", |
511 | | - "vis_result = show_result_pyplot(model, img, result, palette)\n", |
512 | | - "plt.imshow(mmcv.bgr2rgb(vis_result))" |
| 512 | + "vis_result = show_result_pyplot(model, img, result)\n", |
| 513 | + "plt.imshow(mmcv.bgr2rgb(vis_result))\n" |
513 | 514 | ] |
514 | 515 | } |
515 | 516 | ], |
|
522 | 523 | "provenance": [] |
523 | 524 | }, |
524 | 525 | "kernelspec": { |
525 | | - "display_name": "Python 3.7.13 ('pt1.12')", |
| 526 | + "display_name": "Python 3.8.5 ('tensorflow')", |
526 | 527 | "language": "python", |
527 | 528 | "name": "python3" |
528 | 529 | }, |
|
536 | 537 | "name": "python", |
537 | 538 | "nbconvert_exporter": "python", |
538 | 539 | "pygments_lexer": "ipython3", |
539 | | - "version": "3.7.13" |
| 540 | + "version": "3.8.5" |
540 | 541 | }, |
541 | 542 | "pycharm": { |
542 | 543 | "stem_cell": { |
|
549 | 550 | }, |
550 | 551 | "vscode": { |
551 | 552 | "interpreter": { |
552 | | - "hash": "ffdb7915c29738c259ec7ee5d0d1b9253c264f1fd267d45dd77f1a420396c120" |
| 553 | + "hash": "20d4b83e0c8b3730b580c42434163d64f4b735d580303a8fade7c849d4d29eba" |
553 | 554 | } |
554 | 555 | } |
555 | 556 | }, |
|
0 commit comments