Skip to content

Commit 8ea777e

Browse files
authored
Merge pull request open-mmlab#2326 from VoyagerXvoyagerx/dev-1.x
Fixe the bug in the visualization step.
2 parents c56a299 + ca1dc71 commit 8ea777e

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

demo/MMSegmentation_Tutorial.ipynb

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"## Install MMSegmentation\n",
3434
"This step may take several minutes. \n",
3535
"\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. "
3737
]
3838
},
3939
{
@@ -67,13 +67,13 @@
6767
"outputs": [],
6868
"source": [
6969
"# 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",
7171
"# Install mim\n",
7272
"!pip install -U openmim\n",
7373
"# Install mmengine\n",
7474
"!mim install mmengine\n",
7575
"# Install MMCV\n",
76-
"!mim install 'mmcv >= 2.0.0rc1'"
76+
"!mim install 'mmcv >= 2.0.0rc1'\n"
7777
]
7878
},
7979
{
@@ -500,16 +500,17 @@
500500
},
501501
"outputs": [],
502502
"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",
504504
"\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",
507508
"\n",
508509
"img = mmcv.imread('iccv09Data/images/6000124.jpg')\n",
509510
"result = inference_model(model, img)\n",
510511
"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"
513514
]
514515
}
515516
],
@@ -522,7 +523,7 @@
522523
"provenance": []
523524
},
524525
"kernelspec": {
525-
"display_name": "Python 3.7.13 ('pt1.12')",
526+
"display_name": "Python 3.8.5 ('tensorflow')",
526527
"language": "python",
527528
"name": "python3"
528529
},
@@ -536,7 +537,7 @@
536537
"name": "python",
537538
"nbconvert_exporter": "python",
538539
"pygments_lexer": "ipython3",
539-
"version": "3.7.13"
540+
"version": "3.8.5"
540541
},
541542
"pycharm": {
542543
"stem_cell": {
@@ -549,7 +550,7 @@
549550
},
550551
"vscode": {
551552
"interpreter": {
552-
"hash": "ffdb7915c29738c259ec7ee5d0d1b9253c264f1fd267d45dd77f1a420396c120"
553+
"hash": "20d4b83e0c8b3730b580c42434163d64f4b735d580303a8fade7c849d4d29eba"
553554
}
554555
}
555556
},

0 commit comments

Comments
 (0)