Arulkumar03/Wheat_HEAD_Detection_Counting_ComputerVision_Model
0
1# -*- coding: utf-8 -*-2# Copyright (c) Facebook, Inc. and its affiliates.3 4"""5Note:6For your custom dataset, there is no need to hard-code metadata anywhere in the code.7For example, for COCO-format dataset, metadata will be obtained automatically8when calling `load_coco_json`. For other dataset, metadata may also be obtained in other ways9during loading.10 11However, we hard-coded metadata for a few common dataset here.12The only goal is to allow users who don't have these dataset to use pre-trained models.13Users don't have to download a COCO json (which contains metadata), in order to visualize a14COCO model (with correct class names and colors).15"""16 17 18# All coco categories, together with their nice-looking visualization colors19# It's from https://github.com/cocodataset/panopticapi/blob/master/panoptic_coco_categories.json20COCO_CATEGORIES = [21 {"color": [220, 20, 60], "isthing": 1, "id": 1, "name": "person"},22 {"color": [119, 11, 32], "isthing": 1, "id": 2, "name": "bicycle"},23 {"color": [0, 0, 142], "isthing": 1, "id": 3, "name": "car"},24 {"color": [0, 0, 230], "isthing": 1, "id": 4, "name": "motorcycle"},25 {"color": [106, 0, 228], "isthing": 1, "id": 5, "name": "airplane"},26 {"color": [0, 60, 100], "isthing": 1, "id": 6, "name": "bus"},27 {"color": [0, 80, 100], "isthing": 1, "id": 7, "name": "train"},28 {"color": [0, 0, 70], "isthing": 1, "id": 8, "name": "truck"},29 {"color": [0, 0, 192], "isthing": 1, "id": 9, "name": "boat"},30 {"color": [250, 170, 30], "isthing": 1, "id": 10, "name": "traffic light"},31 {"color": [100, 170, 30], "isthing": 1, "id": 11, "name": "fire hydrant"},32 {"color": [220, 220, 0], "isthing": 1, "id": 13, "name": "stop sign"},33 {"color": [175, 116, 175], "isthing": 1, "id": 14, "name": "parking meter"},34 {"color": [250, 0, 30], "isthing": 1, "id": 15, "name": "bench"},35 {"color": [165, 42, 42], "isthing": 1, "id": 16, "name": "bird"},36 {"color": [255, 77, 255], "isthing": 1, "id": 17, "name": "cat"},37 {"color": [0, 226, 252], "isthing": 1, "id": 18, "name": "dog"},38 {"color": [182, 182, 255], "isthing": 1, "id": 19, "name": "horse"},39 {"color": [0, 82, 0], "isthing": 1, "id": 20, "name": "sheep"},40 {"color": [120, 166, 157], "isthing": 1, "id": 21, "name": "cow"},41 {"color": [110, 76, 0], "isthing": 1, "id": 22, "name": "elephant"},42 {"color": [174, 57, 255], "isthing": 1, "id": 23, "name": "bear"},43 {"color": [199, 100, 0], "isthing": 1, "id": 24, "name": "zebra"},44 {"color": [72, 0, 118], "isthing": 1, "id": 25, "name": "giraffe"},45 {"color": [255, 179, 240], "isthing": 1, "id": 27, "name": "backpack"},46 {"color": [0, 125, 92], "isthing": 1, "id": 28, "name": "umbrella"},47 {"color": [209, 0, 151], "isthing": 1, "id": 31, "name": "handbag"},48 {"color": [188, 208, 182], "isthing": 1, "id": 32, "name": "tie"},49 {"color": [0, 220, 176], "isthing": 1, "id": 33, "name": "suitcase"},50 {"color": [255, 99, 164], "isthing": 1, "id": 34, "name": "frisbee"},51 {"color": [92, 0, 73], "isthing": 1, "id": 35, "name": "skis"},52 {"color": [133, 129, 255], "isthing": 1, "id": 36, "name": "snowboard"},53 {"color": [78, 180, 255], "isthing": 1, "id": 37, "name": "sports ball"},54 {"color": [0, 228, 0], "isthing": 1, "id": 38, "name": "kite"},55 {"color": [174, 255, 243], "isthing": 1, "id": 39, "name": "baseball bat"},56 {"color": [45, 89, 255], "isthing": 1, "id": 40, "name": "baseball glove"},57 {"color": [134, 134, 103], "isthing": 1, "id": 41, "name": "skateboard"},58 {"color": [145, 148, 174], "isthing": 1, "id": 42, "name": "surfboard"},59 {"color": [255, 208, 186], "isthing": 1, "id": 43, "name": "tennis racket"},60 {"color": [197, 226, 255], "isthing": 1, "id": 44, "name": "bottle"},61 {"color": [171, 134, 1], "isthing": 1, "id": 46, "name": "wine glass"},62 {"color": [109, 63, 54], "isthing": 1, "id": 47, "name": "cup"},63 {"color": [207, 138, 255], "isthing": 1, "id": 48, "name": "fork"},64 {"color": [151, 0, 95], "isthing": 1, "id": 49, "name": "knife"},65 {"color": [9, 80, 61], "isthing": 1, "id": 50, "name": "spoon"},66 {"color": [84, 105, 51], "isthing": 1, "id": 51, "name": "bowl"},67 {"color": [74, 65, 105], "isthing": 1, "id": 52, "name": "banana"},68 {"color": [166, 196, 102], "isthing": 1, "id": 53, "name": "apple"},69 {"color": [208, 195, 210], "isthing": 1, "id": 54, "name": "sandwich"},70 {"color": [255, 109, 65], "isthing": 1, "id": 55, "name": "orange"},71 {"color": [0, 143, 149], "isthing": 1, "id": 56, "name": "broccoli"},72 {"color": [179, 0, 194], "isthing": 1, "id": 57, "name": "carrot"},73 {"color": [209, 99, 106], "isthing": 1, "id": 58, "name": "hot dog"},74 {"color": [5, 121, 0], "isthing": 1, "id": 59, "name": "pizza"},75 {"color": [227, 255, 205], "isthing": 1, "id": 60, "name": "donut"},76 {"color": [147, 186, 208], "isthing": 1, "id": 61, "name": "cake"},77 {"color": [153, 69, 1], "isthing": 1, "id": 62, "name": "chair"},78 {"color": [3, 95, 161], "isthing": 1, "id": 63, "name": "couch"},79 {"color": [163, 255, 0], "isthing": 1, "id": 64, "name": "potted plant"},80 {"color": [119, 0, 170], "isthing": 1, "id": 65, "name": "bed"},81 {"color": [0, 182, 199], "isthing": 1, "id": 67, "name": "dining table"},82 {"color": [0, 165, 120], "isthing": 1, "id": 70, "name": "toilet"},83 {"color": [183, 130, 88], "isthing": 1, "id": 72, "name": "tv"},84 {"color": [95, 32, 0], "isthing": 1, "id": 73, "name": "laptop"},85 {"color": [130, 114, 135], "isthing": 1, "id": 74, "name": "mouse"},86 {"color": [110, 129, 133], "isthing": 1, "id": 75, "name": "remote"},87 {"color": [166, 74, 118], "isthing": 1, "id": 76, "name": "keyboard"},88 {"color": [219, 142, 185], "isthing": 1, "id": 77, "name": "cell phone"},89 {"color": [79, 210, 114], "isthing": 1, "id": 78, "name": "microwave"},90 {"color": [178, 90, 62], "isthing": 1, "id": 79, "name": "oven"},91 {"color": [65, 70, 15], "isthing": 1, "id": 80, "name": "toaster"},92 {"color": [127, 167, 115], "isthing": 1, "id": 81, "name": "sink"},93 {"color": [59, 105, 106], "isthing": 1, "id": 82, "name": "refrigerator"},94 {"color": [142, 108, 45], "isthing": 1, "id": 84, "name": "book"},95 {"color": [196, 172, 0], "isthing": 1, "id": 85, "name": "clock"},96 {"color": [95, 54, 80], "isthing": 1, "id": 86, "name": "vase"},97 {"color": [128, 76, 255], "isthing": 1, "id": 87, "name": "scissors"},98 {"color": [201, 57, 1], "isthing": 1, "id": 88, "name": "teddy bear"},99 {"color": [246, 0, 122], "isthing": 1, "id": 89, "name": "hair drier"},100 {"color": [191, 162, 208], "isthing": 1, "id": 90, "name": "toothbrush"},101 {"color": [255, 255, 128], "isthing": 0, "id": 92, "name": "banner"},102 {"color": [147, 211, 203], "isthing": 0, "id": 93, "name": "blanket"},103 {"color": [150, 100, 100], "isthing": 0, "id": 95, "name": "bridge"},104 {"color": [168, 171, 172], "isthing": 0, "id": 100, "name": "cardboard"},105 {"color": [146, 112, 198], "isthing": 0, "id": 107, "name": "counter"},106 {"color": [210, 170, 100], "isthing": 0, "id": 109, "name": "curtain"},107 {"color": [92, 136, 89], "isthing": 0, "id": 112, "name": "door-stuff"},108 {"color": [218, 88, 184], "isthing": 0, "id": 118, "name": "floor-wood"},109 {"color": [241, 129, 0], "isthing": 0, "id": 119, "name": "flower"},110 {"color": [217, 17, 255], "isthing": 0, "id": 122, "name": "fruit"},111 {"color": [124, 74, 181], "isthing": 0, "id": 125, "name": "gravel"},112 {"color": [70, 70, 70], "isthing": 0, "id": 128, "name": "house"},113 {"color": [255, 228, 255], "isthing": 0, "id": 130, "name": "light"},114 {"color": [154, 208, 0], "isthing": 0, "id": 133, "name": "mirror-stuff"},115 {"color": [193, 0, 92], "isthing": 0, "id": 138, "name": "net"},116 {"color": [76, 91, 113], "isthing": 0, "id": 141, "name": "pillow"},117 {"color": [255, 180, 195], "isthing": 0, "id": 144, "name": "platform"},118 {"color": [106, 154, 176], "isthing": 0, "id": 145, "name": "playingfield"},119 {"color": [230, 150, 140], "isthing": 0, "id": 147, "name": "railroad"},120 {"color": [60, 143, 255], "isthing": 0, "id": 148, "name": "river"},121 {"color": [128, 64, 128], "isthing": 0, "id": 149, "name": "road"},122 {"color": [92, 82, 55], "isthing": 0, "id": 151, "name": "roof"},123 {"color": [254, 212, 124], "isthing": 0, "id": 154, "name": "sand"},124 {"color": [73, 77, 174], "isthing": 0, "id": 155, "name": "sea"},125 {"color": [255, 160, 98], "isthing": 0, "id": 156, "name": "shelf"},126 {"color": [255, 255, 255], "isthing": 0, "id": 159, "name": "snow"},127 {"color": [104, 84, 109], "isthing": 0, "id": 161, "name": "stairs"},128 {"color": [169, 164, 131], "isthing": 0, "id": 166, "name": "tent"},129 {"color": [225, 199, 255], "isthing": 0, "id": 168, "name": "towel"},130 {"color": [137, 54, 74], "isthing": 0, "id": 171, "name": "wall-brick"},131 {"color": [135, 158, 223], "isthing": 0, "id": 175, "name": "wall-stone"},132 {"color": [7, 246, 231], "isthing": 0, "id": 176, "name": "wall-tile"},133 {"color": [107, 255, 200], "isthing": 0, "id": 177, "name": "wall-wood"},134 {"color": [58, 41, 149], "isthing": 0, "id": 178, "name": "water-other"},135 {"color": [183, 121, 142], "isthing": 0, "id": 180, "name": "window-blind"},136 {"color": [255, 73, 97], "isthing": 0, "id": 181, "name": "window-other"},137 {"color": [107, 142, 35], "isthing": 0, "id": 184, "name": "tree-merged"},138 {"color": [190, 153, 153], "isthing": 0, "id": 185, "name": "fence-merged"},139 {"color": [146, 139, 141], "isthing": 0, "id": 186, "name": "ceiling-merged"},140 {"color": [70, 130, 180], "isthing": 0, "id": 187, "name": "sky-other-merged"},141 {"color": [134, 199, 156], "isthing": 0, "id": 188, "name": "cabinet-merged"},142 {"color": [209, 226, 140], "isthing": 0, "id": 189, "name": "table-merged"},143 {"color": [96, 36, 108], "isthing": 0, "id": 190, "name": "floor-other-merged"},144 {"color": [96, 96, 96], "isthing": 0, "id": 191, "name": "pavement-merged"},145 {"color": [64, 170, 64], "isthing": 0, "id": 192, "name": "mountain-merged"},146 {"color": [152, 251, 152], "isthing": 0, "id": 193, "name": "grass-merged"},147 {"color": [208, 229, 228], "isthing": 0, "id": 194, "name": "dirt-merged"},148 {"color": [206, 186, 171], "isthing": 0, "id": 195, "name": "paper-merged"},149 {"color": [152, 161, 64], "isthing": 0, "id": 196, "name": "food-other-merged"},150 {"color": [116, 112, 0], "isthing": 0, "id": 197, "name": "building-other-merged"},151 {"color": [0, 114, 143], "isthing": 0, "id": 198, "name": "rock-merged"},152 {"color": [102, 102, 156], "isthing": 0, "id": 199, "name": "wall-other-merged"},153 {"color": [250, 141, 255], "isthing": 0, "id": 200, "name": "rug-merged"},154]155 156# fmt: off157COCO_PERSON_KEYPOINT_NAMES = (158 "nose",159 "left_eye", "right_eye",160 "left_ear", "right_ear",161 "left_shoulder", "right_shoulder",162 "left_elbow", "right_elbow",163 "left_wrist", "right_wrist",164 "left_hip", "right_hip",165 "left_knee", "right_knee",166 "left_ankle", "right_ankle",167)168# fmt: on169 170# Pairs of keypoints that should be exchanged under horizontal flipping171COCO_PERSON_KEYPOINT_FLIP_MAP = (172 ("left_eye", "right_eye"),173 ("left_ear", "right_ear"),174 ("left_shoulder", "right_shoulder"),175 ("left_elbow", "right_elbow"),176 ("left_wrist", "right_wrist"),177 ("left_hip", "right_hip"),178 ("left_knee", "right_knee"),179 ("left_ankle", "right_ankle"),180)181 182# rules for pairs of keypoints to draw a line between, and the line color to use.183KEYPOINT_CONNECTION_RULES = [184 # face185 ("left_ear", "left_eye", (102, 204, 255)),186 ("right_ear", "right_eye", (51, 153, 255)),187 ("left_eye", "nose", (102, 0, 204)),188 ("nose", "right_eye", (51, 102, 255)),189 # upper-body190 ("left_shoulder", "right_shoulder", (255, 128, 0)),191 ("left_shoulder", "left_elbow", (153, 255, 204)),192 ("right_shoulder", "right_elbow", (128, 229, 255)),193 ("left_elbow", "left_wrist", (153, 255, 153)),194 ("right_elbow", "right_wrist", (102, 255, 224)),195 # lower-body196 ("left_hip", "right_hip", (255, 102, 0)),197 ("left_hip", "left_knee", (255, 255, 77)),198 ("right_hip", "right_knee", (153, 255, 204)),199 ("left_knee", "left_ankle", (191, 255, 128)),200 ("right_knee", "right_ankle", (255, 195, 77)),201]202 203# All Cityscapes categories, together with their nice-looking visualization colors204# It's from https://github.com/mcordts/cityscapesScripts/blob/master/cityscapesscripts/helpers/labels.py # noqa205CITYSCAPES_CATEGORIES = [206 {"color": (128, 64, 128), "isthing": 0, "id": 7, "trainId": 0, "name": "road"},207 {"color": (244, 35, 232), "isthing": 0, "id": 8, "trainId": 1, "name": "sidewalk"},208 {"color": (70, 70, 70), "isthing": 0, "id": 11, "trainId": 2, "name": "building"},209 {"color": (102, 102, 156), "isthing": 0, "id": 12, "trainId": 3, "name": "wall"},210 {"color": (190, 153, 153), "isthing": 0, "id": 13, "trainId": 4, "name": "fence"},211 {"color": (153, 153, 153), "isthing": 0, "id": 17, "trainId": 5, "name": "pole"},212 {"color": (250, 170, 30), "isthing": 0, "id": 19, "trainId": 6, "name": "traffic light"},213 {"color": (220, 220, 0), "isthing": 0, "id": 20, "trainId": 7, "name": "traffic sign"},214 {"color": (107, 142, 35), "isthing": 0, "id": 21, "trainId": 8, "name": "vegetation"},215 {"color": (152, 251, 152), "isthing": 0, "id": 22, "trainId": 9, "name": "terrain"},216 {"color": (70, 130, 180), "isthing": 0, "id": 23, "trainId": 10, "name": "sky"},217 {"color": (220, 20, 60), "isthing": 1, "id": 24, "trainId": 11, "name": "person"},218 {"color": (255, 0, 0), "isthing": 1, "id": 25, "trainId": 12, "name": "rider"},219 {"color": (0, 0, 142), "isthing": 1, "id": 26, "trainId": 13, "name": "car"},220 {"color": (0, 0, 70), "isthing": 1, "id": 27, "trainId": 14, "name": "truck"},221 {"color": (0, 60, 100), "isthing": 1, "id": 28, "trainId": 15, "name": "bus"},222 {"color": (0, 80, 100), "isthing": 1, "id": 31, "trainId": 16, "name": "train"},223 {"color": (0, 0, 230), "isthing": 1, "id": 32, "trainId": 17, "name": "motorcycle"},224 {"color": (119, 11, 32), "isthing": 1, "id": 33, "trainId": 18, "name": "bicycle"},225]226 227# fmt: off228ADE20K_SEM_SEG_CATEGORIES = [229 "wall", "building", "sky", "floor", "tree", "ceiling", "road, route", "bed", "window ", "grass", "cabinet", "sidewalk, pavement", "person", "earth, ground", "door", "table", "mountain, mount", "plant", "curtain", "chair", "car", "water", "painting, picture", "sofa", "shelf", "house", "sea", "mirror", "rug", "field", "armchair", "seat", "fence", "desk", "rock, stone", "wardrobe, closet, press", "lamp", "tub", "rail", "cushion", "base, pedestal, stand", "box", "column, pillar", "signboard, sign", "chest of drawers, chest, bureau, dresser", "counter", "sand", "sink", "skyscraper", "fireplace", "refrigerator, icebox", "grandstand, covered stand", "path", "stairs", "runway", "case, display case, showcase, vitrine", "pool table, billiard table, snooker table", "pillow", "screen door, screen", "stairway, staircase", "river", "bridge, span", "bookcase", "blind, screen", "coffee table", "toilet, can, commode, crapper, pot, potty, stool, throne", "flower", "book", "hill", "bench", "countertop", "stove", "palm, palm tree", "kitchen island", "computer", "swivel chair", "boat", "bar", "arcade machine", "hovel, hut, hutch, shack, shanty", "bus", "towel", "light", "truck", "tower", "chandelier", "awning, sunshade, sunblind", "street lamp", "booth", "tv", "plane", "dirt track", "clothes", "pole", "land, ground, soil", "bannister, banister, balustrade, balusters, handrail", "escalator, moving staircase, moving stairway", "ottoman, pouf, pouffe, puff, hassock", "bottle", "buffet, counter, sideboard", "poster, posting, placard, notice, bill, card", "stage", "van", "ship", "fountain", "conveyer belt, conveyor belt, conveyer, conveyor, transporter", "canopy", "washer, automatic washer, washing machine", "plaything, toy", "pool", "stool", "barrel, cask", "basket, handbasket", "falls", "tent", "bag", "minibike, motorbike", "cradle", "oven", "ball", "food, solid food", "step, stair", "tank, storage tank", "trade name", "microwave", "pot", "animal", "bicycle", "lake", "dishwasher", "screen", "blanket, cover", "sculpture", "hood, exhaust hood", "sconce", "vase", "traffic light", "tray", "trash can", "fan", "pier", "crt screen", "plate", "monitor", "bulletin board", "shower", "radiator", "glass, drinking glass", "clock", "flag", # noqa230]231# After processed by `prepare_ade20k_sem_seg.py`, id 255 means ignore232# fmt: on233 234 235def _get_coco_instances_meta():236 thing_ids = [k["id"] for k in COCO_CATEGORIES if k["isthing"] == 1]237 thing_colors = [k["color"] for k in COCO_CATEGORIES if k["isthing"] == 1]238 assert len(thing_ids) == 80, len(thing_ids)239 # Mapping from the incontiguous COCO category id to an id in [0, 79]240 thing_dataset_id_to_contiguous_id = {k: i for i, k in enumerate(thing_ids)}241 thing_classes = [k["name"] for k in COCO_CATEGORIES if k["isthing"] == 1]242 ret = {243 "thing_dataset_id_to_contiguous_id": thing_dataset_id_to_contiguous_id,244 "thing_classes": thing_classes,245 "thing_colors": thing_colors,246 }247 return ret248 249 250def _get_coco_panoptic_separated_meta():251 """252 Returns metadata for "separated" version of the panoptic segmentation dataset.253 """254 stuff_ids = [k["id"] for k in COCO_CATEGORIES if k["isthing"] == 0]255 assert len(stuff_ids) == 53, len(stuff_ids)256 257 # For semantic segmentation, this mapping maps from contiguous stuff id258 # (in [0, 53], used in models) to ids in the dataset (used for processing results)259 # The id 0 is mapped to an extra category "thing".260 stuff_dataset_id_to_contiguous_id = {k: i + 1 for i, k in enumerate(stuff_ids)}261 # When converting COCO panoptic annotations to semantic annotations262 # We label the "thing" category to 0263 stuff_dataset_id_to_contiguous_id[0] = 0264 265 # 54 names for COCO stuff categories (including "things")266 stuff_classes = ["things"] + [267 k["name"].replace("-other", "").replace("-merged", "")268 for k in COCO_CATEGORIES269 if k["isthing"] == 0270 ]271 272 # NOTE: I randomly picked a color for things273 stuff_colors = [[82, 18, 128]] + [k["color"] for k in COCO_CATEGORIES if k["isthing"] == 0]274 ret = {275 "stuff_dataset_id_to_contiguous_id": stuff_dataset_id_to_contiguous_id,276 "stuff_classes": stuff_classes,277 "stuff_colors": stuff_colors,278 }279 ret.update(_get_coco_instances_meta())280 return ret281 282 283def _get_builtin_metadata(dataset_name):284 if dataset_name == "coco":285 return _get_coco_instances_meta()286 if dataset_name == "coco_panoptic_separated":287 return _get_coco_panoptic_separated_meta()288 elif dataset_name == "coco_panoptic_standard":289 meta = {}290 # The following metadata maps contiguous id from [0, #thing categories +291 # #stuff categories) to their names and colors. We have to replica of the292 # same name and color under "thing_*" and "stuff_*" because the current293 # visualization function in D2 handles thing and class classes differently294 # due to some heuristic used in Panoptic FPN. We keep the same naming to295 # enable reusing existing visualization functions.296 thing_classes = [k["name"] for k in COCO_CATEGORIES]297 thing_colors = [k["color"] for k in COCO_CATEGORIES]298 stuff_classes = [k["name"] for k in COCO_CATEGORIES]299 stuff_colors = [k["color"] for k in COCO_CATEGORIES]300 301 meta["thing_classes"] = thing_classes302 meta["thing_colors"] = thing_colors303 meta["stuff_classes"] = stuff_classes304 meta["stuff_colors"] = stuff_colors305 306 # Convert category id for training:307 # category id: like semantic segmentation, it is the class id for each308 # pixel. Since there are some classes not used in evaluation, the category309 # id is not always contiguous and thus we have two set of category ids:310 # - original category id: category id in the original dataset, mainly311 # used for evaluation.312 # - contiguous category id: [0, #classes), in order to train the linear313 # softmax classifier.314 thing_dataset_id_to_contiguous_id = {}315 stuff_dataset_id_to_contiguous_id = {}316 317 for i, cat in enumerate(COCO_CATEGORIES):318 if cat["isthing"]:319 thing_dataset_id_to_contiguous_id[cat["id"]] = i320 else:321 stuff_dataset_id_to_contiguous_id[cat["id"]] = i322 323 meta["thing_dataset_id_to_contiguous_id"] = thing_dataset_id_to_contiguous_id324 meta["stuff_dataset_id_to_contiguous_id"] = stuff_dataset_id_to_contiguous_id325 326 return meta327 elif dataset_name == "coco_person":328 return {329 "thing_classes": ["person"],330 "keypoint_names": COCO_PERSON_KEYPOINT_NAMES,331 "keypoint_flip_map": COCO_PERSON_KEYPOINT_FLIP_MAP,332 "keypoint_connection_rules": KEYPOINT_CONNECTION_RULES,333 }334 elif dataset_name == "cityscapes":335 # fmt: off336 CITYSCAPES_THING_CLASSES = [337 "person", "rider", "car", "truck",338 "bus", "train", "motorcycle", "bicycle",339 ]340 CITYSCAPES_STUFF_CLASSES = [341 "road", "sidewalk", "building", "wall", "fence", "pole", "traffic light",342 "traffic sign", "vegetation", "terrain", "sky", "person", "rider", "car",343 "truck", "bus", "train", "motorcycle", "bicycle",344 ]345 # fmt: on346 return {347 "thing_classes": CITYSCAPES_THING_CLASSES,348 "stuff_classes": CITYSCAPES_STUFF_CLASSES,349 }350 raise KeyError("No built-in metadata for dataset {}".format(dataset_name))351 