-
-
Save akTwelve/dc79fc8b9ae66828e7c7f648049bc42d to your computer and use it in GitHub Desktop.
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# COCO Image Viewer\n", | |
"This notebook will allow you to view details about a COCO dataset and preview segmentations on annotated images.\n", | |
"Learn more about it at: http://cocodataset.org/\n", | |
"\n", | |
"Note: Gist probably won't show the segmentations, but if you run this code in your own Jupyter Notebook, you'll see them.\n", | |
"\n", | |
"The rest of the tutorial can be found at: http://www.immersivelimit.com/tutorials/create-coco-annotations-from-scratch" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import IPython\n", | |
"import os\n", | |
"import json\n", | |
"import random\n", | |
"import numpy as np\n", | |
"import requests\n", | |
"from io import BytesIO\n", | |
"import base64\n", | |
"from math import trunc\n", | |
"from PIL import Image as PILImage\n", | |
"from PIL import ImageDraw as PILImageDraw" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"# Load the dataset json\n", | |
"class CocoDataset():\n", | |
" def __init__(self, annotation_path, image_dir):\n", | |
" self.annotation_path = annotation_path\n", | |
" self.image_dir = image_dir\n", | |
" self.colors = colors = ['blue', 'purple', 'red', 'green', 'orange', 'salmon', 'pink', 'gold',\n", | |
" 'orchid', 'slateblue', 'limegreen', 'seagreen', 'darkgreen', 'olive',\n", | |
" 'teal', 'aquamarine', 'steelblue', 'powderblue', 'dodgerblue', 'navy',\n", | |
" 'magenta', 'sienna', 'maroon']\n", | |
" \n", | |
" json_file = open(self.annotation_path)\n", | |
" self.coco = json.load(json_file)\n", | |
" json_file.close()\n", | |
" \n", | |
" self.process_info()\n", | |
" self.process_licenses()\n", | |
" self.process_categories()\n", | |
" self.process_images()\n", | |
" self.process_segmentations()\n", | |
" \n", | |
" \n", | |
" def display_info(self):\n", | |
" print('Dataset Info:')\n", | |
" print('=============')\n", | |
" for key, item in self.info.items():\n", | |
" print(' {}: {}'.format(key, item))\n", | |
" \n", | |
" requirements = [['description', str],\n", | |
" ['url', str],\n", | |
" ['version', str],\n", | |
" ['year', int],\n", | |
" ['contributor', str],\n", | |
" ['date_created', str]]\n", | |
" for req, req_type in requirements:\n", | |
" if req not in self.info:\n", | |
" print('ERROR: {} is missing'.format(req))\n", | |
" elif type(self.info[req]) != req_type:\n", | |
" print('ERROR: {} should be type {}'.format(req, str(req_type)))\n", | |
" print('')\n", | |
"\n", | |
" \n", | |
" def display_licenses(self):\n", | |
" print('Licenses:')\n", | |
" print('=========')\n", | |
" \n", | |
" requirements = [['id', int],\n", | |
" ['url', str],\n", | |
" ['name', str]]\n", | |
" for license in self.licenses:\n", | |
" for key, item in license.items():\n", | |
" print(' {}: {}'.format(key, item))\n", | |
" for req, req_type in requirements:\n", | |
" if req not in license:\n", | |
" print('ERROR: {} is missing'.format(req))\n", | |
" elif type(license[req]) != req_type:\n", | |
" print('ERROR: {} should be type {}'.format(req, str(req_type)))\n", | |
" print('')\n", | |
" print('')\n", | |
" \n", | |
" def display_categories(self):\n", | |
" print('Categories:')\n", | |
" print('=========')\n", | |
" for sc_key, sc_val in self.super_categories.items():\n", | |
" print(' super_category: {}'.format(sc_key))\n", | |
" for cat_id in sc_val:\n", | |
" print(' id {}: {}'.format(cat_id, self.categories[cat_id]['name']))\n", | |
" print('')\n", | |
" \n", | |
" def display_image(self, image_id, show_polys=True, show_bbox=True, show_crowds=True, use_url=False):\n", | |
" print('Image:')\n", | |
" print('======')\n", | |
" if image_id == 'random':\n", | |
" image_id = random.choice(list(self.images.keys()))\n", | |
" \n", | |
" # Print the image info\n", | |
" image = self.images[image_id]\n", | |
" for key, val in image.items():\n", | |
" print(' {}: {}'.format(key, val))\n", | |
" \n", | |
" # Open the image\n", | |
" if use_url:\n", | |
" image_path = image['coco_url']\n", | |
" response = requests.get(image_path)\n", | |
" image = PILImage.open(BytesIO(response.content))\n", | |
" \n", | |
" else:\n", | |
" image_path = os.path.join(self.image_dir, image['file_name'])\n", | |
" image = PILImage.open(image_path)\n", | |
" \n", | |
" buffer = BytesIO()\n", | |
" image.save(buffer, format='PNG')\n", | |
" buffer.seek(0)\n", | |
" \n", | |
" data_uri = base64.b64encode(buffer.read()).decode('ascii')\n", | |
" image_path = \"data:image/png;base64,{0}\".format(data_uri)\n", | |
" \n", | |
" # Calculate the size and adjusted display size\n", | |
" max_width = 600\n", | |
" image_width, image_height = image.size\n", | |
" adjusted_width = min(image_width, max_width)\n", | |
" adjusted_ratio = adjusted_width / image_width\n", | |
" adjusted_height = adjusted_ratio * image_height\n", | |
" \n", | |
" # Create list of polygons to be drawn\n", | |
" polygons = {}\n", | |
" bbox_polygons = {}\n", | |
" rle_regions = {}\n", | |
" poly_colors = {}\n", | |
" print(' segmentations ({}):'.format(len(self.segmentations[image_id])))\n", | |
" for i, segm in enumerate(self.segmentations[image_id]):\n", | |
" polygons_list = []\n", | |
" if segm['iscrowd'] != 0:\n", | |
" # Gotta decode the RLE\n", | |
" px = 0\n", | |
" x, y = 0, 0\n", | |
" rle_list = []\n", | |
" for j, counts in enumerate(segm['segmentation']['counts']):\n", | |
" if j % 2 == 0:\n", | |
" # Empty pixels\n", | |
" px += counts\n", | |
" else:\n", | |
" # Need to draw on these pixels, since we are drawing in vector form,\n", | |
" # we need to draw horizontal lines on the image\n", | |
" x_start = trunc(trunc(px / image_height) * adjusted_ratio)\n", | |
" y_start = trunc(px % image_height * adjusted_ratio)\n", | |
" px += counts\n", | |
" x_end = trunc(trunc(px / image_height) * adjusted_ratio)\n", | |
" y_end = trunc(px % image_height * adjusted_ratio)\n", | |
" if x_end == x_start:\n", | |
" # This is only on one line\n", | |
" rle_list.append({'x': x_start, 'y': y_start, 'width': 1 , 'height': (y_end - y_start)})\n", | |
" if x_end > x_start:\n", | |
" # This spans more than one line\n", | |
" # Insert top line first\n", | |
" rle_list.append({'x': x_start, 'y': y_start, 'width': 1, 'height': (image_height - y_start)})\n", | |
" \n", | |
" # Insert middle lines if needed\n", | |
" lines_spanned = x_end - x_start + 1 # total number of lines spanned\n", | |
" full_lines_to_insert = lines_spanned - 2\n", | |
" if full_lines_to_insert > 0:\n", | |
" full_lines_to_insert = trunc(full_lines_to_insert * adjusted_ratio)\n", | |
" rle_list.append({'x': (x_start + 1), 'y': 0, 'width': full_lines_to_insert, 'height': image_height})\n", | |
" \n", | |
" # Insert bottom line\n", | |
" rle_list.append({'x': x_end, 'y': 0, 'width': 1, 'height': y_end})\n", | |
" if len(rle_list) > 0:\n", | |
" rle_regions[segm['id']] = rle_list \n", | |
" else:\n", | |
" # Add the polygon segmentation\n", | |
" for segmentation_points in segm['segmentation']:\n", | |
" segmentation_points = np.multiply(segmentation_points, adjusted_ratio).astype(int)\n", | |
" polygons_list.append(str(segmentation_points).lstrip('[').rstrip(']'))\n", | |
" polygons[segm['id']] = polygons_list\n", | |
" if i < len(self.colors):\n", | |
" poly_colors[segm['id']] = self.colors[i]\n", | |
" else:\n", | |
" poly_colors[segm['id']] = 'white'\n", | |
" \n", | |
" bbox = segm['bbox']\n", | |
" bbox_points = [bbox[0], bbox[1], bbox[0] + bbox[2], bbox[1],\n", | |
" bbox[0] + bbox[2], bbox[1] + bbox[3], bbox[0], bbox[1] + bbox[3],\n", | |
" bbox[0], bbox[1]]\n", | |
" bbox_points = np.multiply(bbox_points, adjusted_ratio).astype(int)\n", | |
" bbox_polygons[segm['id']] = str(bbox_points).lstrip('[').rstrip(']')\n", | |
" \n", | |
" # Print details\n", | |
" print(' {}:{}:{}'.format(segm['id'], poly_colors[segm['id']], self.categories[segm['category_id']]))\n", | |
" \n", | |
" \n", | |
" \n", | |
" # Draw segmentation polygons on image\n", | |
" html = '<div class=\"container\" style=\"position:relative;\">'\n", | |
" html += '<img src=\"{}\" style=\"position:relative;top:0px;left:0px;width:{}px;\">'.format(image_path, adjusted_width)\n", | |
" html += '<div class=\"svgclass\"><svg width=\"{}\" height=\"{}\">'.format(adjusted_width, adjusted_height)\n", | |
" \n", | |
" if show_polys:\n", | |
" for seg_id, points_list in polygons.items():\n", | |
" fill_color = poly_colors[seg_id]\n", | |
" stroke_color = poly_colors[seg_id]\n", | |
" for points in points_list:\n", | |
" html += '<polygon points=\"{}\" style=\"fill:{}; stroke:{}; stroke-width:1; fill-opacity:0.5\" />'.format(points, fill_color, stroke_color)\n", | |
" \n", | |
" if show_crowds:\n", | |
" for seg_id, rect_list in rle_regions.items():\n", | |
" fill_color = poly_colors[seg_id]\n", | |
" stroke_color = poly_colors[seg_id]\n", | |
" for rect_def in rect_list:\n", | |
" x, y = rect_def['x'], rect_def['y']\n", | |
" w, h = rect_def['width'], rect_def['height']\n", | |
" html += '<rect x=\"{}\" y=\"{}\" width=\"{}\" height=\"{}\" style=\"fill:{}; stroke:{}; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" />'.format(x, y, w, h, fill_color, stroke_color)\n", | |
" \n", | |
" if show_bbox:\n", | |
" for seg_id, points in bbox_polygons.items():\n", | |
" fill_color = poly_colors[seg_id]\n", | |
" stroke_color = poly_colors[seg_id]\n", | |
" html += '<polygon points=\"{}\" style=\"fill:{}; stroke:{}; stroke-width:1; fill-opacity:0\" />'.format(points, fill_color, stroke_color)\n", | |
" \n", | |
" html += '</svg></div>'\n", | |
" html += '</div>'\n", | |
" html += '<style>'\n", | |
" html += '.svgclass { position:absolute; top:0px; left:0px;}'\n", | |
" html += '</style>'\n", | |
" return html\n", | |
" \n", | |
" def process_info(self):\n", | |
" self.info = self.coco['info']\n", | |
" \n", | |
" def process_licenses(self):\n", | |
" self.licenses = self.coco['licenses']\n", | |
" \n", | |
" def process_categories(self):\n", | |
" self.categories = {}\n", | |
" self.super_categories = {}\n", | |
" for category in self.coco['categories']:\n", | |
" cat_id = category['id']\n", | |
" super_category = category['supercategory']\n", | |
" \n", | |
" # Add category to the categories dict\n", | |
" if cat_id not in self.categories:\n", | |
" self.categories[cat_id] = category\n", | |
" else:\n", | |
" print(\"ERROR: Skipping duplicate category id: {}\".format(category))\n", | |
"\n", | |
" # Add category to super_categories dict\n", | |
" if super_category not in self.super_categories:\n", | |
" self.super_categories[super_category] = {cat_id} # Create a new set with the category id\n", | |
" else:\n", | |
" self.super_categories[super_category] |= {cat_id} # Add category id to the set\n", | |
" \n", | |
" def process_images(self):\n", | |
" self.images = {}\n", | |
" for image in self.coco['images']:\n", | |
" image_id = image['id']\n", | |
" if image_id in self.images:\n", | |
" print(\"ERROR: Skipping duplicate image id: {}\".format(image))\n", | |
" else:\n", | |
" self.images[image_id] = image\n", | |
" \n", | |
" def process_segmentations(self):\n", | |
" self.segmentations = {}\n", | |
" for segmentation in self.coco['annotations']:\n", | |
" image_id = segmentation['image_id']\n", | |
" if image_id not in self.segmentations:\n", | |
" self.segmentations[image_id] = []\n", | |
" self.segmentations[image_id].append(segmentation)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Dataset Info:\n", | |
"=============\n", | |
" url: http://cocodataset.org\n", | |
" year: 2017\n", | |
" description: COCO 2017 Dataset\n", | |
" contributor: COCO Consortium\n", | |
" date_created: 2017/09/01\n", | |
" version: 1.0\n", | |
"\n", | |
"Licenses:\n", | |
"=========\n", | |
" url: http://creativecommons.org/licenses/by/2.0/\n", | |
" id: 4\n", | |
" name: Attribution License\n", | |
"\n", | |
"\n", | |
"Categories:\n", | |
"=========\n", | |
" super_category: vehicle\n", | |
" id 2: bicycle\n", | |
"\n", | |
" super_category: animal\n", | |
" id 22: elephant\n", | |
"\n" | |
] | |
} | |
], | |
"source": [ | |
"annotation_path = './sample_annotations.json'\n", | |
"image_dir = './images'\n", | |
"\n", | |
"coco_dataset = CocoDataset(annotation_path, image_dir)\n", | |
"coco_dataset.display_info()\n", | |
"coco_dataset.display_licenses()\n", | |
"coco_dataset.display_categories()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Image:\n", | |
"======\n", | |
" file_name: 000000242287.jpg\n", | |
" id: 242287\n", | |
" coco_url: http://images.cocodataset.org/val2017/000000242287.jpg\n", | |
" width: 426\n", | |
" date_captured: 2013-11-15 02:41:42\n", | |
" license: 4\n", | |
" flickr_url: http://farm3.staticflickr.com/2626/4072194513_edb6acfb2b_z.jpg\n", | |
" height: 640\n", | |
" segmentations (1):\n", | |
" 125686:blue:{'id': 2, 'name': 'bicycle', 'supercategory': 'vehicle'}\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<div class=\"container\" style=\"position:relative;\"><img src=\"http://images.cocodataset.org/val2017/000000242287.jpg\" style=\"position:relative;top:0px;left:0px;width:426px;\"><div class=\"svgclass\"><svg width=\"426\" height=\"640.0\"><polygon points=\"164 417 164 417 164 417 159 409 159 409 155 409 155 410 152 413 144 413\n", | |
" 140 413 137 413 134 414 129 414 122 414 104 405 104 405 93 401 93 401\n", | |
" 87 399 86 399 85 399 93 391 78 383 72 383 68 401 82 402 104 409\n", | |
" 104 421 85 458 79 469 65 454 61 455 59 455 42 471 39 479 39 482\n", | |
" 31 497 19 510 19 519 19 539 20 578 26 590 27 593 38 596 41 593\n", | |
" 50 589 53 587 59 585 71 579 79 568 82 560 85 535 87 520 90 513\n", | |
" 93 490 93 487 93 480 108 499 108 509 115 521 104 521 103 528 108 534\n", | |
" 119 530 124 535 126 535 129 543 166 582 171 578 197 598 208 608 249 627\n", | |
" 269 623 278 618 281 609 285 601 287 597 291 591 291 590 318 590 318 591\n", | |
" 329 589 332 586 333 583 309 563 313 547 313 541 313 526 313 523 313 516\n", | |
" 313 501 307 486 307 486 302 483 291 472 278 454 273 454 262 447 241 438\n", | |
" 226 425 226 420 210 413 206 413 197 414 167 410\" style=\"fill:blue; stroke:blue; stroke-width:1; fill-opacity:0.5\" /><polygon points=\" 19 383 333 383 333 627 19 627 19 383\" style=\"fill:blue; stroke:blue; stroke-width:1; fill-opacity:0\" /></svg></div></div><style>.svgclass { position:absolute; top:0px; left:0px;}</style>" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"html = coco_dataset.display_image(242287, use_url=True)\n", | |
"IPython.display.HTML(html)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Image:\n", | |
"======\n", | |
" file_name: 000000245915.jpg\n", | |
" id: 245915\n", | |
" coco_url: http://images.cocodataset.org/val2017/000000245915.jpg\n", | |
" width: 500\n", | |
" date_captured: 2013-11-18 02:53:27\n", | |
" license: 4\n", | |
" flickr_url: http://farm1.staticflickr.com/88/211747310_f58a16631e_z.jpg\n", | |
" height: 333\n", | |
" segmentations (14):\n", | |
" 1409619:blue:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 1410165:purple:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 1410330:red:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 1410622:green:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 1410759:orange:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 1410834:salmon:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 1410880:pink:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 1411090:gold:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 1411108:orchid:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 1411138:slateblue:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 1411160:limegreen:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 1411174:seagreen:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 2210312:darkgreen:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n", | |
" 902200245915:olive:{'id': 22, 'name': 'elephant', 'supercategory': 'animal'}\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/html": [ | |
"<div class=\"container\" style=\"position:relative;\"><img src=\"http://images.cocodataset.org/val2017/000000245915.jpg\" style=\"position:relative;top:0px;left:0px;width:500px;\"><div class=\"svgclass\"><svg width=\"500\" height=\"333.0\"><polygon points=\"222 191 233 181 241 167 248 154 257 153 281 149 294 149 300 152 312 160\n", | |
" 317 168 318 172 321 178 322 182 321 184 317 188 317 195 306 189 301 188\n", | |
" 294 188 281 186 283 195 277 195 274 189 269 195 263 196 263 185 257 195\n", | |
" 249 184 244 183 233 189 229 192\" style=\"fill:pink; stroke:pink; stroke-width:1; fill-opacity:0.5\" /><polygon points=\" 72 177 73 169 77 160 80 156 85 149 88 145 92 139 96 133 100 127\n", | |
" 104 125 109 124 118 124 130 122 136 122 149 121 161 123 169 127 170 130\n", | |
" 167 133 163 135 158 134 146 140 143 148 143 155 141 160 141 164 141 165\n", | |
" 136 165 133 163 131 169 132 176 132 178 132 178 127 178 122 165 122 163\n", | |
" 120 168 116 173 114 178 110 177 110 171 115 161 115 153 114 151 111 149\n", | |
" 109 151 102 152 98 152 96 151 91 157 83 161 77 167 76 170 75 173\n", | |
" 77 176 75 177\" style=\"fill:slateblue; stroke:slateblue; stroke-width:1; fill-opacity:0.5\" /><polygon points=\"347 157 341 156 338 159 341 167 336 167 328 155 324 151 321 159 324 162\n", | |
" 324 164 319 166 314 161 315 153 315 145 312 136 305 137 299 132 299 127\n", | |
" 301 117 311 115 313 121 328 119 340 124 353 134 354 141 363 163 360 165\n", | |
" 355 151 353 165 347 163 347 159\" style=\"fill:orchid; stroke:orchid; stroke-width:1; fill-opacity:0.5\" /><polygon points=\"234 180 230 180 228 183 229 185 222 190 219 183 218 186 216 185 217 179\n", | |
" 216 172 213 165 204 164 193 163 192 156 190 156 184 154 183 155 188 157\n", | |
" 191 157 186 160 179 157 181 149 187 149 194 149 204 143 215 142 221 144\n", | |
" 232 146 246 146 263 151 270 150 258 153 247 156\" style=\"fill:seagreen; stroke:seagreen; stroke-width:1; fill-opacity:0.5\" /><polygon points=\"439 122 440 115 441 106 444 100 450 100 456 101 466 103 479 108 488 114\n", | |
" 490 119 491 124 488 131 486 142 485 148 481 145 475 139 472 132 463 125\n", | |
" 454 122 447 122 442 122\" style=\"fill:orange; stroke:orange; stroke-width:1; fill-opacity:0.5\" /><polygon points=\" 40 136 43 132 46 112 47 107 53 101 66 101 70 103 79 110 84 116\n", | |
" 84 120 80 134 82 147 80 150 75 137 76 134 74 134 76 145 75 150\n", | |
" 71 148 69 141 65 132 63 134 65 145 59 145 57 127 56 119 50 119\n", | |
" 48 130 43 138 40 140 39 142 38 139\" style=\"fill:darkgreen; stroke:darkgreen; stroke-width:1; fill-opacity:0.5\" /><polygon points=\"245 145 245 138 247 132 250 126 258 125 267 125 281 126 290 127 299 135\n", | |
" 306 140 307 144 308 149 312 151 312 155 311 158 301 153 294 150 262 150\n", | |
" 252 148\" style=\"fill:gold; stroke:gold; stroke-width:1; fill-opacity:0.5\" /><polygon points=\"331 255 322 250 318 240 318 250 308 246 306 237 303 219 294 220 284 214\n", | |
" 279 212 271 212 270 204 273 199 293 192 302 190 309 191 318 196 333 195\n", | |
" 358 210 363 221 363 237 361 261 352 261 350 251 341 250 340 255 352 262\n", | |
" 356 264 356 265 343 264\" style=\"fill:salmon; stroke:salmon; stroke-width:1; fill-opacity:0.5\" /><polygon points=\"376 238 378 228 382 216 383 210 385 207 386 207 387 201 389 197 396 196\n", | |
" 404 198 416 190 434 189 458 190 468 196 473 205 473 210 460 225 447 238\n", | |
" 437 239 420 233 413 246 406 245 408 232 409 224 407 221 405 221 402 226\n", | |
" 395 228 393 229 388 231 383 236 382 241\" style=\"fill:blue; stroke:blue; stroke-width:1; fill-opacity:0.5\" /><polygon points=\"486 239 477 244 468 245 464 244 458 250 451 249 445 243 448 238 476 206\n", | |
" 481 205 485 209 500 205 500 267 500 272 498 276 489 275 488 272 494 251\n", | |
" 495 244\" style=\"fill:purple; stroke:purple; stroke-width:1; fill-opacity:0.5\" /><polygon points=\"389 161 391 145 400 136 416 123 438 118 464 122 472 137 480 144 486 151\n", | |
" 483 150 475 142 470 153 469 164 461 162 458 158 458 164 453 163 447 155\n", | |
" 442 157 440 158 438 162 430 167 423 163 426 156 426 147 421 145 417 146\n", | |
" 408 146 401 151 398 156 398 159 398 164 397 164\" style=\"fill:limegreen; stroke:limegreen; stroke-width:1; fill-opacity:0.5\" /><polygon points=\"402 196 410 177 416 171 428 171 433 166 451 164 468 165 480 172 486 181\n", | |
" 487 188 493 207 486 193 486 208 481 204 474 211 468 196 460 190 446 190\n", | |
" 428 188 412 193\" style=\"fill:red; stroke:red; stroke-width:1; fill-opacity:0.5\" /><polygon points=\"480 166 481 161 482 158 483 156 485 151 486 147 486 143 486 139 487 135\n", | |
" 487 132 489 127 489 125 493 120 495 120 499 119 499 145 495 144 492 148\n", | |
" 491 152 489 160 486 163 486 164 484 167 482 167 481 167\" style=\"fill:green; stroke:green; stroke-width:1; fill-opacity:0.5\" /><rect x=\"79\" y=\"147\" width=\"1\" height=\"2\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"81\" y=\"134\" width=\"1\" height=\"3\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"81\" y=\"150\" width=\"1\" height=\"1\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"82\" y=\"131\" width=\"1\" height=\"12\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"82\" y=\"149\" width=\"1\" height=\"3\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"83\" y=\"131\" width=\"1\" height=\"21\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"84\" y=\"129\" width=\"1\" height=\"23\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"85\" y=\"129\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"86\" y=\"128\" width=\"1\" height=\"21\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"86\" y=\"161\" width=\"1\" height=\"4\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"87\" y=\"128\" width=\"1\" height=\"20\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"87\" y=\"160\" width=\"1\" height=\"6\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"88\" y=\"127\" width=\"1\" height=\"19\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"88\" y=\"159\" width=\"1\" height=\"8\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"89\" y=\"127\" width=\"1\" height=\"18\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"89\" y=\"159\" width=\"1\" height=\"9\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"90\" y=\"127\" width=\"1\" height=\"16\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"90\" y=\"158\" width=\"1\" height=\"10\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"91\" y=\"127\" width=\"1\" height=\"14\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"91\" y=\"158\" width=\"1\" height=\"10\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"92\" y=\"127\" width=\"1\" height=\"13\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"92\" y=\"157\" width=\"1\" height=\"11\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"93\" y=\"128\" width=\"1\" height=\"11\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"93\" y=\"156\" width=\"1\" height=\"12\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"94\" y=\"128\" width=\"1\" height=\"9\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"94\" y=\"155\" width=\"1\" height=\"13\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"95\" y=\"129\" width=\"1\" height=\"7\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"95\" y=\"155\" width=\"1\" height=\"13\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"96\" y=\"130\" width=\"1\" height=\"5\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"96\" y=\"154\" width=\"1\" height=\"14\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"97\" y=\"132\" width=\"1\" height=\"2\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"97\" y=\"153\" width=\"1\" height=\"15\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"98\" y=\"153\" width=\"1\" height=\"15\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"99\" y=\"153\" width=\"1\" height=\"15\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"100\" y=\"153\" width=\"1\" height=\"14\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"101\" y=\"153\" width=\"1\" height=\"14\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"102\" y=\"153\" width=\"1\" height=\"13\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"103\" y=\"153\" width=\"1\" height=\"12\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"104\" y=\"153\" width=\"1\" height=\"12\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"105\" y=\"153\" width=\"1\" height=\"11\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"106\" y=\"153\" width=\"1\" height=\"11\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"107\" y=\"153\" width=\"1\" height=\"10\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"108\" y=\"153\" width=\"1\" height=\"8\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"109\" y=\"154\" width=\"1\" height=\"5\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"140\" y=\"166\" width=\"1\" height=\"16\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"141\" y=\"166\" width=\"1\" height=\"17\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"142\" y=\"160\" width=\"1\" height=\"24\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"143\" y=\"158\" width=\"1\" height=\"27\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"144\" y=\"149\" width=\"1\" height=\"36\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"145\" y=\"146\" width=\"1\" height=\"39\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"146\" y=\"143\" width=\"1\" height=\"42\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"147\" y=\"141\" width=\"1\" height=\"44\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"148\" y=\"141\" width=\"1\" height=\"44\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"149\" y=\"140\" width=\"1\" height=\"44\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"150\" y=\"140\" width=\"1\" height=\"44\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"151\" y=\"139\" width=\"1\" height=\"44\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"152\" y=\"139\" width=\"1\" height=\"35\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"152\" y=\"175\" width=\"1\" height=\"6\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"153\" y=\"138\" width=\"1\" height=\"24\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"154\" y=\"138\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"155\" y=\"137\" width=\"1\" height=\"21\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"156\" y=\"137\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"157\" y=\"136\" width=\"1\" height=\"24\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"158\" y=\"136\" width=\"1\" height=\"24\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"159\" y=\"135\" width=\"1\" height=\"25\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"160\" y=\"135\" width=\"1\" height=\"25\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"161\" y=\"136\" width=\"1\" height=\"39\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"162\" y=\"136\" width=\"1\" height=\"40\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"163\" y=\"136\" width=\"1\" height=\"41\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"164\" y=\"136\" width=\"1\" height=\"42\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"165\" y=\"135\" width=\"1\" height=\"43\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"166\" y=\"135\" width=\"1\" height=\"43\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"167\" y=\"135\" width=\"1\" height=\"43\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"168\" y=\"134\" width=\"1\" height=\"44\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"169\" y=\"133\" width=\"1\" height=\"45\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"170\" y=\"132\" width=\"1\" height=\"45\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"171\" y=\"130\" width=\"1\" height=\"47\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"172\" y=\"130\" width=\"1\" height=\"46\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"173\" y=\"130\" width=\"1\" height=\"44\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"174\" y=\"130\" width=\"1\" height=\"40\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"175\" y=\"129\" width=\"1\" height=\"46\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"176\" y=\"129\" width=\"1\" height=\"47\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"177\" y=\"128\" width=\"1\" height=\"49\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"178\" y=\"128\" width=\"1\" height=\"50\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"179\" y=\"128\" width=\"1\" height=\"50\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"180\" y=\"128\" width=\"1\" height=\"29\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"180\" y=\"158\" width=\"1\" height=\"20\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"181\" y=\"128\" width=\"1\" height=\"25\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"181\" y=\"159\" width=\"1\" height=\"19\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"182\" y=\"128\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"182\" y=\"159\" width=\"1\" height=\"19\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"183\" y=\"128\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"183\" y=\"160\" width=\"1\" height=\"18\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"184\" y=\"128\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"184\" y=\"160\" width=\"1\" height=\"17\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"185\" y=\"128\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"185\" y=\"161\" width=\"1\" height=\"16\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"186\" y=\"128\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"186\" y=\"162\" width=\"1\" height=\"14\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"187\" y=\"128\" width=\"1\" height=\"21\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"187\" y=\"164\" width=\"1\" height=\"10\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"188\" y=\"127\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"189\" y=\"127\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"190\" y=\"127\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"191\" y=\"127\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"192\" y=\"127\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"193\" y=\"127\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"194\" y=\"127\" width=\"1\" height=\"22\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"195\" y=\"128\" width=\"1\" height=\"20\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"196\" y=\"127\" width=\"1\" height=\"21\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"197\" y=\"127\" width=\"1\" height=\"21\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"198\" y=\"127\" width=\"1\" height=\"21\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"199\" y=\"127\" width=\"1\" height=\"20\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"200\" y=\"127\" width=\"1\" height=\"19\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"201\" y=\"127\" width=\"1\" height=\"19\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"202\" y=\"127\" width=\"1\" height=\"18\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"203\" y=\"127\" width=\"1\" height=\"18\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"204\" y=\"127\" width=\"1\" height=\"17\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"205\" y=\"127\" width=\"1\" height=\"17\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"206\" y=\"127\" width=\"1\" height=\"17\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"207\" y=\"128\" width=\"1\" height=\"16\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"208\" y=\"128\" width=\"1\" height=\"16\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"209\" y=\"129\" width=\"1\" height=\"15\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"210\" y=\"129\" width=\"1\" height=\"15\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"211\" y=\"130\" width=\"1\" height=\"14\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"212\" y=\"131\" width=\"1\" height=\"13\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"213\" y=\"131\" width=\"1\" height=\"13\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"214\" y=\"131\" width=\"1\" height=\"13\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"215\" y=\"132\" width=\"1\" height=\"11\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"216\" y=\"132\" width=\"1\" height=\"12\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"217\" y=\"133\" width=\"1\" height=\"11\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"218\" y=\"134\" width=\"1\" height=\"10\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><rect x=\"219\" y=\"136\" width=\"1\" height=\"8\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0.5; stroke-opacity:0.5\" /><polygon points=\"222 149 322 149 322 196 222 196 222 149\" style=\"fill:pink; stroke:pink; stroke-width:1; fill-opacity:0\" /><polygon points=\" 72 121 170 121 170 178 72 178 72 121\" style=\"fill:slateblue; stroke:slateblue; stroke-width:1; fill-opacity:0\" /><polygon points=\"299 115 363 115 363 167 299 167 299 115\" style=\"fill:orchid; stroke:orchid; stroke-width:1; fill-opacity:0\" /><polygon points=\"179 142 270 142 270 190 179 190 179 142\" style=\"fill:seagreen; stroke:seagreen; stroke-width:1; fill-opacity:0\" /><polygon points=\"439 100 491 100 491 148 439 148 439 100\" style=\"fill:orange; stroke:orange; stroke-width:1; fill-opacity:0\" /><polygon points=\" 38 101 84 101 84 150 38 150 38 101\" style=\"fill:darkgreen; stroke:darkgreen; stroke-width:1; fill-opacity:0\" /><polygon points=\"245 125 312 125 312 158 245 158 245 125\" style=\"fill:gold; stroke:gold; stroke-width:1; fill-opacity:0\" /><polygon points=\"270 190 363 190 363 265 270 265 270 190\" style=\"fill:salmon; stroke:salmon; stroke-width:1; fill-opacity:0\" /><polygon points=\"376 189 473 189 473 246 376 246 376 189\" style=\"fill:blue; stroke:blue; stroke-width:1; fill-opacity:0\" /><polygon points=\"445 205 500 205 500 276 445 276 445 205\" style=\"fill:purple; stroke:purple; stroke-width:1; fill-opacity:0\" /><polygon points=\"389 118 486 118 486 167 389 167 389 118\" style=\"fill:limegreen; stroke:limegreen; stroke-width:1; fill-opacity:0\" /><polygon points=\"402 164 493 164 493 211 402 211 402 164\" style=\"fill:red; stroke:red; stroke-width:1; fill-opacity:0\" /><polygon points=\" 79 127 219 127 219 184 79 184 79 127\" style=\"fill:olive; stroke:olive; stroke-width:1; fill-opacity:0\" /><polygon points=\"480 119 499 119 499 167 480 167 480 119\" style=\"fill:green; stroke:green; stroke-width:1; fill-opacity:0\" /></svg></div></div><style>.svgclass { position:absolute; top:0px; left:0px;}</style>" | |
], | |
"text/plain": [ | |
"<IPython.core.display.HTML object>" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"html = coco_dataset.display_image(245915, use_url=True)\n", | |
"IPython.display.HTML(html)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Sample Annotations JSON\n", | |
"Below are the contents of 'sample_annotations.json'." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"{\n", | |
"\n", | |
" \"info\": {\n", | |
"\n", | |
" \"description\": \"COCO 2017 Dataset\",\"url\": \"http://cocodataset.org\",\"version\": \"1.0\",\"year\": 2017,\"contributor\": \"COCO Consortium\",\"date_created\": \"2017/09/01\"\n", | |
"\n", | |
" },\n", | |
"\n", | |
" \"licenses\": [\n", | |
"\n", | |
" {\"url\": \"http://creativecommons.org/licenses/by/2.0/\",\"id\": 4,\"name\": \"Attribution License\"}\n", | |
"\n", | |
" ],\n", | |
"\n", | |
" \"images\": [\n", | |
"\n", | |
" {\"id\": 242287, \"license\": 4, \"coco_url\": \"http://images.cocodataset.org/val2017/000000242287.jpg\", \"flickr_url\": \"http://farm3.staticflickr.com/2626/4072194513_edb6acfb2b_z.jpg\", \"width\": 426, \"height\": 640, \"file_name\": \"000000242287.jpg\", \"date_captured\": \"2013-11-15 02:41:42\"},\n", | |
"\n", | |
" {\"id\": 245915, \"license\": 4, \"coco_url\": \"http://images.cocodataset.org/val2017/000000245915.jpg\", \"flickr_url\": \"http://farm1.staticflickr.com/88/211747310_f58a16631e_z.jpg\", \"width\": 500, \"height\": 333, \"file_name\": \"000000245915.jpg\", \"date_captured\": \"2013-11-18 02:53:27\"}\n", | |
"\n", | |
" ],\n", | |
"\n", | |
" \"annotations\": [\n", | |
"\n", | |
" {\"id\": 125686, \"category_id\": 2, \"iscrowd\": 0, \"segmentation\": [[164.81, 417.51, 164.81, 417.51, 164.81, 417.51, 159.31, 409.27, 159.31, 409.27, 155.19, 409.27, 155.19, 410.64, 152.45, 413.39, 144.21, 413.39, 140.09, 413.39, 137.34, 413.39, 134.59, 414.76, 129.1, 414.76, 122.23, 414.76, 104.38, 405.15, 104.38, 405.15, 93.39, 401.03, 93.39, 401.03, 87.9, 399.66, 86.52, 399.66, 85.15, 399.66, 93.39, 391.42, 78.28, 383.18, 72.79, 383.18, 68.67, 401.03, 82.4, 402.4, 104.38, 409.27, 104.38, 421.63, 85.15, 458.71, 79.66, 469.7, 65.92, 454.59, 61.8, 455.97, 59.06, 455.97, 42.58, 471.07, 39.83, 479.31, 39.83, 482.06, 31.59, 497.17, 19.23, 510.9, 19.23, 519.14, 19.23, 539.74, 20.6, 578.2, 26.09, 590.56, 27.47, 593.3, 38.45, 596.05, 41.2, 593.3, 50.82, 589.18, 53.56, 587.81, 59.06, 585.06, 71.42, 579.57, 79.66, 568.58, 82.4, 560.34, 85.15, 535.62, 87.9, 520.52, 90.64, 513.65, 93.39, 490.3, 93.39, 487.55, 93.39, 480.69, 108.5, 499.91, 108.5, 509.53, 115.36, 521.89, 104.38, 521.89, 103.0, 528.76, 108.5, 534.25, 119.48, 530.13, 124.98, 535.62, 126.35, 535.62, 129.1, 543.86, 166.18, 582.32, 171.67, 578.2, 197.77, 598.8, 208.76, 608.41, 249.96, 627.64, 269.18, 623.52, 278.8, 618.03, 281.55, 609.79, 285.67, 601.55, 287.04, 597.42, 291.16, 591.93, 291.16, 590.56, 318.63, 590.56, 318.63, 591.93, 329.61, 589.18, 332.36, 586.44, 333.73, 583.69, 309.01, 563.09, 313.13, 547.98, 313.13, 541.12, 313.13, 526.01, 313.13, 523.26, 313.13, 516.39, 313.13, 501.29, 307.64, 486.18, 307.64, 486.18, 302.15, 483.43, 291.16, 472.45, 278.8, 454.59, 273.3, 454.59, 262.32, 447.73, 241.72, 438.11, 226.61, 425.75, 226.61, 420.26, 210.13, 413.39, 206.01, 413.39, 197.77, 414.76, 167.55, 410.64]], \"image_id\": 242287, \"area\": 42061.80340000001, \"bbox\": [19.23, 383.18, 314.5, 244.46]},\n", | |
"\n", | |
" {\"id\": 1409619, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[376.81, 238.8, 378.19, 228.91, 382.15, 216.06, 383.14, 210.72, 385.9, 207.56, 386.7, 207.16, 387.29, 201.43, 389.27, 197.67, 396.58, 196.09, 404.49, 198.07, 416.16, 190.95, 434.75, 189.76, 458.48, 190.95, 468.96, 196.88, 473.51, 205.58, 473.31, 210.52, 460.65, 225.36, 447.6, 238.41, 437.91, 239.59, 420.91, 233.07, 413.98, 246.71, 406.27, 245.92, 408.45, 232.87, 409.24, 224.17, 407.66, 221.6, 405.28, 221.6, 402.91, 226.54, 395.99, 228.12, 393.02, 229.11, 388.28, 231.88, 383.93, 236.82, 382.74, 241.17]], \"image_id\": 245915, \"area\": 3556.2197000000015, \"bbox\": [376.81, 189.76, 96.7, 56.95]},\n", | |
"\n", | |
" {\"id\": 1410165, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[486.34, 239.01, 477.88, 244.78, 468.26, 245.16, 464.41, 244.78, 458.64, 250.16, 451.72, 249.39, 445.56, 243.62, 448.26, 238.62, 476.72, 206.69, 481.34, 205.54, 485.57, 209.0, 500.0, 205.16, 500.0, 267.47, 500.0, 272.86, 498.26, 276.71, 489.03, 275.94, 488.65, 272.47, 494.8, 251.32, 495.95, 244.39]], \"image_id\": 245915, \"area\": 1775.8932499999994, \"bbox\": [445.56, 205.16, 54.44, 71.55]},\n", | |
"\n", | |
" {\"id\": 1410330, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[402.59, 196.81, 410.82, 177.35, 416.81, 171.36, 428.78, 171.36, 433.27, 166.87, 451.98, 164.63, 468.44, 165.38, 480.42, 172.11, 486.4, 181.84, 487.15, 188.58, 493.14, 207.28, 486.4, 193.81, 486.4, 208.78, 481.91, 204.29, 474.43, 211.02, 468.44, 196.06, 460.96, 190.82, 446.0, 190.82, 428.04, 188.58, 412.32, 193.81]], \"image_id\": 245915, \"area\": 2049.9325499999995, \"bbox\": [402.59, 164.63, 90.55, 46.39]},\n", | |
"\n", | |
" {\"id\": 1410622, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[480.86, 166.6, 481.62, 161.78, 482.63, 158.99, 483.9, 156.2, 485.42, 151.63, 486.19, 147.32, 486.69, 143.0, 486.95, 139.7, 487.45, 135.13, 487.96, 132.6, 489.23, 127.52, 489.74, 125.74, 493.04, 120.92, 495.83, 120.16, 499.89, 119.91, 499.89, 145.03, 495.07, 144.27, 492.78, 148.33, 491.01, 152.65, 489.23, 160.77, 486.69, 163.56, 486.19, 164.57, 484.92, 167.11, 482.63, 167.87, 481.11, 167.87]], \"image_id\": 245915, \"area\": 419.9524499999999, \"bbox\": [480.86, 119.91, 19.03, 47.96]},\n", | |
"\n", | |
" {\"id\": 1410759, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[439.19, 122.67, 440.27, 115.81, 441.34, 106.38, 444.98, 100.16, 450.56, 100.38, 456.99, 101.23, 466.85, 103.59, 479.72, 108.09, 488.72, 114.53, 490.65, 119.67, 491.08, 124.82, 488.72, 131.25, 486.15, 142.4, 485.72, 148.19, 481.65, 145.4, 475.21, 139.4, 472.21, 132.97, 463.64, 125.25, 454.42, 122.46, 447.98, 122.03, 442.41, 122.25]], \"image_id\": 245915, \"area\": 1266.1428000000008, \"bbox\": [439.19, 100.16, 51.89, 48.03]},\n", | |
"\n", | |
" {\"id\": 1410834, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[331.42, 255.49, 322.64, 250.05, 318.04, 240.02, 318.46, 250.47, 308.01, 246.71, 306.33, 237.93, 303.82, 219.96, 294.63, 220.79, 284.18, 214.94, 279.16, 212.85, 271.22, 212.01, 270.8, 204.07, 273.73, 199.05, 293.37, 192.78, 302.99, 190.69, 309.26, 191.95, 318.04, 196.13, 333.09, 195.71, 358.59, 210.76, 363.19, 221.63, 363.6, 237.93, 361.93, 261.34, 352.32, 261.76, 350.23, 251.31, 341.87, 250.05, 340.19, 255.49, 352.32, 262.18, 356.08, 264.27, 356.08, 265.94, 343.96, 264.69]], \"image_id\": 245915, \"area\": 3901.5125, \"bbox\": [270.8, 190.69, 92.8, 75.25]},\n", | |
"\n", | |
" {\"id\": 1410880, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[222.29, 191.74, 233.36, 181.64, 241.18, 167.63, 248.35, 154.93, 257.47, 153.95, 281.57, 149.39, 294.27, 149.39, 300.79, 152.98, 312.84, 160.14, 317.4, 168.29, 318.38, 172.52, 321.96, 178.38, 322.29, 182.62, 321.63, 184.25, 317.07, 188.16, 317.4, 195.97, 306.0, 189.78, 301.11, 188.81, 294.27, 188.81, 281.57, 186.53, 283.2, 195.65, 277.01, 195.65, 274.73, 189.78, 269.19, 195.65, 263.33, 196.62, 263.66, 185.88, 257.47, 195.32, 249.32, 184.25, 244.44, 183.92, 233.69, 189.13, 229.13, 192.39]], \"image_id\": 245915, \"area\": 2987.1327, \"bbox\": [222.29, 149.39, 100.0, 47.23]},\n", | |
"\n", | |
" {\"id\": 1411090, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[245.09, 145.01, 245.09, 138.15, 247.12, 132.57, 250.93, 126.73, 258.29, 125.21, 267.68, 125.97, 281.64, 126.23, 290.78, 127.75, 299.91, 135.62, 306.0, 140.95, 307.27, 144.25, 308.79, 149.32, 312.35, 151.86, 312.35, 155.67, 311.84, 158.97, 301.43, 153.64, 294.58, 150.08, 262.86, 150.84, 252.71, 148.05]], \"image_id\": 245915, \"area\": 1372.6493000000003, \"bbox\": [245.09, 125.21, 67.26, 33.76]},\n", | |
"\n", | |
" {\"id\": 1411108, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[347.3, 157.93, 341.38, 156.45, 338.91, 159.9, 341.38, 167.31, 336.94, 167.8, 328.54, 155.95, 324.59, 151.02, 321.14, 159.9, 324.1, 162.86, 324.59, 164.84, 319.66, 166.81, 314.72, 161.88, 315.71, 153.98, 315.71, 145.58, 312.25, 136.2, 305.34, 137.69, 299.91, 132.75, 299.42, 127.32, 301.88, 117.44, 311.26, 115.47, 313.73, 121.39, 328.05, 119.42, 340.39, 124.85, 353.72, 134.72, 354.22, 141.14, 363.1, 163.85, 360.63, 165.33, 355.2, 151.02, 353.72, 165.33, 347.8, 163.85, 347.3, 159.41]], \"image_id\": 245915, \"area\": 1794.529700000001, \"bbox\": [299.42, 115.47, 63.68, 52.33]},\n", | |
"\n", | |
" {\"id\": 1411138, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[72.59, 177.35, 73.33, 169.12, 77.08, 160.89, 80.07, 156.4, 85.31, 149.66, 88.3, 145.17, 92.04, 139.19, 96.53, 133.95, 100.27, 127.96, 104.02, 125.72, 109.25, 124.97, 118.98, 124.22, 130.21, 122.72, 136.19, 122.72, 149.66, 121.98, 161.64, 123.47, 169.87, 127.21, 170.62, 130.96, 167.62, 133.95, 163.13, 135.44, 158.64, 134.7, 146.67, 140.68, 143.68, 148.91, 143.68, 155.65, 141.43, 160.14, 141.43, 164.63, 141.43, 165.38, 136.19, 165.38, 133.2, 163.13, 131.7, 169.87, 132.45, 176.6, 132.45, 178.1, 132.45, 178.85, 127.96, 178.85, 122.72, 165.38, 122.72, 163.88, 120.48, 168.37, 116.74, 173.61, 114.49, 178.1, 110.75, 177.35, 110.75, 171.36, 115.99, 161.64, 115.99, 153.4, 114.49, 151.16, 111.5, 149.66, 109.25, 151.91, 102.52, 152.66, 98.78, 152.66, 96.53, 151.16, 91.29, 157.15, 83.06, 161.64, 77.82, 167.62, 76.33, 170.62, 75.58, 173.61, 77.08, 176.6, 75.58, 177.35]], \"image_id\": 245915, \"area\": 2469.0984000000003, \"bbox\": [72.59, 121.98, 98.03, 56.87]},\n", | |
"\n", | |
" {\"id\": 1411160, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[389.47, 161.42, 391.37, 145.58, 400.25, 136.08, 416.09, 123.41, 438.26, 118.34, 464.88, 122.14, 472.48, 137.35, 480.08, 144.95, 486.42, 151.92, 483.25, 150.65, 475.01, 142.41, 470.58, 153.82, 469.94, 164.59, 461.71, 162.69, 458.54, 158.26, 458.54, 164.59, 453.47, 163.96, 447.77, 155.72, 442.06, 157.62, 440.8, 158.89, 438.9, 162.69, 430.03, 167.13, 423.69, 163.32, 426.86, 156.99, 426.22, 147.48, 421.15, 145.58, 417.35, 146.22, 408.48, 146.85, 401.51, 151.29, 398.98, 156.35, 398.98, 159.52, 398.34, 164.59, 397.08, 164.59]], \"image_id\": 245915, \"area\": 2642.9447999999984, \"bbox\": [389.47, 118.34, 96.95, 48.79]},\n", | |
"\n", | |
" {\"id\": 1411174, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[234.05, 180.69, 230.62, 180.38, 228.13, 183.18, 229.07, 185.37, 222.83, 190.04, 219.4, 183.18, 218.78, 186.61, 216.28, 185.37, 217.53, 179.13, 216.91, 172.9, 213.17, 165.41, 204.44, 164.17, 193.53, 163.54, 192.28, 156.06, 190.72, 156.06, 184.48, 154.19, 183.55, 155.75, 188.23, 157.31, 191.65, 157.93, 186.98, 160.42, 179.81, 157.93, 181.68, 149.83, 187.6, 149.2, 194.46, 149.2, 204.12, 143.59, 215.04, 142.97, 221.27, 144.21, 232.49, 146.71, 246.84, 146.08, 263.98, 151.7, 270.53, 150.45, 258.68, 153.88, 247.46, 156.06]], \"image_id\": 245915, \"area\": 1653.885, \"bbox\": [179.81, 142.97, 90.72, 47.07]},\n", | |
"\n", | |
" {\"id\": 2210312, \"category_id\": 22, \"iscrowd\": 0, \"segmentation\": [[40.18, 136.53, 43.72, 132.05, 46.31, 112.74, 47.01, 107.08, 53.14, 101.43, 66.09, 101.67, 70.33, 103.32, 79.52, 110.85, 84.23, 116.51, 84.23, 120.98, 80.7, 134.47, 82.82, 147.43, 80.23, 150.26, 75.75, 137.07, 76.93, 134.0, 74.34, 134.71, 76.69, 145.54, 75.51, 150.26, 71.04, 148.61, 69.16, 141.07, 65.15, 132.83, 63.74, 134.47, 65.86, 145.07, 59.5, 145.54, 57.61, 127.41, 56.91, 119.4, 50.78, 119.87, 48.19, 130.23, 43.72, 138.01, 40.89, 140.36, 39.48, 142.72, 38.77, 139.66]], \"image_id\": 245915, \"area\": 1242.647, \"bbox\": [38.77, 101.43, 45.46, 48.83]},\n", | |
"\n", | |
" {\"id\": 902200245915, \"category_id\": 22, \"iscrowd\": 1, \"segmentation\": {\"size\": [333, 500], \"counts\": [26454, 2, 651, 3, 13, 1, 313, 12, 6, 3, 312, 21, 310, 23, 310, 22, 310, 21, 12, 4, 296, 20, 12, 6, 294, 19, 13, 8, 293, 18, 14, 9, 292, 16, 15, 10, 292, 14, 17, 10, 292, 13, 17, 11, 293, 11, 17, 12, 293, 9, 18, 13, 294, 7, 19, 13, 295, 5, 19, 14, 297, 2, 19, 15, 318, 15, 318, 15, 318, 14, 319, 14, 319, 13, 320, 12, 321, 12, 321, 11, 322, 11, 322, 10, 323, 8, 326, 5, 10330, 16, 317, 17, 310, 24, 307, 27, 297, 36, 294, 39, 291, 42, 289, 44, 289, 44, 288, 44, 289, 44, 288, 44, 289, 35, 1, 6, 290, 24, 309, 22, 310, 21, 312, 22, 310, 24, 309, 24, 308, 25, 308, 25, 309, 39, 294, 40, 293, 41, 292, 42, 290, 43, 290, 43, 290, 43, 289, 44, 288, 45, 287, 45, 286, 47, 286, 46, 287, 44, 289, 40, 292, 46, 287, 47, 285, 49, 284, 50, 283, 50, 283, 29, 1, 20, 283, 25, 6, 19, 283, 22, 9, 19, 283, 22, 10, 18, 283, 22, 10, 17, 284, 22, 11, 16, 284, 22, 12, 14, 285, 21, 15, 10, 286, 22, 311, 22, 311, 22, 311, 22, 311, 22, 311, 22, 311, 22, 312, 20, 312, 21, 312, 21, 312, 21, 312, 20, 313, 19, 314, 19, 314, 18, 315, 18, 315, 17, 316, 17, 316, 17, 317, 16, 317, 16, 318, 15, 318, 15, 319, 14, 320, 13, 320, 13, 320, 13, 321, 11, 322, 12, 322, 11, 323, 10, 325, 8, 93429]}, \"image_id\": 245915, \"area\": 3188, \"bbox\": [79, 127, 140, 57]}\n", | |
"\n", | |
" ],\n", | |
"\n", | |
" \"categories\": [\n", | |
"\n", | |
" {\"supercategory\": \"vehicle\",\"id\": 2,\"name\": \"bicycle\"},\n", | |
"\n", | |
" {\"supercategory\": \"animal\",\"id\": 22,\"name\": \"elephant\"}\n", | |
"\n", | |
" ]\n", | |
"\n", | |
"}\n" | |
] | |
} | |
], | |
"source": [ | |
"with open(annotation_path) as json_file:\n", | |
" lines = json_file.readlines()\n", | |
"for line in lines:\n", | |
" print(line)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.5.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Thanks for sharing this fix! I’ll take a look when I get a chance.
@madhavajay, I updated the gist with your suggested fix. Thanks again for the fix!
Hi @akTwelve, upon visualizing my own custom dataset I noticed that the masks of some instances did not get displayed while those of some did. This was due to segmentation_points
being a numpy
array, so sometimes the array when stringified looked like this '241, 5, 242, ..., 244, 5, 245]'
. It can be avoided by adding:
segmentation_points = list (segmentation_points)
after the following line of the function display_image
in the notebook.
segmentation_points = np.multiply(segmentation_points, adjusted_ratio).astype(int)
.
Thanks for sharing!
I quickly added the option to visualize keypoints
. I simply added the parameter in the display_image
function:
def display_image(self, image_id, show_polys=True, show_bbox=True, show_crowds=True, show_keypoints=True, use_url=False):
and in the function body below the if show_bbox
block I added:
if show_keypoints:
for i, segm in enumerate(self.segmentations[image_id]):
keypoints = segm.get('keypoints', None)
if not keypoints is None:
for k in range(0, segm.get('num_keypoints', 0)):
x = keypoints[k * 3 + 0]
y = keypoints[k * 3 + 1]
visibility = keypoints[k * 3 + 2]
html += '<circle cx="{}" cy="{}" r="3" fill="{}" />'.format(x, y, "red")
this will draw all keypoints using red svg circles, regardless of their visibility.
Thank you for sharing!
For photos with non-landscape orientation I had to add this to your code: https://stackoverflow.com/a/63798032/1616037
Hi @akTwelve awesome notebook.
I noticed the local file branch of this doesn't work.
Here is the fix: