vobecant
commited on
Commit
•
fefce99
1
Parent(s):
87ea58c
Initial commit.
Browse files- .idea/workspace.xml +19 -3
- app.py +8 -6
.idea/workspace.xml
CHANGED
@@ -2,6 +2,7 @@
|
|
2 |
<project version="4">
|
3 |
<component name="ChangeListManager">
|
4 |
<list default="true" id="5dd22f22-8223-4d55-99f9-57d1e00622d7" name="Default Changelist" comment="Initial commit.">
|
|
|
5 |
<change beforePath="$PROJECT_DIR$/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/app.py" afterDir="false" />
|
6 |
</list>
|
7 |
<option name="SHOW_DIALOG" value="false" />
|
@@ -30,11 +31,12 @@
|
|
30 |
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
31 |
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
32 |
<property name="WebServerToolWindowFactoryState" value="true" />
|
33 |
-
<property name="last_opened_file_path" value="$PROJECT_DIR$/
|
34 |
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
|
35 |
</component>
|
36 |
<component name="RecentsManager">
|
37 |
<key name="CopyFile.RECENT_KEYS">
|
|
|
38 |
<recent name="$PROJECT_DIR$/examples" />
|
39 |
<recent name="$PROJECT_DIR$" />
|
40 |
</key>
|
@@ -50,7 +52,7 @@
|
|
50 |
<option name="number" value="Default" />
|
51 |
<option name="presentableId" value="Default" />
|
52 |
<updated>1647350746642</updated>
|
53 |
-
<workItem from="1647350750956" duration="
|
54 |
</task>
|
55 |
<task id="LOCAL-00001" summary="Initial commit.">
|
56 |
<created>1647352693910</created>
|
@@ -332,7 +334,21 @@
|
|
332 |
<option name="project" value="LOCAL" />
|
333 |
<updated>1647361647000</updated>
|
334 |
</task>
|
335 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
<servers />
|
337 |
</component>
|
338 |
<component name="TypeScriptGeneratedFilesManager">
|
|
|
2 |
<project version="4">
|
3 |
<component name="ChangeListManager">
|
4 |
<list default="true" id="5dd22f22-8223-4d55-99f9-57d1e00622d7" name="Default Changelist" comment="Initial commit.">
|
5 |
+
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
6 |
<change beforePath="$PROJECT_DIR$/app.py" beforeDir="false" afterPath="$PROJECT_DIR$/app.py" afterDir="false" />
|
7 |
</list>
|
8 |
<option name="SHOW_DIALOG" value="false" />
|
|
|
31 |
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
32 |
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
33 |
<property name="WebServerToolWindowFactoryState" value="true" />
|
34 |
+
<property name="last_opened_file_path" value="$PROJECT_DIR$/weights" />
|
35 |
<property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
|
36 |
</component>
|
37 |
<component name="RecentsManager">
|
38 |
<key name="CopyFile.RECENT_KEYS">
|
39 |
+
<recent name="$PROJECT_DIR$/weights" />
|
40 |
<recent name="$PROJECT_DIR$/examples" />
|
41 |
<recent name="$PROJECT_DIR$" />
|
42 |
</key>
|
|
|
52 |
<option name="number" value="Default" />
|
53 |
<option name="presentableId" value="Default" />
|
54 |
<updated>1647350746642</updated>
|
55 |
+
<workItem from="1647350750956" duration="11000000" />
|
56 |
</task>
|
57 |
<task id="LOCAL-00001" summary="Initial commit.">
|
58 |
<created>1647352693910</created>
|
|
|
334 |
<option name="project" value="LOCAL" />
|
335 |
<updated>1647361647000</updated>
|
336 |
</task>
|
337 |
+
<task id="LOCAL-00041" summary="Initial commit.">
|
338 |
+
<created>1647361799443</created>
|
339 |
+
<option name="number" value="00041" />
|
340 |
+
<option name="presentableId" value="LOCAL-00041" />
|
341 |
+
<option name="project" value="LOCAL" />
|
342 |
+
<updated>1647361799443</updated>
|
343 |
+
</task>
|
344 |
+
<task id="LOCAL-00042" summary="Initial commit.">
|
345 |
+
<created>1647361872965</created>
|
346 |
+
<option name="number" value="00042" />
|
347 |
+
<option name="presentableId" value="LOCAL-00042" />
|
348 |
+
<option name="project" value="LOCAL" />
|
349 |
+
<updated>1647361872965</updated>
|
350 |
+
</task>
|
351 |
+
<option name="localTasksCounter" value="43" />
|
352 |
<servers />
|
353 |
</component>
|
354 |
<component name="TypeScriptGeneratedFilesManager">
|
app.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1 |
-
import os
|
2 |
-
|
3 |
import gradio as gr
|
4 |
import numpy as np
|
5 |
import requests
|
@@ -75,8 +73,12 @@ def segment_segmenter(image, model, window_size, window_stride, encoder_features
|
|
75 |
|
76 |
|
77 |
def remap(seg_pred, ignore=255):
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
|
|
80 |
h, w = seg_pred.shape[-2:]
|
81 |
seg_pred_remap = np.ones((h, w), dtype=np.uint8) * ignore
|
82 |
for pseudo, gt in mapping.items():
|
@@ -155,8 +157,8 @@ def predict(input_img):
|
|
155 |
|
156 |
|
157 |
title = "Drive&Segment"
|
158 |
-
description = 'Gradio Demo accompanying paper "Drive&Segment: Unsupervised Semantic Segmentation of Urban Scenes via Cross-modal Distillation"'
|
159 |
-
|
160 |
examples = ['examples/img1.jpg', 'examples/img2.jpeg']
|
161 |
|
162 |
# predict(examples[0])
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import numpy as np
|
3 |
import requests
|
|
|
73 |
|
74 |
|
75 |
def remap(seg_pred, ignore=255):
|
76 |
+
if 'nusc' in WEIGHTS.lower():
|
77 |
+
mapping = {0: 0, 13: 1, 2: 2, 7: 3, 17: 4, 20: 5, 8: 6, 12: 7, 26: 8, 14: 9, 22: 10, 11: 11, 6: 12, 27: 13,
|
78 |
+
10: 14, 19: 15, 24: 16, 9: 17, 4: 18}
|
79 |
+
else:
|
80 |
+
mapping = {0: 0, 12: 1, 15: 2, 23: 3, 10: 4, 14: 5, 18: 6, 2: 7, 17: 8, 13: 9, 8: 10, 3: 11, 27: 12, 4: 13,
|
81 |
+
25: 14, 24: 15, 6: 16, 22: 17, 28: 18}
|
82 |
h, w = seg_pred.shape[-2:]
|
83 |
seg_pred_remap = np.ones((h, w), dtype=np.uint8) * ignore
|
84 |
for pseudo, gt in mapping.items():
|
|
|
157 |
|
158 |
|
159 |
title = "Drive&Segment"
|
160 |
+
description = 'Gradio Demo accompanying paper "Drive&Segment: Unsupervised Semantic Segmentation of Urban Scenes via Cross-modal Distillation"\nBecause of the CPU-only inference, it might take up to 20s for large images.'
|
161 |
+
article = "<p style='text-align: center'><a href='TODO' target='_blank'>Project Page</a> | <a href='codelink' target='_blank'>Github</a></p>"
|
162 |
examples = ['examples/img1.jpg', 'examples/img2.jpeg']
|
163 |
|
164 |
# predict(examples[0])
|