{"action":"created","comment":{"url":"https://api.github.com/repos/chainer/chainercv/pulls/comments/200815505","pull_request_review_id":135207723,"id":200815505,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDgxNTUwNQ==","diff_hunk":"@@ -0,0 +1,183 @@\n+from collections import defaultdict\n+import json\n+import numpy as np\n+import os\n+import PIL.Image\n+import PIL.ImageDraw\n+\n+from chainercv.chainer_experimental.datasets.sliceable import GetterDataset\n+from chainercv.datasets.coco.coco_utils import get_coco\n+from chainercv import utils\n+\n+\n+try:\n+    from pycocotools import mask as coco_mask\n+    _availabel = True\n+except ImportError:\n+    _availabel = False\n+\n+\n+class COCOInstanceSegmentationDataset(GetterDataset):\n+\n+    \"\"\"Instance segmentation dataset for `MS COCO2014`_.\n+\n+    .. _`MS COCO2014`: http://mscoco.org/dataset/#detections-challenge2015\n+\n+    When queried by an index, if :obj:`return_crowded == False`,\n+    this dataset returns a corresponding\n+    :obj:`img, bbox, mask, label, crowded, area`, a tuple of an image, bounding\n+    boxes, masks, labels, crowdness indicators and areas of masks.\n+    The parameters :obj:`return_crowded` and :obj:`return_area` decide\n+    whether to return :obj:`crowded` and :obj:`area`.\n+    :obj:`crowded` is a boolean array\n+    that indicates whether bounding boxes are for crowd labeling.\n+    When there are more than ten objects from the same category,\n+    bounding boxes correspond to crowd of instances instead of individual\n+    instances. Please see more detail in the Fig. 12 (e) of the summary\n+    paper [#]_.\n+\n+    There are total of 82,783 training and 40,504 validation images.\n+    'minval' split is a subset of validation images that constitutes\n+    5000 images in the validation images. The remaining validation\n+    images are called 'minvalminus'. Concrete list of image ids and\n+    annotations for these splits are found `here`_.\n+\n+    .. _`here`: https://github.com/rbgirshick/py-faster-rcnn/tree/master/data\n+\n+    .. [#] Tsung-Yi Lin, Michael Maire, Serge Belongie, Lubomir Bourdev, \\\n+        Ross Girshick, James Hays, Pietro Perona, Deva Ramanan, \\\n+        C. Lawrence Zitnick, Piotr Dollar.\n+        `Microsoft COCO: Common Objects in Context \\\n+        <https://arxiv.org/abs/1405.0312>`_. arXiv 2014.\n+\n+    Args:\n+        data_dir (string): Path to the root of the training data. If this is\n+            :obj:`auto`, this class will automatically download data for you\n+            under :obj:`$CHAINER_DATASET_ROOT/pfnet/chainercv/coco`.\n+        split ({'train', 'val', 'minival', 'valminusminival'}): Select\n+            a split of the dataset.\n+        use_crowded (bool): If true, use bounding boxes that are labeled as\n+            crowded in the original annotation.\n+        return_crowded (bool): If true, this dataset returns a boolean array\n+            that indicates whether bounding boxes are labeled as crowded\n+            or not. The default value is :obj:`False`.\n+        return_area (bool): If true, this dataset returns areas of masks\n+            around objects.\n+\n+    \"\"\"\n+\n+    def __init__(\n+            self, data_dir='auto', split='train',\n+            use_crowded=False, return_crowded=False,\n+            return_area=False\n+    ):\n+        if not _availabel:\n+            raise ValueError(\n+                'Please install pycocotools \\n'\n+                'pip install -e \\'git+https://github.com/pdollar/coco.git'\n+                '#egg=pycocotools&subdirectory=PythonAPI\\'')\n+\n+        super(COCOInstanceSegmentationDataset, self).__init__()\n+        self.use_crowded = use_crowded\n+\n+        if split in ['val', 'minival', 'valminusminival']:\n+            img_split = 'val'\n+        else:\n+            img_split = 'train'\n+        if data_dir == 'auto':\n+            data_dir = get_coco(split, img_split)\n+\n+        self.img_root = os.path.join(\n+            data_dir, 'images', '{}2014'.format(img_split))\n+        anno_path = os.path.join(\n+            data_dir, 'annotations', 'instances_{}2014.json'.format(split))\n+\n+        self.data_dir = data_dir\n+        annos = json.load(open(anno_path, 'r'))\n+\n+        self.id_to_prop = {}\n+        for prop in annos['images']:\n+            self.id_to_prop[prop['id']] = prop\n+        self.ids = sorted(list(self.id_to_prop.keys()))\n+\n+        self.cat_ids = [cat['id'] for cat in annos['categories']]\n+\n+        self.id_to_anno = defaultdict(list)\n+        for anno in annos['annotations']:\n+            self.id_to_anno[anno['image_id']].append(anno)\n+\n+        self.add_getter('img', self._get_image)\n+        self.add_getter(['mask', 'label', 'area', 'crowded'],\n+                        self._get_annotations)","path":"chainercv/datasets/coco/coco_instance_segmentation_dataset.py","position":null,"original_position":111,"commit_id":"f9c6dcd92cce8529747a7dda4766d9102d0e3dff","original_commit_id":"8a25804af412c2b64d3396281f20aeb0061a5a2d","user":{"login":"Hakuyume","id":3014172,"node_id":"MDQ6VXNlcjMwMTQxNzI=","avatar_url":"https://avatars3.githubusercontent.com/u/3014172?v=4","gravatar_id":"","url":"https://api.github.com/users/Hakuyume","html_url":"https://github.com/Hakuyume","followers_url":"https://api.github.com/users/Hakuyume/followers","following_url":"https://api.github.com/users/Hakuyume/following{/other_user}","gists_url":"https://api.github.com/users/Hakuyume/gists{/gist_id}","starred_url":"https://api.github.com/users/Hakuyume/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hakuyume/subscriptions","organizations_url":"https://api.github.com/users/Hakuyume/orgs","repos_url":"https://api.github.com/users/Hakuyume/repos","events_url":"https://api.github.com/users/Hakuyume/events{/privacy}","received_events_url":"https://api.github.com/users/Hakuyume/received_events","type":"User","site_admin":false},"body":"> So, in _get_mask, crowded is loaded, but not returned?\r\n\r\nYes, if use_crowded=False, `_get_mask` calls `_get_label_area_crowded` internally to get `crowded`. If use_crowded=True, `_get_mask` doesn't need to call `_get_label_area_crowded`.","created_at":"2018-07-07T15:43:14Z","updated_at":"2018-07-07T15:43:14Z","html_url":"https://github.com/chainer/chainercv/pull/665#discussion_r200815505","pull_request_url":"https://api.github.com/repos/chainer/chainercv/pulls/665","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/chainer/chainercv/pulls/comments/200815505"},"html":{"href":"https://github.com/chainer/chainercv/pull/665#discussion_r200815505"},"pull_request":{"href":"https://api.github.com/repos/chainer/chainercv/pulls/665"}},"in_reply_to_id":200054123},"pull_request":{"url":"https://api.github.com/repos/chainer/chainercv/pulls/665","id":199012928,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5MDEyOTI4","html_url":"https://github.com/chainer/chainercv/pull/665","diff_url":"https://github.com/chainer/chainercv/pull/665.diff","patch_url":"https://github.com/chainer/chainercv/pull/665.patch","issue_url":"https://api.github.com/repos/chainer/chainercv/issues/665","number":665,"state":"open","locked":false,"title":"Add COCO Instance segmentation dataset","user":{"login":"knorth55","id":9300063,"node_id":"MDQ6VXNlcjkzMDAwNjM=","avatar_url":"https://avatars0.githubusercontent.com/u/9300063?v=4","gravatar_id":"","url":"https://api.github.com/users/knorth55","html_url":"https://github.com/knorth55","followers_url":"https://api.github.com/users/knorth55/followers","following_url":"https://api.github.com/users/knorth55/following{/other_user}","gists_url":"https://api.github.com/users/knorth55/gists{/gist_id}","starred_url":"https://api.github.com/users/knorth55/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knorth55/subscriptions","organizations_url":"https://api.github.com/users/knorth55/orgs","repos_url":"https://api.github.com/users/knorth55/repos","events_url":"https://api.github.com/users/knorth55/events{/privacy}","received_events_url":"https://api.github.com/users/knorth55/received_events","type":"User","site_admin":false},"body":"Move from #547 ","created_at":"2018-07-03T16:04:29Z","updated_at":"2018-07-07T15:43:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ea5dbfa3aa6782beeb20703781590e1585b278a","assignee":null,"assignees":[],"requested_reviewers":[{"login":"yuyu2172","id":2062128,"node_id":"MDQ6VXNlcjIwNjIxMjg=","avatar_url":"https://avatars3.githubusercontent.com/u/2062128?v=4","gravatar_id":"","url":"https://api.github.com/users/yuyu2172","html_url":"https://github.com/yuyu2172","followers_url":"https://api.github.com/users/yuyu2172/followers","following_url":"https://api.github.com/users/yuyu2172/following{/other_user}","gists_url":"https://api.github.com/users/yuyu2172/gists{/gist_id}","starred_url":"https://api.github.com/users/yuyu2172/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yuyu2172/subscriptions","organizations_url":"https://api.github.com/users/yuyu2172/orgs","repos_url":"https://api.github.com/users/yuyu2172/repos","events_url":"https://api.github.com/users/yuyu2172/events{/privacy}","received_events_url":"https://api.github.com/users/yuyu2172/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":623242512,"node_id":"MDU6TGFiZWw2MjMyNDI1MTI=","url":"https://api.github.com/repos/chainer/chainercv/labels/feature","name":"feature","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/chainer/chainercv/pulls/665/commits","review_comments_url":"https://api.github.com/repos/chainer/chainercv/pulls/665/comments","review_comment_url":"https://api.github.com/repos/chainer/chainercv/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chainer/chainercv/issues/665/comments","statuses_url":"https://api.github.com/repos/chainer/chainercv/statuses/f9c6dcd92cce8529747a7dda4766d9102d0e3dff","head":{"label":"knorth55:coco-instance-segmentation-dataset","ref":"coco-instance-segmentation-dataset","sha":"f9c6dcd92cce8529747a7dda4766d9102d0e3dff","user":{"login":"knorth55","id":9300063,"node_id":"MDQ6VXNlcjkzMDAwNjM=","avatar_url":"https://avatars0.githubusercontent.com/u/9300063?v=4","gravatar_id":"","url":"https://api.github.com/users/knorth55","html_url":"https://github.com/knorth55","followers_url":"https://api.github.com/users/knorth55/followers","following_url":"https://api.github.com/users/knorth55/following{/other_user}","gists_url":"https://api.github.com/users/knorth55/gists{/gist_id}","starred_url":"https://api.github.com/users/knorth55/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knorth55/subscriptions","organizations_url":"https://api.github.com/users/knorth55/orgs","repos_url":"https://api.github.com/users/knorth55/repos","events_url":"https://api.github.com/users/knorth55/events{/privacy}","received_events_url":"https://api.github.com/users/knorth55/received_events","type":"User","site_admin":false},"repo":{"id":96465368,"node_id":"MDEwOlJlcG9zaXRvcnk5NjQ2NTM2OA==","name":"chainercv","full_name":"knorth55/chainercv","owner":{"login":"knorth55","id":9300063,"node_id":"MDQ6VXNlcjkzMDAwNjM=","avatar_url":"https://avatars0.githubusercontent.com/u/9300063?v=4","gravatar_id":"","url":"https://api.github.com/users/knorth55","html_url":"https://github.com/knorth55","followers_url":"https://api.github.com/users/knorth55/followers","following_url":"https://api.github.com/users/knorth55/following{/other_user}","gists_url":"https://api.github.com/users/knorth55/gists{/gist_id}","starred_url":"https://api.github.com/users/knorth55/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/knorth55/subscriptions","organizations_url":"https://api.github.com/users/knorth55/orgs","repos_url":"https://api.github.com/users/knorth55/repos","events_url":"https://api.github.com/users/knorth55/events{/privacy}","received_events_url":"https://api.github.com/users/knorth55/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/knorth55/chainercv","description":"ChainerCV: a Library for Computer Vision in Deep Learning","fork":true,"url":"https://api.github.com/repos/knorth55/chainercv","forks_url":"https://api.github.com/repos/knorth55/chainercv/forks","keys_url":"https://api.github.com/repos/knorth55/chainercv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/knorth55/chainercv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/knorth55/chainercv/teams","hooks_url":"https://api.github.com/repos/knorth55/chainercv/hooks","issue_events_url":"https://api.github.com/repos/knorth55/chainercv/issues/events{/number}","events_url":"https://api.github.com/repos/knorth55/chainercv/events","assignees_url":"https://api.github.com/repos/knorth55/chainercv/assignees{/user}","branches_url":"https://api.github.com/repos/knorth55/chainercv/branches{/branch}","tags_url":"https://api.github.com/repos/knorth55/chainercv/tags","blobs_url":"https://api.github.com/repos/knorth55/chainercv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/knorth55/chainercv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/knorth55/chainercv/git/refs{/sha}","trees_url":"https://api.github.com/repos/knorth55/chainercv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/knorth55/chainercv/statuses/{sha}","languages_url":"https://api.github.com/repos/knorth55/chainercv/languages","stargazers_url":"https://api.github.com/repos/knorth55/chainercv/stargazers","contributors_url":"https://api.github.com/repos/knorth55/chainercv/contributors","subscribers_url":"https://api.github.com/repos/knorth55/chainercv/subscribers","subscription_url":"https://api.github.com/repos/knorth55/chainercv/subscription","commits_url":"https://api.github.com/repos/knorth55/chainercv/commits{/sha}","git_commits_url":"https://api.github.com/repos/knorth55/chainercv/git/commits{/sha}","comments_url":"https://api.github.com/repos/knorth55/chainercv/comments{/number}","issue_comment_url":"https://api.github.com/repos/knorth55/chainercv/issues/comments{/number}","contents_url":"https://api.github.com/repos/knorth55/chainercv/contents/{+path}","compare_url":"https://api.github.com/repos/knorth55/chainercv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/knorth55/chainercv/merges","archive_url":"https://api.github.com/repos/knorth55/chainercv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/knorth55/chainercv/downloads","issues_url":"https://api.github.com/repos/knorth55/chainercv/issues{/number}","pulls_url":"https://api.github.com/repos/knorth55/chainercv/pulls{/number}","milestones_url":"https://api.github.com/repos/knorth55/chainercv/milestones{/number}","notifications_url":"https://api.github.com/repos/knorth55/chainercv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/knorth55/chainercv/labels{/name}","releases_url":"https://api.github.com/repos/knorth55/chainercv/releases{/id}","deployments_url":"https://api.github.com/repos/knorth55/chainercv/deployments","created_at":"2017-07-06T19:32:44Z","updated_at":"2017-07-06T19:32:45Z","pushed_at":"2018-07-07T15:27:04Z","git_url":"git://github.com/knorth55/chainercv.git","ssh_url":"git@github.com:knorth55/chainercv.git","clone_url":"https://github.com/knorth55/chainercv.git","svn_url":"https://github.com/knorth55/chainercv","homepage":"","size":4671,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"chainer:master","ref":"master","sha":"5cf55c7ff361a2b6083d3843320cff16450e17cd","user":{"login":"chainer","id":23183003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMTgzMDAz","avatar_url":"https://avatars3.githubusercontent.com/u/23183003?v=4","gravatar_id":"","url":"https://api.github.com/users/chainer","html_url":"https://github.com/chainer","followers_url":"https://api.github.com/users/chainer/followers","following_url":"https://api.github.com/users/chainer/following{/other_user}","gists_url":"https://api.github.com/users/chainer/gists{/gist_id}","starred_url":"https://api.github.com/users/chainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chainer/subscriptions","organizations_url":"https://api.github.com/users/chainer/orgs","repos_url":"https://api.github.com/users/chainer/repos","events_url":"https://api.github.com/users/chainer/events{/privacy}","received_events_url":"https://api.github.com/users/chainer/received_events","type":"Organization","site_admin":false},"repo":{"id":81784084,"node_id":"MDEwOlJlcG9zaXRvcnk4MTc4NDA4NA==","name":"chainercv","full_name":"chainer/chainercv","owner":{"login":"chainer","id":23183003,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIzMTgzMDAz","avatar_url":"https://avatars3.githubusercontent.com/u/23183003?v=4","gravatar_id":"","url":"https://api.github.com/users/chainer","html_url":"https://github.com/chainer","followers_url":"https://api.github.com/users/chainer/followers","following_url":"https://api.github.com/users/chainer/following{/other_user}","gists_url":"https://api.github.com/users/chainer/gists{/gist_id}","starred_url":"https://api.github.com/users/chainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chainer/subscriptions","organizations_url":"https://api.github.com/users/chainer/orgs","repos_url":"https://api.github.com/users/chainer/repos","events_url":"https://api.github.com/users/chainer/events{/privacy}","received_events_url":"https://api.github.com/users/chainer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/chainer/chainercv","description":"ChainerCV: a Library for Deep Learning in Computer Vision","fork":false,"url":"https://api.github.com/repos/chainer/chainercv","forks_url":"https://api.github.com/repos/chainer/chainercv/forks","keys_url":"https://api.github.com/repos/chainer/chainercv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chainer/chainercv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chainer/chainercv/teams","hooks_url":"https://api.github.com/repos/chainer/chainercv/hooks","issue_events_url":"https://api.github.com/repos/chainer/chainercv/issues/events{/number}","events_url":"https://api.github.com/repos/chainer/chainercv/events","assignees_url":"https://api.github.com/repos/chainer/chainercv/assignees{/user}","branches_url":"https://api.github.com/repos/chainer/chainercv/branches{/branch}","tags_url":"https://api.github.com/repos/chainer/chainercv/tags","blobs_url":"https://api.github.com/repos/chainer/chainercv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chainer/chainercv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chainer/chainercv/git/refs{/sha}","trees_url":"https://api.github.com/repos/chainer/chainercv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chainer/chainercv/statuses/{sha}","languages_url":"https://api.github.com/repos/chainer/chainercv/languages","stargazers_url":"https://api.github.com/repos/chainer/chainercv/stargazers","contributors_url":"https://api.github.com/repos/chainer/chainercv/contributors","subscribers_url":"https://api.github.com/repos/chainer/chainercv/subscribers","subscription_url":"https://api.github.com/repos/chainer/chainercv/subscription","commits_url":"https://api.github.com/repos/chainer/chainercv/commits{/sha}","git_commits_url":"https://api.github.com/repos/chainer/chainercv/git/commits{/sha}","comments_url":"https://api.github.com/repos/chainer/chainercv/comments{/number}","issue_comment_url":"https://api.github.com/repos/chainer/chainercv/issues/comments{/number}","contents_url":"https://api.github.com/repos/chainer/chainercv/contents/{+path}","compare_url":"https://api.github.com/repos/chainer/chainercv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chainer/chainercv/merges","archive_url":"https://api.github.com/repos/chainer/chainercv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chainer/chainercv/downloads","issues_url":"https://api.github.com/repos/chainer/chainercv/issues{/number}","pulls_url":"https://api.github.com/repos/chainer/chainercv/pulls{/number}","milestones_url":"https://api.github.com/repos/chainer/chainercv/milestones{/number}","notifications_url":"https://api.github.com/repos/chainer/chainercv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chainer/chainercv/labels{/name}","releases_url":"https://api.github.com/repos/chainer/chainercv/releases{/id}","deployments_url":"https://api.github.com/repos/chainer/chainercv/deployments","created_at":"2017-02-13T04:15:10Z","updated_at":"2018-07-07T01:52:23Z","pushed_at":"2018-07-07T15:27:06Z","git_url":"git://github.com/chainer/chainercv.git","ssh_url":"git@github.com:chainer/chainercv.git","clone_url":"https://github.com/chainer/chainercv.git","svn_url":"https://github.com/chainer/chainercv","homepage":"","size":4641,"stargazers_count":737,"watchers_count":737,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":150,"mirror_url":null,"archived":false,"open_issues_count":51,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":150,"open_issues":51,"watchers":737,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chainer/chainercv/pulls/665"},"html":{"href":"https://github.com/chainer/chainercv/pull/665"},"issue":{"href":"https://api.github.com/repos/chainer/chainercv/issues/665"},"comments":{"href":"https://api.github.com/repos/chainer/chainercv/issues/665/comments"},"review_comments":{"href":"https://api.github.com/repos/chainer/chainercv/pulls/665/comments"},"review_comment":{"href":"https://api.github.com/repos/chainer/chainercv/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chainer/chainercv/pulls/665/commits"},"statuses":{"href":"https://api.github.com/repos/chainer/chainercv/statuses/f9c6dcd92cce8529747a7dda4766d9102d0e3dff"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Hakuyume"}}