hashb commited on
Commit
093713b
1 Parent(s): f970eef

Upload semantic_segmentation_segformer.ipynb

Browse files
Files changed (1) hide show
  1. semantic_segmentation_segformer.ipynb +416 -0
semantic_segmentation_segformer.ipynb ADDED
@@ -0,0 +1,416 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "provenance": [],
7
+ "collapsed_sections": [
8
+ "-tNVQkHnZfrs"
9
+ ]
10
+ },
11
+ "kernelspec": {
12
+ "name": "python3",
13
+ "display_name": "Python 3"
14
+ },
15
+ "language_info": {
16
+ "name": "python"
17
+ },
18
+ "gpuClass": "standard"
19
+ },
20
+ "cells": [
21
+ {
22
+ "cell_type": "markdown",
23
+ "source": [
24
+ "## Setup"
25
+ ],
26
+ "metadata": {
27
+ "id": "-tNVQkHnZfrs"
28
+ }
29
+ },
30
+ {
31
+ "cell_type": "code",
32
+ "source": [
33
+ "%cd /content/\n",
34
+ "%rm -rf semantic-segmentation\n",
35
+ "!git clone https://github.com/hb0313/semantic-segmentation\n",
36
+ "%cd semantic-segmentation\n",
37
+ "%pip install -e .\n",
38
+ "%pip install -U gdown"
39
+ ],
40
+ "metadata": {
41
+ "id": "pzBeWQDQZdic",
42
+ "colab": {
43
+ "base_uri": "https://localhost:8080/"
44
+ },
45
+ "outputId": "30620197-c859-44ec-d7aa-eeccd032cdcc"
46
+ },
47
+ "execution_count": 5,
48
+ "outputs": [
49
+ {
50
+ "output_type": "stream",
51
+ "name": "stdout",
52
+ "text": [
53
+ "/content\n",
54
+ "Cloning into 'semantic-segmentation'...\n",
55
+ "remote: Enumerating objects: 792, done.\u001b[K\n",
56
+ "remote: Counting objects: 100% (39/39), done.\u001b[K\n",
57
+ "remote: Compressing objects: 100% (28/28), done.\u001b[K\n",
58
+ "remote: Total 792 (delta 11), reused 31 (delta 11), pack-reused 753\u001b[K\n",
59
+ "Receiving objects: 100% (792/792), 55.00 MiB | 19.25 MiB/s, done.\n",
60
+ "Resolving deltas: 100% (462/462), done.\n",
61
+ "/content/semantic-segmentation\n",
62
+ "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
63
+ "Obtaining file:///content/semantic-segmentation\n",
64
+ "Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from semseg==0.4.1) (4.64.1)\n",
65
+ "Requirement already satisfied: tabulate in /usr/local/lib/python3.7/dist-packages (from semseg==0.4.1) (0.8.10)\n",
66
+ "Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (from semseg==0.4.1) (1.21.6)\n",
67
+ "Requirement already satisfied: scipy in /usr/local/lib/python3.7/dist-packages (from semseg==0.4.1) (1.7.3)\n",
68
+ "Requirement already satisfied: matplotlib in /usr/local/lib/python3.7/dist-packages (from semseg==0.4.1) (3.2.2)\n",
69
+ "Requirement already satisfied: tensorboard in /usr/local/lib/python3.7/dist-packages (from semseg==0.4.1) (2.8.0)\n",
70
+ "Requirement already satisfied: fvcore in /usr/local/lib/python3.7/dist-packages (from semseg==0.4.1) (0.1.5.post20220512)\n",
71
+ "Requirement already satisfied: einops in /usr/local/lib/python3.7/dist-packages (from semseg==0.4.1) (0.4.1)\n",
72
+ "Requirement already satisfied: rich in /usr/local/lib/python3.7/dist-packages (from semseg==0.4.1) (12.5.1)\n",
73
+ "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.7/dist-packages (from fvcore->semseg==0.4.1) (6.0)\n",
74
+ "Requirement already satisfied: iopath>=0.1.7 in /usr/local/lib/python3.7/dist-packages (from fvcore->semseg==0.4.1) (0.1.10)\n",
75
+ "Requirement already satisfied: Pillow in /usr/local/lib/python3.7/dist-packages (from fvcore->semseg==0.4.1) (7.1.2)\n",
76
+ "Requirement already satisfied: termcolor>=1.1 in /usr/local/lib/python3.7/dist-packages (from fvcore->semseg==0.4.1) (1.1.0)\n",
77
+ "Requirement already satisfied: yacs>=0.1.6 in /usr/local/lib/python3.7/dist-packages (from fvcore->semseg==0.4.1) (0.1.8)\n",
78
+ "Requirement already satisfied: portalocker in /usr/local/lib/python3.7/dist-packages (from iopath>=0.1.7->fvcore->semseg==0.4.1) (2.5.1)\n",
79
+ "Requirement already satisfied: typing-extensions in /usr/local/lib/python3.7/dist-packages (from iopath>=0.1.7->fvcore->semseg==0.4.1) (4.1.1)\n",
80
+ "Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->semseg==0.4.1) (3.0.9)\n",
81
+ "Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->semseg==0.4.1) (2.8.2)\n",
82
+ "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->semseg==0.4.1) (0.11.0)\n",
83
+ "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->semseg==0.4.1) (1.4.4)\n",
84
+ "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.1->matplotlib->semseg==0.4.1) (1.15.0)\n",
85
+ "Requirement already satisfied: commonmark<0.10.0,>=0.9.0 in /usr/local/lib/python3.7/dist-packages (from rich->semseg==0.4.1) (0.9.1)\n",
86
+ "Requirement already satisfied: pygments<3.0.0,>=2.6.0 in /usr/local/lib/python3.7/dist-packages (from rich->semseg==0.4.1) (2.6.1)\n",
87
+ "Requirement already satisfied: absl-py>=0.4 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (1.2.0)\n",
88
+ "Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (3.4.1)\n",
89
+ "Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (0.37.1)\n",
90
+ "Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (1.0.1)\n",
91
+ "Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (1.8.1)\n",
92
+ "Requirement already satisfied: google-auth<3,>=1.6.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (1.35.0)\n",
93
+ "Requirement already satisfied: protobuf>=3.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (3.17.3)\n",
94
+ "Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (0.4.6)\n",
95
+ "Requirement already satisfied: grpcio>=1.24.3 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (1.48.1)\n",
96
+ "Requirement already satisfied: requests<3,>=2.21.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (2.23.0)\n",
97
+ "Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (57.4.0)\n",
98
+ "Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from tensorboard->semseg==0.4.1) (0.6.1)\n",
99
+ "Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard->semseg==0.4.1) (4.9)\n",
100
+ "Requirement already satisfied: cachetools<5.0,>=2.0.0 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard->semseg==0.4.1) (4.2.4)\n",
101
+ "Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.7/dist-packages (from google-auth<3,>=1.6.3->tensorboard->semseg==0.4.1) (0.2.8)\n",
102
+ "Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.7/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard->semseg==0.4.1) (1.3.1)\n",
103
+ "Requirement already satisfied: importlib-metadata>=4.4 in /usr/local/lib/python3.7/dist-packages (from markdown>=2.6.8->tensorboard->semseg==0.4.1) (4.12.0)\n",
104
+ "Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard->semseg==0.4.1) (3.8.1)\n",
105
+ "Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.7/dist-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard->semseg==0.4.1) (0.4.8)\n",
106
+ "Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.21.0->tensorboard->semseg==0.4.1) (2.10)\n",
107
+ "Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.21.0->tensorboard->semseg==0.4.1) (1.24.3)\n",
108
+ "Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.21.0->tensorboard->semseg==0.4.1) (3.0.4)\n",
109
+ "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests<3,>=2.21.0->tensorboard->semseg==0.4.1) (2022.6.15)\n",
110
+ "Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.7/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard->semseg==0.4.1) (3.2.0)\n",
111
+ "Installing collected packages: semseg\n",
112
+ " Running setup.py develop for semseg\n",
113
+ "Successfully installed semseg-0.4.1\n",
114
+ "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
115
+ "Requirement already satisfied: gdown in /usr/local/lib/python3.7/dist-packages (4.5.1)\n",
116
+ "Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from gdown) (1.15.0)\n",
117
+ "Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from gdown) (4.64.1)\n",
118
+ "Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.7/dist-packages (from gdown) (4.6.3)\n",
119
+ "Requirement already satisfied: requests[socks] in /usr/local/lib/python3.7/dist-packages (from gdown) (2.23.0)\n",
120
+ "Requirement already satisfied: filelock in /usr/local/lib/python3.7/dist-packages (from gdown) (3.8.0)\n",
121
+ "Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests[socks]->gdown) (2.10)\n",
122
+ "Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests[socks]->gdown) (1.24.3)\n",
123
+ "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests[socks]->gdown) (2022.6.15)\n",
124
+ "Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.7/dist-packages (from requests[socks]->gdown) (3.0.4)\n",
125
+ "Requirement already satisfied: PySocks!=1.5.7,>=1.5.6 in /usr/local/lib/python3.7/dist-packages (from requests[socks]->gdown) (1.7.1)\n"
126
+ ]
127
+ }
128
+ ]
129
+ },
130
+ {
131
+ "cell_type": "markdown",
132
+ "source": [
133
+ "## Defination for loading model and checkpoints"
134
+ ],
135
+ "metadata": {
136
+ "id": "L-WE4q6_ZHdQ"
137
+ }
138
+ },
139
+ {
140
+ "cell_type": "code",
141
+ "source": [
142
+ "import gdown\n",
143
+ "from pathlib import Path\n",
144
+ "import torch\n",
145
+ "from torchvision import io\n",
146
+ "from torchvision import transforms as T\n",
147
+ "from PIL import Image\n",
148
+ "from semseg.models import *\n",
149
+ "from google.colab import files\n",
150
+ "# from IPython.display import Image\n",
151
+ "\n",
152
+ "\n",
153
+ "def get_checkpoints():\n",
154
+ " ckpt = Path('./checkpoints/pretrained/segformer')\n",
155
+ " ckpt.mkdir(exist_ok=True, parents=True)\n",
156
+ "\n",
157
+ " url = 'https://huggingface.co/hashb/semantic-segmentation-segformer/resolve/main/segformer.b3.ade.pth'\n",
158
+ " output = './checkpoints/pretrained/segformer/segformer.b3.ade.pth'\n",
159
+ " gdown.download(url, output, quiet=False)\n",
160
+ "\n",
161
+ "def show_image(image):\n",
162
+ " if image.shape[2] != 3: image = image.permute(1, 2, 0)\n",
163
+ " image = Image.fromarray(image.numpy())\n",
164
+ " # image.save(\"result.png\")\n",
165
+ " return image\n",
166
+ "\n",
167
+ "def load_model():\n",
168
+ " model = eval('SegFormer')(\n",
169
+ " backbone='MiT-B3',\n",
170
+ " num_classes=150\n",
171
+ " )\n",
172
+ "\n",
173
+ " try:\n",
174
+ " model.load_state_dict(torch.load('checkpoints/pretrained/segformer/segformer.b3.ade.pth', map_location='cpu'))\n",
175
+ " except:\n",
176
+ " print(\"Download a pretrained model's weights from the result table.\")\n",
177
+ " model.eval()\n",
178
+ " return model\n",
179
+ "\n",
180
+ " print('Loaded Model')"
181
+ ],
182
+ "metadata": {
183
+ "id": "QnfB4lrzjo33"
184
+ },
185
+ "execution_count": 6,
186
+ "outputs": []
187
+ },
188
+ {
189
+ "cell_type": "code",
190
+ "source": [
191
+ "get_checkpoints()\n",
192
+ "model = load_model()"
193
+ ],
194
+ "metadata": {
195
+ "id": "L1YCKFKJKP1H",
196
+ "colab": {
197
+ "base_uri": "https://localhost:8080/"
198
+ },
199
+ "outputId": "0b5b2aeb-0978-46fd-8638-bb4976431c60"
200
+ },
201
+ "execution_count": 7,
202
+ "outputs": [
203
+ {
204
+ "output_type": "stream",
205
+ "name": "stderr",
206
+ "text": [
207
+ "Downloading...\n",
208
+ "From: https://huggingface.co/hashb/semantic-segmentation-segformer/resolve/main/segformer.b3.ade.pth\n",
209
+ "To: /content/semantic-segmentation/checkpoints/pretrained/segformer/segformer.b3.ade.pth\n",
210
+ "100%|██████████| 190M/190M [00:00<00:00, 206MB/s]\n"
211
+ ]
212
+ }
213
+ ]
214
+ },
215
+ {
216
+ "cell_type": "markdown",
217
+ "source": [
218
+ "# Upload image file"
219
+ ],
220
+ "metadata": {
221
+ "id": "FRDvSMmvoK_0"
222
+ }
223
+ },
224
+ {
225
+ "cell_type": "code",
226
+ "source": [
227
+ "uploaded = files.upload()\n",
228
+ "for i in uploaded:\n",
229
+ " image_path = i\n",
230
+ "image = io.read_image(image_path)"
231
+ ],
232
+ "metadata": {
233
+ "colab": {
234
+ "resources": {
235
+ "http://localhost:8080/nbextensions/google.colab/files.js": {
236
+ "data": "Ly8gQ29weXJpZ2h0IDIwMTcgR29vZ2xlIExMQwovLwovLyBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgIkxpY2Vuc2UiKTsKLy8geW91IG1heSBub3QgdXNlIHRoaXMgZmlsZSBleGNlcHQgaW4gY29tcGxpYW5jZSB3aXRoIHRoZSBMaWNlbnNlLgovLyBZb3UgbWF5IG9idGFpbiBhIGNvcHkgb2YgdGhlIExpY2Vuc2UgYXQKLy8KLy8gICAgICBodHRwOi8vd3d3LmFwYWNoZS5vcmcvbGljZW5zZXMvTElDRU5TRS0yLjAKLy8KLy8gVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzb2Z0d2FyZQovLyBkaXN0cmlidXRlZCB1bmRlciB0aGUgTGljZW5zZSBpcyBkaXN0cmlidXRlZCBvbiBhbiAiQVMgSVMiIEJBU0lTLAovLyBXSVRIT1VUIFdBUlJBTlRJRVMgT1IgQ09ORElUSU9OUyBPRiBBTlkgS0lORCwgZWl0aGVyIGV4cHJlc3Mgb3IgaW1wbGllZC4KLy8gU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAovLyBsaW1pdGF0aW9ucyB1bmRlciB0aGUgTGljZW5zZS4KCi8qKgogKiBAZmlsZW92ZXJ2aWV3IEhlbHBlcnMgZm9yIGdvb2dsZS5jb2xhYiBQeXRob24gbW9kdWxlLgogKi8KKGZ1bmN0aW9uKHNjb3BlKSB7CmZ1bmN0aW9uIHNwYW4odGV4dCwgc3R5bGVBdHRyaWJ1dGVzID0ge30pIHsKICBjb25zdCBlbGVtZW50ID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N0IHJlYWRlciA9IG5ldyBGaWxlUmVhZGVyKCk7CiAgICAgIHJlYWRlci5vbmxvYWQgPSAoZSkgPT4gewogICAgICAgIHJlc29sdmUoZS50YXJnZXQucmVzdWx0KTsKICAgICAgfTsKICAgICAgcmVhZGVyLnJlYWRBc0FycmF5QnVmZmVyKGZpbGUpOwogICAgfSk7CiAgICAvLyBXYWl0IGZvciB0aGUgZGF0YSB0byBiZSByZWFkeS4KICAgIGxldCBmaWxlRGF0YSA9IHlpZWxkIHsKICAgICAgcHJvbWlzZTogZmlsZURhdGFQcm9taXNlLAogICAgICByZXNwb25zZTogewogICAgICAgIGFjdGlvbjogJ2NvbnRpbnVlJywKICAgICAgfQogICAgfTsKCiAgICAvLyBVc2UgYSBjaHVua2VkIHNlbmRpbmcgdG8gYXZvaWQgbWVzc2FnZSBzaXplIGxpbWl0cy4gU2VlIGIvNjIxMTU2NjAuCiAgICBsZXQgcG9zaXRpb24gPSAwOwogICAgZG8gewogICAgICBjb25zdCBsZW5ndGggPSBNYXRoLm1pbihmaWxlRGF0YS5ieXRlTGVuZ3RoIC0gcG9zaXRpb24sIE1BWF9QQVlMT0FEX1NJWkUpOwogICAgICBjb25zdCBjaHVuayA9IG5ldyBVaW50OEFycmF5KGZpbGVEYXRhLCBwb3NpdGlvbiwgbGVuZ3RoKTsKICAgICAgcG9zaXRpb24gKz0gbGVuZ3RoOwoKICAgICAgY29uc3QgYmFzZTY0ID0gYnRvYShTdHJpbmcuZnJvbUNoYXJDb2RlLmFwcGx5KG51bGwsIGNodW5rKSk7CiAgICAgIHlpZWxkIHsKICAgICAgICByZXNwb25zZTogewogICAgICAgICAgYWN0aW9uOiAnYXBwZW5kJywKICAgICAgICAgIGZpbGU6IGZpbGUubmFtZSwKICAgICAgICAgIGRhdGE6IGJhc2U2NCwKICAgICAgICB9LAogICAgICB9OwoKICAgICAgbGV0IHBlcmNlbnREb25lID0gZmlsZURhdGEuYnl0ZUxlbmd0aCA9PT0gMCA/CiAgICAgICAgICAxMDAgOgogICAgICAgICAgTWF0aC5yb3VuZCgocG9zaXRpb24gLyBmaWxlRGF0YS5ieXRlTGVuZ3RoKSAqIDEwMCk7CiAgICAgIHBlcmNlbnQudGV4dENvbnRlbnQgPSBgJHtwZXJjZW50RG9uZX0lIGRvbmVgOwoKICAgIH0gd2hpbGUgKHBvc2l0aW9uIDwgZmlsZURhdGEuYnl0ZUxlbmd0aCk7CiAgfQoKICAvLyBBbGwgZG9uZS4KICB5aWVsZCB7CiAgICByZXNwb25zZTogewogICAgICBhY3Rpb246ICdjb21wbGV0ZScsCiAgICB9CiAgfTsKfQoKc2NvcGUuZ29vZ2xlID0gc2NvcGUuZ29vZ2xlIHx8IHt9OwpzY29wZS5nb29nbGUuY29sYWIgPSBzY29wZS5nb29nbGUuY29sYWIgfHwge307CnNjb3BlLmdvb2dsZS5jb2xhYi5fZmlsZXMgPSB7CiAgX3VwbG9hZEZpbGVzLAogIF91cGxvYWRGaWxlc0NvbnRpbnVlLAp9Owp9KShzZWxmKTsK",
237
+ "ok": true,
238
+ "headers": [
239
+ [
240
+ "content-type",
241
+ "application/javascript"
242
+ ]
243
+ ],
244
+ "status": 200,
245
+ "status_text": ""
246
+ }
247
+ },
248
+ "base_uri": "https://localhost:8080/",
249
+ "height": 73
250
+ },
251
+ "id": "k2cOX2CUaZuK",
252
+ "outputId": "10aa9d41-cedf-4ebe-e39e-501ce52060f9"
253
+ },
254
+ "execution_count": 8,
255
+ "outputs": [
256
+ {
257
+ "output_type": "display_data",
258
+ "data": {
259
+ "text/plain": [
260
+ "<IPython.core.display.HTML object>"
261
+ ],
262
+ "text/html": [
263
+ "\n",
264
+ " <input type=\"file\" id=\"files-588ecd48-c3e3-4199-8af1-4f923a689620\" name=\"files[]\" multiple disabled\n",
265
+ " style=\"border:none\" />\n",
266
+ " <output id=\"result-588ecd48-c3e3-4199-8af1-4f923a689620\">\n",
267
+ " Upload widget is only available when the cell has been executed in the\n",
268
+ " current browser session. Please rerun this cell to enable.\n",
269
+ " </output>\n",
270
+ " <script src=\"/nbextensions/google.colab/files.js\"></script> "
271
+ ]
272
+ },
273
+ "metadata": {}
274
+ },
275
+ {
276
+ "output_type": "stream",
277
+ "name": "stdout",
278
+ "text": [
279
+ "Saving pexels-photo-1485031.jpeg to pexels-photo-1485031.jpeg\n"
280
+ ]
281
+ }
282
+ ]
283
+ },
284
+ {
285
+ "cell_type": "code",
286
+ "source": [
287
+ "# resize\n",
288
+ "image = T.CenterCrop((512, 512))(image)\n",
289
+ "# scale to [0.0, 1.0]\n",
290
+ "image = image.float() / 255\n",
291
+ "# normalize\n",
292
+ "image = T.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225))(image)\n",
293
+ "# add batch size\n",
294
+ "image = image.unsqueeze(0)\n",
295
+ "image.shape"
296
+ ],
297
+ "metadata": {
298
+ "id": "Mnfbjt3vjzmI",
299
+ "colab": {
300
+ "base_uri": "https://localhost:8080/"
301
+ },
302
+ "outputId": "e3255e3f-c3ed-47f6-f8db-c72c679af496"
303
+ },
304
+ "execution_count": 9,
305
+ "outputs": [
306
+ {
307
+ "output_type": "execute_result",
308
+ "data": {
309
+ "text/plain": [
310
+ "torch.Size([1, 3, 512, 512])"
311
+ ]
312
+ },
313
+ "metadata": {},
314
+ "execution_count": 9
315
+ }
316
+ ]
317
+ },
318
+ {
319
+ "cell_type": "code",
320
+ "source": [
321
+ "with torch.inference_mode():\n",
322
+ " seg = model(image)\n",
323
+ "seg.shape"
324
+ ],
325
+ "metadata": {
326
+ "id": "lJ6xNAwzj17M",
327
+ "colab": {
328
+ "base_uri": "https://localhost:8080/"
329
+ },
330
+ "outputId": "7253e889-2b43-4f5c-ebcd-731001f4dd17"
331
+ },
332
+ "execution_count": 10,
333
+ "outputs": [
334
+ {
335
+ "output_type": "execute_result",
336
+ "data": {
337
+ "text/plain": [
338
+ "torch.Size([1, 150, 512, 512])"
339
+ ]
340
+ },
341
+ "metadata": {},
342
+ "execution_count": 10
343
+ }
344
+ ]
345
+ },
346
+ {
347
+ "cell_type": "code",
348
+ "source": [
349
+ "seg = seg.softmax(1).argmax(1).to(int)\n",
350
+ "seg.unique()"
351
+ ],
352
+ "metadata": {
353
+ "id": "EqbG_qokj30-",
354
+ "colab": {
355
+ "base_uri": "https://localhost:8080/"
356
+ },
357
+ "outputId": "ad1c2e60-777b-45ee-f27f-44fff275fabb"
358
+ },
359
+ "execution_count": 11,
360
+ "outputs": [
361
+ {
362
+ "output_type": "execute_result",
363
+ "data": {
364
+ "text/plain": [
365
+ "tensor([ 0, 1, 4, 12])"
366
+ ]
367
+ },
368
+ "metadata": {},
369
+ "execution_count": 11
370
+ }
371
+ ]
372
+ },
373
+ {
374
+ "cell_type": "code",
375
+ "source": [
376
+ "from semseg.datasets import *\n",
377
+ "\n",
378
+ "palette = eval('ADE20K').PALETTE"
379
+ ],
380
+ "metadata": {
381
+ "id": "dyj4dPoMj7aq"
382
+ },
383
+ "execution_count": 12,
384
+ "outputs": []
385
+ },
386
+ {
387
+ "cell_type": "code",
388
+ "source": [
389
+ "seg_map = palette[seg].squeeze().to(torch.uint8)\n",
390
+ "show_image(seg_map)"
391
+ ],
392
+ "metadata": {
393
+ "id": "02ptBGPAj8_g",
394
+ "colab": {
395
+ "base_uri": "https://localhost:8080/",
396
+ "height": 529
397
+ },
398
+ "outputId": "0df8f3b6-7bfe-4ad3-a5e3-f794363abdbe"
399
+ },
400
+ "execution_count": 13,
401
+ "outputs": [
402
+ {
403
+ "output_type": "execute_result",
404
+ "data": {
405
+ "text/plain": [
406
+ "<PIL.Image.Image image mode=RGB size=512x512 at 0x7FBF0969DB10>"
407
+ ],
408
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAAQuElEQVR4nO3dyXEkR5aA4eAY5IAgRFMHSDIXWJmVDmW4UBIcqMEMRhBIMoekgSCWRGYs7m/5PuOpu7o72OnxfvfIhb/99fPnAqu8PD7PvgSuc/twN/sS6ri//zX7Erb6r9kXAMAcA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