mirror of
https://github.com/open-mmlab/mmsegmentation.git
synced 2025-06-03 22:03:48 +08:00
fix-demo (#1269)
This commit is contained in:
parent
4de0c3708d
commit
0166616d49
@ -48,9 +48,9 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Check nvcc version\r\n",
|
||||
"!nvcc -V\r\n",
|
||||
"# Check GCC version\r\n",
|
||||
"# Check nvcc version\n",
|
||||
"!nvcc -V\n",
|
||||
"# Check GCC version\n",
|
||||
"!gcc --version"
|
||||
]
|
||||
},
|
||||
@ -66,9 +66,9 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Install PyTorch\r\n",
|
||||
"!pip install -U torch==1.5.0+cu101 torchvision==0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html\r\n",
|
||||
"# Install MMCV\r\n",
|
||||
"# Install PyTorch\n",
|
||||
"!pip install -U torch==1.5.0+cu101 torchvision==0.6.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html\n",
|
||||
"# Install MMCV\n",
|
||||
"!pip install mmcv-full==latest+torch1.5.0+cu101 -f https://download.openmmlab.com/mmcv/dist/index.html"
|
||||
]
|
||||
},
|
||||
@ -84,9 +84,9 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!rm -rf mmsegmentation\r\n",
|
||||
"!git clone https://github.com/open-mmlab/mmsegmentation.git \r\n",
|
||||
"%cd mmsegmentation\r\n",
|
||||
"!rm -rf mmsegmentation\n",
|
||||
"!git clone https://github.com/open-mmlab/mmsegmentation.git \n",
|
||||
"%cd mmsegmentation\n",
|
||||
"!pip install -e ."
|
||||
]
|
||||
},
|
||||
@ -102,12 +102,12 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Check Pytorch installation\r\n",
|
||||
"import torch, torchvision\r\n",
|
||||
"print(torch.__version__, torch.cuda.is_available())\r\n",
|
||||
"\r\n",
|
||||
"# Check MMSegmentation installation\r\n",
|
||||
"import mmseg\r\n",
|
||||
"# 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__)"
|
||||
]
|
||||
},
|
||||
@ -132,7 +132,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"!mkdir checkpoints\r\n",
|
||||
"!mkdir checkpoints\n",
|
||||
"!wget https://download.openmmlab.com/mmsegmentation/v0.5/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes/pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth -P checkpoints"
|
||||
]
|
||||
},
|
||||
@ -144,7 +144,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from mmseg.apis import inference_segmentor, init_segmentor, show_result_pyplot\r\n",
|
||||
"from mmseg.apis import inference_segmentor, init_segmentor, show_result_pyplot\n",
|
||||
"from mmseg.core.evaluation import get_palette"
|
||||
]
|
||||
},
|
||||
@ -156,8 +156,8 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"config_file = 'configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py'\r\n",
|
||||
"checkpoint_file = 'checkpoints/pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth'"
|
||||
"config_file = '../configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py'\n",
|
||||
"checkpoint_file = '../checkpoints/pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth'"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -172,7 +172,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# build the model from a config file and a checkpoint file\r\n",
|
||||
"# build the model from a config file and a checkpoint file\n",
|
||||
"model = init_segmentor(config_file, checkpoint_file, device='cuda:0')"
|
||||
]
|
||||
},
|
||||
@ -185,7 +185,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# test a single image\n",
|
||||
"img = 'demo/demo.png'\n",
|
||||
"img = './demo.png'\n",
|
||||
"result = inference_segmentor(model, img)"
|
||||
]
|
||||
},
|
||||
@ -202,7 +202,7 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# show the results\r\n",
|
||||
"# show the results\n",
|
||||
"show_result_pyplot(model, img, result, get_palette('cityscapes'))"
|
||||
]
|
||||
},
|
||||
@ -248,8 +248,8 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# download and unzip\r\n",
|
||||
"!wget http://dags.stanford.edu/data/iccv09Data.tar.gz -O standford_background.tar.gz\r\n",
|
||||
"# download and unzip\n",
|
||||
"!wget http://dags.stanford.edu/data/iccv09Data.tar.gz -O standford_background.tar.gz\n",
|
||||
"!tar xf standford_background.tar.gz"
|
||||
]
|
||||
},
|
||||
@ -266,13 +266,13 @@
|
||||
},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"# Let's take a look at the dataset\r\n",
|
||||
"import mmcv\r\n",
|
||||
"import matplotlib.pyplot as plt\r\n",
|
||||
"\r\n",
|
||||
"img = mmcv.imread('iccv09Data/images/6000124.jpg')\r\n",
|
||||
"plt.figure(figsize=(8, 6))\r\n",
|
||||
"plt.imshow(mmcv.bgr2rgb(img))\r\n",
|
||||
"# Let's take a look at the dataset\n",
|
||||
"import mmcv\n",
|
||||
"import matplotlib.pyplot as plt\n",
|
||||
"\n",
|
||||
"img = mmcv.imread('iccv09Data/images/6000124.jpg')\n",
|
||||
"plt.figure(figsize=(8, 6))\n",
|
||||
"plt.imshow(mmcv.bgr2rgb(img))\n",
|
||||
"plt.show()"
|
||||
]
|
||||
},
|
||||
@ -414,7 +414,7 @@
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from mmcv import Config\n",
|
||||
"cfg = Config.fromfile('configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py')"
|
||||
"cfg = Config.fromfile('../configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py')"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -620,8 +620,21 @@
|
||||
},
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.0"
|
||||
},
|
||||
"pycharm": {
|
||||
"stem_cell": {
|
||||
"cell_type": "raw",
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user