Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7e0a6df

Browse files
committedMay 16, 2020
Use default colors for masks
1 parent ccd2fbd commit 7e0a6df

File tree

3 files changed

+777
-1
lines changed

3 files changed

+777
-1
lines changed
 

‎cvat/apps/dataset_manager/formats/mask.py

+40-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
#
33
# SPDX-License-Identifier: MIT
44

5+
import os.path as osp
56
from tempfile import TemporaryDirectory
67

78
from pyunpack import Archive
89

910
from cvat.apps.dataset_manager.bindings import (CvatTaskDataExtractor,
1011
import_dm_annotations)
1112
from cvat.apps.dataset_manager.util import make_zip_archive
13+
from datumaro.cli.util import make_file_name
1214
from datumaro.components.project import Dataset
15+
from datumaro.util.mask_tools import generate_colormap
1316

1417
from .registry import dm_env, exporter, importer
1518

@@ -25,7 +28,8 @@ def _export(dst_file, task_data, save_images=False):
2528
extractor = Dataset.from_extractors(extractor) # apply lazy transforms
2629
with TemporaryDirectory() as temp_dir:
2730
converter = dm_env.make_converter('voc_segmentation',
28-
apply_colormap=True, label_map='source', save_images=save_images)
31+
apply_colormap=True, label_map=make_colormap(task_data),
32+
save_images=save_images)
2933
converter(extractor, save_dir=temp_dir)
3034

