Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -65,116 +65,139 @@ parser.add_argument('--domain', default='val', type=str)
|
|
65 |
parser.add_argument('--scales', default='0.5,1.0,1.5,2.0', type=str)
|
66 |
parser.add_argument('--iteration', default=10, type=int)
|
67 |
|
68 |
-
|
69 |
-
"
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
}
|
177 |
|
|
|
|
|
178 |
if __name__ == '__main__':
|
179 |
###################################################################################
|
180 |
# Arguments
|
@@ -275,7 +298,7 @@ if __name__ == '__main__':
|
|
275 |
else:
|
276 |
pred_mask = np.argmax(preds, axis=-1)
|
277 |
|
278 |
-
pred_mask = decode_from_colormap(pred_mask,
|
279 |
|
280 |
return pred_mask.astype(np.uint8)
|
281 |
|
|
|
65 |
parser.add_argument('--scales', default='0.5,1.0,1.5,2.0', type=str)
|
66 |
parser.add_argument('--iteration', default=10, type=int)
|
67 |
|
68 |
+
class_names = [
|
69 |
+
"aeroplane",
|
70 |
+
"bicycle",
|
71 |
+
"bird",
|
72 |
+
"boat",
|
73 |
+
"bottle",
|
74 |
+
"bus",
|
75 |
+
"car",
|
76 |
+
"cat",
|
77 |
+
"chair",
|
78 |
+
"cow",
|
79 |
+
"diningtable",
|
80 |
+
"dog",
|
81 |
+
"horse",
|
82 |
+
"motorbike",
|
83 |
+
"person",
|
84 |
+
"pottedplant",
|
85 |
+
"sheep",
|
86 |
+
"sofa",
|
87 |
+
"train",
|
88 |
+
"tvmonitor"
|
89 |
+
]
|
90 |
+
|
91 |
+
cmap_dic = {
|
92 |
+
"background": [
|
93 |
+
0,
|
94 |
+
0,
|
95 |
+
0
|
96 |
+
],
|
97 |
+
"aeroplane": [
|
98 |
+
128,
|
99 |
+
0,
|
100 |
+
0
|
101 |
+
],
|
102 |
+
"bicycle": [
|
103 |
+
0,
|
104 |
+
128,
|
105 |
+
0
|
106 |
+
],
|
107 |
+
"bird": [
|
108 |
+
128,
|
109 |
+
128,
|
110 |
+
0
|
111 |
+
],
|
112 |
+
"boat": [
|
113 |
+
0,
|
114 |
+
0,
|
115 |
+
128
|
116 |
+
],
|
117 |
+
"bottle": [
|
118 |
+
128,
|
119 |
+
0,
|
120 |
+
128
|
121 |
+
],
|
122 |
+
"bus": [
|
123 |
+
0,
|
124 |
+
128,
|
125 |
+
128
|
126 |
+
],
|
127 |
+
"car": [
|
128 |
+
128,
|
129 |
+
128,
|
130 |
+
128
|
131 |
+
],
|
132 |
+
"cat": [
|
133 |
+
64,
|
134 |
+
0,
|
135 |
+
0
|
136 |
+
],
|
137 |
+
"chair": [
|
138 |
+
192,
|
139 |
+
0,
|
140 |
+
0
|
141 |
+
],
|
142 |
+
"cow": [
|
143 |
+
64,
|
144 |
+
128,
|
145 |
+
0
|
146 |
+
],
|
147 |
+
"diningtable": [
|
148 |
+
192,
|
149 |
+
128,
|
150 |
+
0
|
151 |
+
],
|
152 |
+
"dog": [
|
153 |
+
64,
|
154 |
+
0,
|
155 |
+
128
|
156 |
+
],
|
157 |
+
"horse": [
|
158 |
+
192,
|
159 |
+
0,
|
160 |
+
128
|
161 |
+
],
|
162 |
+
"motorbike": [
|
163 |
+
64,
|
164 |
+
128,
|
165 |
+
128
|
166 |
+
],
|
167 |
+
"person": [
|
168 |
+
192,
|
169 |
+
128,
|
170 |
+
128
|
171 |
+
],
|
172 |
+
"pottedplant": [
|
173 |
+
0,
|
174 |
+
64,
|
175 |
+
0
|
176 |
+
],
|
177 |
+
"sheep": [
|
178 |
+
128,
|
179 |
+
64,
|
180 |
+
0
|
181 |
+
],
|
182 |
+
"sofa": [
|
183 |
+
0,
|
184 |
+
192,
|
185 |
+
0
|
186 |
+
],
|
187 |
+
"train": [
|
188 |
+
128,
|
189 |
+
192,
|
190 |
+
0
|
191 |
+
],
|
192 |
+
"tvmonitor": [
|
193 |
+
0,
|
194 |
+
64,
|
195 |
+
128
|
196 |
+
]
|
197 |
}
|
198 |
|
199 |
+
colors = np.asarray([cmap_dic[class_name] for class_name in class_names])
|
200 |
+
|
201 |
if __name__ == '__main__':
|
202 |
###################################################################################
|
203 |
# Arguments
|
|
|
298 |
else:
|
299 |
pred_mask = np.argmax(preds, axis=-1)
|
300 |
|
301 |
+
pred_mask = decode_from_colormap(pred_mask, colors)[..., ::-1]
|
302 |
|
303 |
return pred_mask.astype(np.uint8)
|
304 |
|