Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixe the bug in the visualization step. #2326

Merged
merged 5 commits into from
Nov 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions demo/MMSegmentation_Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"## Install MMSegmentation\n",
"This step may take several minutes. \n",
"\n",
"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. "
"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. "
]
},
{
Expand All @@ -49,9 +49,13 @@
"outputs": [],
"source": [
"# Check nvcc version\n",
"import torch\n",
"import torchvision\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think not everyone has torch installed, so it would be better to install torch before call import torch

"!nvcc -V\n",
"# Check GCC version\n",
"!gcc --version"
"!gcc - -version\n",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"!gcc - -version\n",
"!gcc --version\n",

"# Check Pytorch installation\n",
"print(torch.__version__, torch.cuda.is_available())"
]
},
{
Expand All @@ -66,8 +70,6 @@
},
"outputs": [],
"source": [
"# Install PyTorch\n",
"!conda install pytorch=1.10.0 torchvision cudatoolkit=11.1 -c pytorch\n",
"# Install mim\n",
"!pip install -U openmim\n",
"# Install mmengine\n",
Expand Down Expand Up @@ -106,10 +108,6 @@
},
"outputs": [],
"source": [
"# Check Pytorch installation\n",
"import torch, torchvision\n",
"print(torch.__version__, torch.cuda.is_available())\n",
"\n",
"# Check MMSegmentation installation\n",
"import mmseg\n",
"print(mmseg.__version__)"
Expand Down Expand Up @@ -500,16 +498,17 @@
},
"outputs": [],
"source": [
"from mmseg.apis import inference_model, show_result_pyplot\n",
"from mmseg.apis import init_model, inference_model, show_result_pyplot\n",
"\n",
"model=runner.model\n",
"model.cfg=cfg\n",
"# Init the model from the config and the checkpoint\n",
"checkpoint_path = './work_dirs/tutorial/iter_200.pth'\n",
"model = init_model(cfg, checkpoint_path, 'cuda:0')\n",
"\n",
"img = mmcv.imread('iccv09Data/images/6000124.jpg')\n",
"result = inference_model(model, img)\n",
"plt.figure(figsize=(8, 6))\n",
"vis_result = show_result_pyplot(model, img, result, palette)\n",
"plt.imshow(mmcv.bgr2rgb(vis_result))"
"vis_result = show_result_pyplot(model, img, result)\n",
"plt.imshow(mmcv.bgr2rgb(vis_result))\n"
]
}
],
Expand Down