3135
make_zip_archive(temp_dir, dst_file)
@@ -39,3 +43,38 @@ def _import(src_file, task_data):
3943
masks_to_polygons = dm_env.transforms.get('masks_to_polygons')
4044
dataset = dataset.transform(masks_to_polygons)
4145
import_dm_annotations(dataset, task_data)
46+
47+
48+
DEFAULT_COLORMAP_CAPACITY = 2000
49+
DEFAULT_COLORMAP_PATH = osp.join(osp.dirname(__file__), 'default_colors.txt')
50+
def parse_default_colors(file_path=None):
51+
file_path = file_path or DEFAULT_COLORMAP_PATH
52+
53+
colors = {}
54+
with open(file_path) as f:
55+
for line in f:
56+
line = line.strip()
57+
if not line or line[0] == '#':
58+
continue
59+
_, label, color = line.split(':')
60+
colors[label] = tuple(map(int, color.split(',')))
61+
return colors
62+
63+
def normalize_label(label):
64+
label = make_file_name(label) # basically, convert to ASCII lowercase
65+
label = label.replace('-', '_')
66+
return label
67+
68+
def make_colormap(task_data):
69+
labels = sorted(get_labels(task_data))
70+
predefined = parse_default_colors()
71+
72+
# NOTE: using pop() to avoid collisions
73+
colormap = {k: predefined.pop(normalize_label(k), None) for k in labels}
74+
75+
random_labels = [k for k in labels if not colormap[k]]
76+
if random_labels:
77+
colors = generate_colormap(DEFAULT_COLORMAP_CAPACITY + len(random_labels))
78+
for i, label in enumerate(random_labels):
79+
colormap[label] = colors[DEFAULT_COLORMAP_CAPACITY + i]
80+
return {l: [c, [], []] for l, c in colormap.items()}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,731 @@
1+
# ImageNet + OpenImages + PASCAL VOC +
2+
# CamVid + CityScapes + Kitti +
3+
# COCO + COCO stuff
4+
5+
# Format:
6+
# pascal idx : normalized label name : R,G,B
7+
8+
0:background:0,0,0
9+
2001:accordion:176,112,32
10+
2002:adhesive_tape:48,240,32
11+
2003:aeroplane:176,240,32
12+
2004:aircraft:48,112,160
13+
2005:airplane:176,112,160
14+
2006:alarm_clock:48,240,160
15+
2007:alpaca:176,240,160
16+
2008:ambulance:112,112,32
17+
2009:animal:240,112,32
18+
2010:ant:112,240,32
19+
2011:antelope:240,240,32
20+
2012:apple:112,112,160
21+
2013:armadillo:240,112,160
22+
2014:artichoke:112,240,160
23+
2015:asparagus:240,240,160
24+
2016:axe:48,48,96
25+
2017:baby_bed:176,48,96
26+
2018:backpack:48,176,96
27+
2019:bagel:176,176,96
28+
2020:balance_beam:48,48,224
29+
2021:ball:176,48,224
30+
2022:balloon:48,176,224
31+
2023:banana:176,176,224
32+
2024:band_aid:112,48,96
33+
2025:banjo:240,48,96
34+
2026:banner:112,176,96
35+
2027:barge:240,176,96
36+
2028:barrel:112,48,224
37+
2029:baseball:240,48,224
38+
2030:baseball_bat:112,176,224
39+
2031:baseball_glove:240,176,224
40+
2032:basketball:48,112,96
41+
2033:bat:176,112,96
42+
2034:bathing_cap:48,240,96
43+
2035:bathroom_cabinet:176,240,96
44+
2036:bathtub:48,112,224
45+
2037:beaker:176,112,224
46+
2038:bear:48,240,224
47+
2039:bed:176,240,224
48+
2040:bee:112,112,96
49+
2041:beehive:240,112,96
50+
2042:beer:112,240,96
51+
2043:beetle:240,240,96
52+
2044:bell_pepper:112,112,224
53+
2045:belt:240,112,224
54+
2046:bench:112,240,224
55+
2047:bg:240,240,224
56+
2048:bicycle:0,0,16
57+
2049:bicycle_helmet:128,0,16
58+
2050:bicycle_wheel:0,128,16
59+
2051:bidet:128,128,16
60+
2052:billboard:0,0,144
61+
2053:billiard_table:128,0,144
62+
2054:binder:0,128,144
63+
2055:binoculars:128,128,144
64+
2056:bird:64,0,16
65+
2057:blanket:192,0,16
66+
2058:blender:64,128,16
67+
2059:blue_jay:192,128,16
68+
2060:boat:64,0,144
69+
2061:book:192,0,144
70+
2062:bookcase:64,128,144
71+
2063:bookshelf:192,128,144
72+
2064:boot:0,64,16
73+
2065:bottle:128,64,16
74+
2066:bow:0,192,16
75+
2067:bow_and_arrow:128,192,16
76+
2068:bow_tie:0,64,144
77+
2069:bowl:128,64,144
78+
2070:box:0,192,144
79+
2071:boy:128,192,144
80+
2072:branch:64,64,16
81+
2073:brassiere:192,64,16
82+
2074:bread:64,192,16
83+
2075:bridge:192,192,16
84+
2076:briefcase:64,64,144
85+
2077:broccoli:192,64,144
86+
2078:bronze_sculpture:64,192,144
87+
2079:brown_bear:192,192,144
88+
2080:building:0,0,80
89+
2081:building_other:128,0,80
90+
2082:bull:0,128,80
91+
2083:burrito:128,128,80
92+
2084:bus:0,0,208
93+
2085:bush:128,0,208
94+
2086:bust:0,128,208
95+
2087:butterfly:128,128,208
96+
2088:cabbage:64,0,80
97+
2089:cabinet:192,0,80
98+
2090:cabinetry:64,128,80
99+
2091:cage:192,128,80
100+
2092:cake:64,0,208
101+
2093:cake_stand:192,0,208
102+
2094:camel:64,128,208
103+
2095:camera:192,128,208
104+
2096:can_opener:0,64,80
105+
2097:canary:128,64,80
106+
2098:candle:0,192,80
107+
2099:candy:128,192,80
108+
2100:cannon:0,64,208
109+
2101:canoe:128,64,208
110+
2102:car:0,192,208
111+
2103:caravan:128,192,208
112+
2104:cardboard:64,64,80
113+
2105:carnivore:192,64,80
114+
2106:carpet:64,192,80
115+
2107:carrot:192,192,80
116+
2108:cart:64,64,208
117+
2109:castle:192,64,208
118+
2110:cat:64,192,208
119+
2111:caterpillar:192,192,208
120+
2112:cattle:32,0,16
121+
2113:ceiling_fan:160,0,16
122+
2114:ceiling_other:32,128,16
123+
2115:ceiling_tile:160,128,16
124+
2116:cell_phone:32,0,144
125+
2117:cello:160,0,144
126+
2118:centipede:32,128,144
127+
2119:chain_saw:160,128,144
128+
2120:chair:96,0,16
129+
2121:cheetah:224,0,16
130+
2122:chest_of_drawers:96,128,16
131+
2123:chicken:224,128,16
132+
2124:chime:96,0,144
133+
2125:chopsticks:224,0,144
134+
2126:christmas_tree:96,128,144
135+
2127:clock:224,128,144
136+
2128:cloth:32,64,16
137+
2129:clothes:160,64,16
138+
2130:clouds:32,192,16
139+
2131:coat:160,192,16
140+
2132:cocktail:32,64,144
141+
2133:cocktail_shaker:160,64,144
142+
2134:coconut:32,192,144
143+
2135:coffee:160,192,144
144+
2136:coffee_cup:96,64,16
145+
2137:coffee_maker:224,64,16
146+
2138:coffee_table:96,192,16
147+
2139:coffeemaker:224,192,16
148+
2140:coin:96,64,144
149+
2141:common_fig:224,64,144
150+
2142:computer_keyboard:96,192,144
151+
2143:computer_monitor:224,192,144
152+
2144:computer_mouse:32,0,80
153+
2145:construction:160,0,80
154+
2146:convenience_store:32,128,80
155+
2147:cookie:160,128,80
156+
2148:corded_phone:32,0,208
157+
2149:corkscrew:160,0,208
158+
2150:couch:32,128,208
159+
2151:counter:160,128,208
160+
2152:countertop:96,0,80
161+
2153:cow:224,0,80
162+
2154:cowboy_hat:96,128,80
163+
2155:crab:224,128,80
164+
2156:cream:96,0,208
165+
2157:cricket_ball:224,0,208
166+
2158:crocodile:96,128,208
167+
2159:croissant:224,128,208
168+
2160:croquet_ball:32,64,80
169+
2161:crosswalk:160,64,80
170+
2162:crown:32,192,80
171+
2163:crutch:160,192,80
172+
2164:cucumber:32,64,208
173+
2165:cup:160,64,208
174+
2166:cup_or_mug:32,192,208
175+
2167:cupboard:160,192,208
176+
2168:curtain:96,64,80
177+
2169:cutting_board:224,64,80
178+
2170:cyclist:96,192,80
179+
2171:dagger:224,192,80
180+
2172:deer:96,64,208
181+
2173:desk:224,64,208
182+
2174:desk_stuff:96,192,208
183+
2175:dessert:224,192,208
184+
2176:diaper:0,32,16
185+
2177:dice:128,32,16
186+
2178:digital_clock:0,160,16
187+
2179:dining_table:128,160,16
188+
2180:diningtable:0,32,144
189+
2181:dinosaur:128,32,144
190+
2182:dirt:0,160,144
191+
2183:dishwasher:128,160,144
192+
2184:dog:64,32,16
193+
2185:dog_bed:192,32,16
194+
2186:doll:64,160,16
195+
2187:dolphin:192,160,16
196+
2188:domestic_cat:64,32,144
197+
2189:dontcare:192,32,144
198+
2190:donut:64,160,144
199+
2191:door:192,160,144
200+
2192:door_handle:0,96,16
201+
2193:door_stuff:128,96,16
202+
2194:doughnut:0,224,16
203+
2195:dragonfly:128,224,16
204+
2196:drawer:0,96,144
205+
2197:dress:128,96,144
206+
2198:drink:0,224,144
207+
2199:drinking_straw:128,224,144
208+
2200:drum:64,96,16
209+
2201:duck:192,96,16
210+
2202:dumbbell:64,224,16
211+
2203:dynamic:192,224,16
212+
2204:eagle:64,96,144
213+
2205:earrings:192,96,144
214+
2206:egg:64,224,144
215+
2207:electric_fan:192,224,144
216+
2208:elephant:0,32,80
217+
2209:envelope:128,32,80
218+
2210:eye_glasses:0,160,80
219+
2211:face_powder:128,160,80
220+
2212:falcon:0,32,208
221+
2213:fedora:128,32,208
222+
2214:fence:0,160,208
223+
2215:fence_guard:128,160,208
224+
2216:fig:64,32,80
225+
2217:filing_cabinet:192,32,80
226+
2218:finish:64,160,80
227+
2219:fire_hydrant:192,160,80
228+
2220:fireplace:64,32,208
229+
2221:fish:192,32,208
230+
2222:flag:64,160,208
231+
2223:flashlight:192,160,208
232+
2224:floor_marble:0,96,80
233+
2225:floor_other:128,96,80
234+
2226:floor_stone:0,224,80
235+
2227:floor_tile:128,224,80
236+
2228:floor_wood:0,96,208
237+
2229:flower:128,96,208
238+
2230:flower_pot:0,224,208
239+
2231:flowerpot:128,224,208
240+
2232:flute:64,96,80
241+
2233:fog:192,96,80
242+
2234:food_other:64,224,80
243+
2235:food_processor:192,224,80
244+
2236:football:64,96,208
245+
2237:football_helmet:192,96,208
246+
2238:footwear:64,224,208
247+
2239:fork:192,224,208
248+
2240:fountain:32,32,16
249+
2241:fox:160,32,16
250+
2242:french_fries:32,160,16
251+
2243:french_horn:160,160,16
252+
2244:frisbee:32,32,144
253+
2245:frog:160,32,144
254+
2246:fruit:32,160,144
255+
2247:frying_pan:160,160,144
256+
2248:furniture:96,32,16
257+
2249:furniture_other:224,32,16
258+
2250:gas_stove:96,160,16
259+
2251:giant_panda:224,160,16
260+
2252:giraffe:96,32,144
261+
2253:girl:224,32,144
262+
2254:glasses:96,160,144
263+
2255:glove:224,160,144
264+
2256:goat:32,96,16
265+
2257:goggles:160,96,16
266+
2258:goldfish:32,224,16
267+
2259:golf_ball:160,224,16
268+
2260:golf_cart:32,96,144
269+
2261:golfcart:160,96,144
270+
2262:gondola:32,224,144
271+
2263:goose:160,224,144
272+
2264:grape:96,96,16
273+
2265:grapefruit:224,96,16
274+
2266:grass:96,224,16
275+
2267:gravel:224,224,16
276+
2268:ground:96,96,144
277+
2269:ground_other:224,96,144
278+
2270:guacamole:96,224,144
279+
2271:guitar:224,224,144
280+
2272:hair_brush:32,32,80
281+
2273:hair_drier:160,32,80
282+
2274:hair_dryer:32,160,80
283+
2275:hair_spray:160,160,80
284+
2276:hamburger:32,32,208
285+
2277:hammer:160,32,208
286+
2278:hamster:32,160,208
287+
2279:handbag:160,160,208
288+
2280:handgun:96,32,80
289+
2281:harbor_seal:224,32,80
290+
2282:harmonica:96,160,80
291+
2283:harp:224,160,80
292+
2284:harpsichord:96,32,208
293+
2285:hat:224,32,208
294+
2286:hat_with_a_wide_brim:96,160,208
295+
2287:head_cabbage:224,160,208
296+
2288:headphones:32,96,80
297+
2289:helicopter:160,96,80
298+
2290:helmet:32,224,80
299+
2291:high_heels:160,224,80
300+
2292:hill:32,96,208
301+
2293:hippopotamus:160,96,208
302+
2294:home_appliance:32,224,208
303+
2295:honeycomb:160,224,208
304+
2296:horizontal_bar:96,96,80
305+
2297:horn:224,96,80
306+
2298:horse:96,224,80
307+
2299:hot_dog:224,224,80
308+
2300:hotdog:96,96,208
309+
2301:house:224,96,208
310+
2302:houseplant:96,224,208
311+
2303:human:224,224,208
312+
2304:human_arm:0,0,48
313+
2305:human_beard:128,0,48
314+
2306:human_ear:0,128,48
315+
2307:human_eye:128,128,48
316+
2308:human_face:0,0,176
317+
2309:human_foot:128,0,176
318+
2310:human_hair:0,128,176
319+
2311:human_hand:128,128,176
320+
2312:human_head:64,0,48
321+
2313:human_leg:192,0,48
322+
2314:human_mouth:64,128,48
323+
2315:human_nose:192,128,48
324+
2316:ice_cream:64,0,176
325+
2317:ignore:192,0,176
326+
2318:infant_bed:64,128,176
327+
2319:insect:192,128,176
328+
2320:invertebrate:0,64,48
329+
2321:ipod:128,64,48
330+
2322:isopod:0,192,48
331+
2323:jacket:128,192,48
332+
2324:jaguar:0,64,176
333+
2325:jeans:128,64,176
334+
2326:jellyfish:0,192,176
335+
2327:jet_ski:128,192,176
336+
2328:jug:64,64,48
337+
2329:juice:192,64,48
338+
2330:kangaroo:64,192,48
339+
2331:kettle:192,192,48
340+
2332:keyboard:64,64,176
341+
2333:kitchen_appliance:192,64,176
342+
2334:kitchen_dining_room_table:64,192,176
343+
2335:kitchen_knife:192,192,176
344+
2336:kite:0,0,112
345+
2337:knife:128,0,112
346+
2338:koala_bear:0,128,112
347+
2339:ladder:128,128,112
348+
2340:ladle:0,0,240
349+
2341:ladybug:128,0,240
350+
2342:lamp:0,128,240
351+
2343:land_vehicle:128,128,240
352+
2344:lantern:64,0,112
353+
2345:laptop:192,0,112
354+
2346:lavender:64,128,112
355+
2347:leaves:192,128,112
356+
2348:lemon:64,0,240
357+
2349:leopard:192,0,240
358+
2350:license_plate:64,128,240
359+
2351:lifejacket:192,128,240
360+
2352:light:0,64,112
361+
2353:light_bulb:128,64,112
362+
2354:light_switch:0,192,112
363+
2355:lighthouse:128,192,112
364+
2356:lily:0,64,240
365+
2357:limousine:128,64,240
366+
2358:lion:0,192,240
367+
2359:lipstick:128,192,240
368+
2360:lizard:64,64,112
369+
2361:lobster:192,64,112
370+
2362:loveseat:64,192,112
371+
2363:luggage_and_bags:192,192,112
372+
2364:lynx:64,64,240
373+
2365:maillot:192,64,240
374+
2366:man:64,192,240
375+
2367:mango:192,192,240
376+
2368:maple:32,0,48
377+
2369:maraca:160,0,48
378+
2370:marine_invertebrates:32,128,48
379+
2371:marine_mammal:160,128,48
380+
2372:mat:32,0,176
381+
2373:measuring_cup:160,0,176
382+
2374:mechanical_fan:32,128,176
383+
2375:metal:160,128,176
384+
2376:microphone:96,0,48
385+
2377:microwave:224,0,48
386+
2378:microwave_oven:96,128,48
387+
2379:milk_can:224,128,48
388+
2380:miniskirt:96,0,176
389+
2381:mirror:224,0,176
390+
2382:mirror_stuff:96,128,176
391+
2383:misc:224,128,176
392+
2384:missile:32,64,48
393+
2385:mixer:160,64,48
394+
2386:mobile_phone:32,192,48
395+
2387:monkey:160,192,48
396+
2388:moss:32,64,176
397+
2389:moths_and_butterflies:160,64,176
398+
2390:motorbike:32,192,176
399+
2391:motorcycle:160,192,176
400+
2392:mountain:96,64,48
401+
2393:mouse:224,64,48
402+
2394:mud:96,192,48
403+
2395:muffin:224,192,48
404+
2396:mug:96,64,176
405+
2397:mule:224,64,176
406+
2398:mushroom:96,192,176
407+
2399:musical_instrument:224,192,176
408+
2400:musical_keyboard:32,0,112
409+
2401:nail:160,0,112
410+
2402:napkin:32,128,112
411+
2403:nature:160,128,112
412+
2404:neck_brace:32,0,240
413+
2405:necklace:160,0,240
414+
2406:net:32,128,240
415+
2407:nightstand:160,128,240
416+
2408:non_vehicle:96,0,112
417+
2409:obj:224,0,112
418+
2410:object:96,128,112
419+
2411:oboe:224,128,112
420+
2412:office_building:96,0,240
421+
2413:office_supplies:224,0,240
422+
2414:on_rails:96,128,240
423+
2415:orange:224,128,240
424+
2416:organ:32,64,112
425+
2417:ostrich:160,64,112
426+
2418:otter:32,192,112
427+
2419:oven:160,192,112
428+
2420:owl:32,64,240
429+
2421:oyster:160,64,240
430+
2422:paddle:32,192,240
431+
2423:palm_tree:160,192,240
432+
2424:pancake:96,64,112
433+
2425:paper:224,64,112
434+
2426:paper_towel:96,192,112
435+
2427:parachute:224,192,112
436+
2428:parking:96,64,240
437+
2429:parking_meter:224,64,240
438+
2430:parrot:96,192,240
439+
2431:pasta:224,192,240
440+
2432:pavement:0,32,48
441+
2433:peach:128,32,48
442+
2434:pear:0,160,48
443+
2435:pedestrian:128,160,48
444+
2436:pen:0,32,176
445+
2437:pencil_box:128,32,176
446+
2438:pencil_sharpener:0,160,176
447+
2439:penguin:128,160,176
448+
2440:perfume:64,32,48
449+
2441:person:192,32,48
450+
2442:personal_care:64,160,48
451+
2443:piano:192,160,48
452+
2444:picnic_basket:64,32,176
453+
2445:picture_frame:192,32,176
454+
2446:pig:64,160,176
455+
2447:pillow:192,160,176
456+
2448:pineapple:0,96,48
457+
2449:ping_pong_ball:128,96,48
458+
2450:pitcher:0,224,48
459+
2451:pizza:128,224,48
460+
2452:plant_other:0,96,176
461+
2453:plastic:128,96,176
462+
2454:plastic_bag:0,224,176
463+
2455:plate:128,224,176
464+
2456:plate_rack:64,96,48
465+
2457:platform:192,96,48
466+
2458:platter:64,224,48
467+
2459:playingfield:192,224,48
468+
2460:plumbing_fixture:64,96,176
469+
2461:polar_bear:192,96,176
470+
2462:pole:64,224,176
471+
2463:pole_group:192,224,176
472+
2464:pomegranate:0,32,112
473+
2465:popcorn:128,32,112
474+
2466:popsicle:0,160,112
475+
2467:porch:128,160,112
476+
2468:porcupine:0,32,240
477+
2469:poster:128,32,240
478+
2470:potato:0,160,240
479+
2471:potted_plant:128,160,240
480+
2472:pottedplant:64,32,112
481+
2473:power_drill:192,32,112
482+
2474:power_plugs_and_sockets:64,160,112
483+
2475:pressure_cooker:192,160,112
484+
2476:pretzel:64,32,240
485+
2477:printer:192,32,240
486+
2478:puck:64,160,240
487+
2479:pumpkin:192,160,240
488+
2480:punching_bag:0,96,112
489+
2481:purse:128,96,112
490+
2482:rabbit:0,224,112
491+
2483:raccoon:128,224,112
492+
2484:racket:0,96,240
493+
2485:radish:128,96,240
494+
2486:rail:0,224,240
495+
2487:rail_track:128,224,240
496+
2488:railing:64,96,112
497+
2489:railroad:192,96,112
498+
2490:raven:64,224,112
499+
2491:ray:192,224,112
500+
2492:red_panda:64,96,240
501+
2493:refrigerator:192,96,240
502+
2494:remote:64,224,240
503+
2495:remote_control:192,224,240
504+
2496:reptile:32,32,48
505+
2497:rhinoceros:160,32,48
506+
2498:rider:32,160,48
507+
2499:rifle:160,160,48
508+
2500:ring_binder:32,32,176
509+
2501:river:160,32,176
510+
2502:road:32,160,176
511+
2503:rock:160,160,176
512+
2504:rocket:96,32,48
513+
2505:roller_skates:224,32,48
514+
2506:roof:96,160,48
515+
2507:rose:224,160,48
516+
2508:rubber_eraser:96,32,176
517+
2509:rug:224,32,176
518+
2510:rugby_ball:96,160,176
519+
2511:ruler:224,160,176
520+
2512:salad:32,96,48
521+
2513:salt_and_pepper_shakers:160,96,48
522+
2514:salt_or_pepper_shaker:32,224,48
523+
2515:sand:160,224,48
524+
2516:sandal:32,96,176
525+
2517:sandwich:160,96,176
526+
2518:saucer:32,224,176
527+
2519:saxophone:160,224,176
528+
2520:scarf:96,96,48
529+
2521:scissors:224,96,48
530+
2522:scoreboard:96,224,48
531+
2523:scorpion:224,224,48
532+
2524:screwdriver:96,96,176
533+
2525:sculpture:224,96,176
534+
2526:sea:96,224,176
535+
2527:sea_lion:224,224,176
536+
2528:sea_turtle:32,32,112
537+
2529:seafood:160,32,112
538+
2530:seahorse:32,160,112
539+
2531:seal:160,160,112
540+
2532:seat_belt:32,32,240
541+
2533:segway:160,32,240
542+
2534:serving_tray:32,160,240
543+
2535:sewing_machine:160,160,240
544+
2536:shark:96,32,112
545+
2537:sheep:224,32,112
546+
2538:shelf:96,160,112
547+
2539:shellfish:224,160,112
548+
2540:shirt:96,32,240
549+
2541:shoe:224,32,240
550+
2542:shorts:96,160,240
551+
2543:shotgun:224,160,240
552+
2544:shower:32,96,112
553+
2545:shrimp:160,96,112
554+
2546:sidewalk:32,224,112
555+
2547:sink:160,224,112
556+
2548:skateboard:32,96,240
557+
2549:ski:160,96,240
558+
2550:skirt:32,224,240
559+
2551:skis:160,224,240
560+
2552:skull:96,96,112
561+
2553:skunk:224,96,112
562+
2554:sky:96,224,112
563+
2555:sky_other:224,224,112
564+
2556:skyscraper:96,96,240
565+
2557:slow_cooker:224,96,240
566+
2558:snail:96,224,240
567+
2559:snake:224,224,240
568+
2560:snow:16,0,16
569+
2561:snowboard:144,0,16
570+
2562:snowman:16,128,16
571+
2563:snowmobile:144,128,16
572+
2564:snowplow:16,0,144
573+
2565:soap_dispenser:144,0,144
574+
2566:soccer_ball:16,128,144
575+
2567:sock:144,128,144
576+
2568:sofa:80,0,16
577+
2569:sofa_bed:208,0,16
578+
2570:solid_other:80,128,16
579+
2571:sombrero:208,128,16
580+
2572:sparrow:80,0,144
581+
2573:spatula:208,0,144
582+
2574:spider:80,128,144
583+
2575:spoon:208,128,144
584+
2576:sports_ball:16,64,16
585+
2577:sports_uniform:144,64,16
586+
2578:squash:16,192,16
587+
2579:squirrel:144,192,16
588+
2580:stairs:16,64,144
589+
2581:starfish:144,64,144
590+
2582:start:16,192,144
591+
2583:static:144,192,144
592+
2584:stationary_bicycle:80,64,16
593+
2585:stethoscope:208,64,16
594+
2586:stone:80,192,16
595+
2587:stool:208,192,16
596+
2588:stop:80,64,144
597+
2589:stop_sign:208,64,144
598+
2590:stove:80,192,144
599+
2591:strainer:208,192,144
600+
2592:straw:16,0,80
601+
2593:strawberry:144,0,80
602+
2594:street_light:16,128,80
603+
2595:street_sign:144,128,80
604+
2596:stretcher:16,0,208
605+
2597:structural_other:144,0,208
606+
2598:studio_couch:16,128,208
607+
2599:submarine_sandwich:144,128,208
608+
2600:suit:80,0,80
609+
2601:suitcase:208,0,80
610+
2602:sun_hat:80,128,80
611+
2603:sunflower:208,128,80
612+
2604:sunglasses:80,0,208
613+
2605:surfboard:208,0,208
614+
2606:sushi:80,128,208
615+
2607:swan:208,128,208
616+
2608:swim_cap:16,64,80
617+
2609:swimming_pool:144,64,80
618+
2610:swimming_trunks:16,192,80
619+
2611:swimwear:144,192,80
620+
2612:swine:16,64,208
621+
2613:sword:144,64,208
622+
2614:syringe:16,192,208
623+
2615:table:144,192,208
624+
2616:table_tennis_racket:80,64,80
625+
2617:tablet_computer:208,64,80
626+
2618:tableware:80,192,80
627+
2619:taco:208,192,80
628+
2620:tank:80,64,208
629+
2621:tap:208,64,208
630+
2622:tape_player:80,192,208
631+
2623:tart:208,192,208
632+
2624:taxi:48,0,16
633+
2625:tea:176,0,16
634+
2626:teapot:48,128,16
635+
2627:teddy_bear:176,128,16
636+
2628:telephone:48,0,144
637+
2629:television:176,0,144
638+
2630:tennis_ball:48,128,144
639+
2631:tennis_racket:176,128,144
640+
2632:tent:112,0,16
641+
2633:terrain:240,0,16
642+
2634:textile_other:112,128,16
643+
2635:tiara:240,128,16
644+
2636:tick:112,0,144
645+
2637:tie:240,0,144
646+
2638:tiger:112,128,144
647+
2639:tin_can:240,128,144
648+
2640:tire:48,64,16
649+
2641:toaster:176,64,16
650+
2642:toilet:48,192,16
651+
2643:toilet_paper:176,192,16
652+
2644:tomato:48,64,144
653+
2645:toothbrush:176,64,144
654+
2646:torch:48,192,144
655+
2647:tortoise:176,192,144
656+
2648:towel:112,64,16
657+
2649:tower:240,64,16
658+
2650:toy:112,192,16
659+
2651:traffic_light:240,192,16
660+
2652:traffic_sign:112,64,144
661+
2653:trailer:240,64,144
662+
2654:train:112,192,144
663+
2655:tram:240,192,144
664+
2656:treadmill:48,0,80
665+
2657:tree:176,0,80
666+
2658:tripod:48,128,80
667+
2659:trombone:176,128,80
668+
2660:trousers:48,0,208
669+
2661:truck:176,0,208
670+
2662:trumpet:48,128,208
671+
2663:tunnel:176,128,208
672+
2664:turkey:112,0,80
673+
2665:turtle:240,0,80
674+
2666:tv:112,128,80
675+
2667:tv_or_monitor:240,128,80
676+
2668:tvmonitor:112,0,208
677+
2669:umbrella:240,0,208
678+
2670:undefined:112,128,208
679+
2671:unicycle:240,128,208
680+
2672:unlabeled:48,64,80
681+
2673:vacuum:176,64,80
682+
2674:van:48,192,80
683+
2675:vase:176,192,80
684+
2676:vegetable:48,64,208
685+
2677:vegetation:176,64,208
686+
2678:vehicle:48,192,208
687+
2679:vehicle_registration_plate:176,192,208
688+
2680:violin:112,64,80
689+
2681:void:240,64,80
690+
2682:volleyball:112,192,80
691+
2683:waffle:240,192,80
692+
2684:waffle_iron:112,64,208
693+
2685:wall:240,64,208
694+
2686:wall_brick:112,192,208
695+
2687:wall_clock:240,192,208
696+
2688:wall_concrete:16,32,16
697+
2689:wall_other:144,32,16
698+
2690:wall_panel:16,160,16
699+
2691:wall_stone:144,160,16
700+
2692:wall_tile:16,32,144
701+
2693:wall_wood:144,32,144
702+
2694:washer:16,160,144
703+
2695:washing_machine:144,160,144
704+
2696:waste_container:80,32,16
705+
2697:watch:208,32,16
706+
2698:water_bottle:80,160,16
707+
2699:water_other:208,160,16
708+
2700:watercraft:80,32,144
709+
2701:waterdrops:208,32,144
710+
2702:watermelon:80,160,144
711+
2703:weapon:208,160,144
712+
2704:whale:16,96,16
713+
2705:wheel:144,96,16
714+
2706:wheelchair:16,224,16
715+
2707:whiteboard:144,224,16
716+
2708:willow:16,96,144
717+
2709:window:144,96,144
718+
2710:window_blind:16,224,144
719+
2711:window_other:144,224,144
720+
2712:wine:80,96,16
721+
2713:wine_bottle:208,96,16
722+
2714:wine_glass:80,224,16
723+
2715:winter_melon:208,224,16
724+
2716:wok:80,96,144
725+
2717:woman:208,96,144
726+
2718:wood:80,224,144
727+
2719:wood_burning_stove:208,224,144
728+
2720:woodpecker:16,32,80
729+
2721:wrench:144,32,80
730+
2722:zebra:16,160,80
731+
2723:zucchini:144,160,80

‎datumaro/datumaro/util/mask_tools.py

+6
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99

1010

1111
def generate_colormap(length=256):
12+
"""
13+
Generates colors using PASCAL VOC algorithm.
14+
15+
Returns index -> (R, G, B) mapping.
16+
"""
17+
1218
def get_bit(number, index):
1319
return (number >> index) & 1
1420

0 commit comments

Comments
 (0)
Please sign in to comment.