|
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 installed in Colab for this tutorial. You may install other versions by change the version number in pip install command. " |
37 | 37 | ] |
38 | 38 | }, |
39 | 39 | { |
|
49 | 49 | "outputs": [], |
50 | 50 | "source": [ |
51 | 51 | "# Check nvcc version\n", |
| 52 | + "import torch\n", |
| 53 | + "import torchvision\n", |
52 | 54 | "!nvcc -V\n", |
53 | 55 | "# Check GCC version\n", |
54 | | - "!gcc --version" |
| 56 | + "!gcc - -version\n", |
| 57 | + "# Check Pytorch installation\n", |
| 58 | + "print(torch.__version__, torch.cuda.is_available())" |
55 | 59 | ] |
56 | 60 | }, |
57 | 61 | { |
|
66 | 70 | }, |
67 | 71 | "outputs": [], |
68 | 72 | "source": [ |
69 | | - "# Install PyTorch\n", |
70 | | - "!conda install pytorch=1.10.0 torchvision cudatoolkit=11.1 -c pytorch\n", |
71 | 73 | "# Install mim\n", |
72 | 74 | "!pip install -U openmim\n", |
73 | 75 | "# Install mmengine\n", |
|
106 | 108 | }, |
107 | 109 | "outputs": [], |
108 | 110 | "source": [ |
109 | | - "# Check Pytorch installation\n", |
110 | | - "import torch, torchvision\n", |
111 | | - "print(torch.__version__, torch.cuda.is_available())\n", |
112 | | - "\n", |
113 | 111 | "# Check MMSegmentation installation\n", |
114 | 112 | "import mmseg\n", |
115 | 113 | "print(mmseg.__version__)" |
|
500 | 498 | }, |
501 | 499 | "outputs": [], |
502 | 500 | "source": [ |
503 | | - "from mmseg.apis import inference_model, show_result_pyplot\n", |
| 501 | + "from mmseg.apis import init_model, inference_model, show_result_pyplot\n", |
504 | 502 | "\n", |
505 | | - "model=runner.model\n", |
506 | | - "model.cfg=cfg\n", |
| 503 | + "# Init the model from the config and the checkpoint\n", |
| 504 | + "checkpoint_path = './work_dirs/tutorial/iter_200.pth'\n", |
| 505 | + "model = init_model(cfg, checkpoint_path, 'cuda:0')\n", |
507 | 506 | "\n", |
508 | 507 | "img = mmcv.imread('iccv09Data/images/6000124.jpg')\n", |
509 | 508 | "result = inference_model(model, img)\n", |
510 | 509 | "plt.figure(figsize=(8, 6))\n", |
511 | | - "vis_result = show_result_pyplot(model, img, result, palette)\n", |
512 | | - "plt.imshow(mmcv.bgr2rgb(vis_result))" |
| 510 | + "vis_result = show_result_pyplot(model, img, result)\n", |
| 511 | + "plt.imshow(mmcv.bgr2rgb(vis_result))\n" |
513 | 512 | ] |
514 | 513 | } |
515 | 514 | ], |
|
0 commit comments