{"action":"created","comment":{"url":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/comments/165335185","pull_request_review_id":93255347,"id":165335185,"diff_hunk":"@@ -0,0 +1,206 @@\n+import csv\n+import json\n+import os\n+\n+import numpy as np\n+from PIL import Image\n+\n+from .generator import Generator\n+from ..utils.image import read_image_bgr\n+\n+\n+def get_labels(metadata_dir):\n+    trainable_classes_path = os.path.join(metadata_dir, 'classes-bbox-trainable.txt')\n+    description_path = os.path.join(metadata_dir, 'class-descriptions.csv')\n+\n+    description_table = {}\n+    with open(description_path) as f:\n+        for row in csv.reader(f):\n+            if len(row):\n+                description_table[row[0]] = row[1].replace(\"\\\"\", \"\").replace(\"'\", \"\").replace('`', '')\n+\n+    with open(trainable_classes_path, 'rb') as f:\n+        trainable_classes = f.read().split('\\n')\n+\n+    id2labels_dict = dict([(i, description_table[c]) for i, c in enumerate(trainable_classes)])\n+    cls_index_dict = dict([(c, i) for i, c in enumerate(trainable_classes)])\n+\n+    return id2labels_dict, cls_index_dict\n+\n+\n+def generate_images_annotations_json(main_dir, metadata_dir, subset, cls_index_dict):\n+    annotations_path = os.path.join(metadata_dir, subset, 'annotations-human-bbox.csv')\n+\n+    cnt = 0\n+    with open(annotations_path, 'r') as csvfile:\n+        reader = csv.DictReader(csvfile,\n+                                fieldnames=['ImageID', 'Source', 'LabelName',\n+                                            'Confidence', 'XMin', 'XMax', 'YMin',\n+                                            'YMax'])\n+        reader.next()\n+        for _ in reader:\n+            cnt += 1\n+\n+        print ('There are {} lines in subset: {}'.format(cnt, subset))\n+\n+    id_annotations = dict()","path":"keras_retinanet/preprocessing/open_images.py","position":46,"original_position":46,"commit_id":"7fcf06f404a8a49eea90bf28102bf281bacb5ebd","original_commit_id":"7fcf06f404a8a49eea90bf28102bf281bacb5ebd","user":{"login":"lvaleriu","id":927999,"avatar_url":"https://avatars0.githubusercontent.com/u/927999?v=4","gravatar_id":"","url":"https://api.github.com/users/lvaleriu","html_url":"https://github.com/lvaleriu","followers_url":"https://api.github.com/users/lvaleriu/followers","following_url":"https://api.github.com/users/lvaleriu/following{/other_user}","gists_url":"https://api.github.com/users/lvaleriu/gists{/gist_id}","starred_url":"https://api.github.com/users/lvaleriu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lvaleriu/subscriptions","organizations_url":"https://api.github.com/users/lvaleriu/orgs","repos_url":"https://api.github.com/users/lvaleriu/repos","events_url":"https://api.github.com/users/lvaleriu/events{/privacy}","received_events_url":"https://api.github.com/users/lvaleriu/received_events","type":"User","site_admin":false},"body":"you're right!","created_at":"2018-02-01T11:54:38Z","updated_at":"2018-02-01T11:54:38Z","html_url":"https://github.com/fizyr/keras-retinanet/pull/253#discussion_r165335185","pull_request_url":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/253","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/comments/165335185"},"html":{"href":"https://github.com/fizyr/keras-retinanet/pull/253#discussion_r165335185"},"pull_request":{"href":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/253"}},"in_reply_to_id":165286742},"pull_request":{"url":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/253","id":165690756,"html_url":"https://github.com/fizyr/keras-retinanet/pull/253","diff_url":"https://github.com/fizyr/keras-retinanet/pull/253.diff","patch_url":"https://github.com/fizyr/keras-retinanet/pull/253.patch","issue_url":"https://api.github.com/repos/fizyr/keras-retinanet/issues/253","number":253,"state":"open","locked":false,"title":"Adding Google Open Images Dataset generator","user":{"login":"lvaleriu","id":927999,"avatar_url":"https://avatars0.githubusercontent.com/u/927999?v=4","gravatar_id":"","url":"https://api.github.com/users/lvaleriu","html_url":"https://github.com/lvaleriu","followers_url":"https://api.github.com/users/lvaleriu/followers","following_url":"https://api.github.com/users/lvaleriu/following{/other_user}","gists_url":"https://api.github.com/users/lvaleriu/gists{/gist_id}","starred_url":"https://api.github.com/users/lvaleriu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lvaleriu/subscriptions","organizations_url":"https://api.github.com/users/lvaleriu/orgs","repos_url":"https://api.github.com/users/lvaleriu/repos","events_url":"https://api.github.com/users/lvaleriu/events{/privacy}","received_events_url":"https://api.github.com/users/lvaleriu/received_events","type":"User","site_admin":false},"body":"Let me bring my contribution to this nice project. I added a new generator who is able to load the https://github.com/openimages/dataset.\r\n\r\nSince this dataset contains many classes (545 trainable box-level classes) i've added a filter option in order to choose a smaller number of classes.","created_at":"2018-01-29T12:25:43Z","updated_at":"2018-02-01T11:54:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e014aa2b7fb2388a1f27f6fa7577bda69bb0c77b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/253/commits","review_comments_url":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/253/comments","review_comment_url":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fizyr/keras-retinanet/issues/253/comments","statuses_url":"https://api.github.com/repos/fizyr/keras-retinanet/statuses/7fcf06f404a8a49eea90bf28102bf281bacb5ebd","head":{"label":"lvaleriu:master","ref":"master","sha":"7fcf06f404a8a49eea90bf28102bf281bacb5ebd","user":{"login":"lvaleriu","id":927999,"avatar_url":"https://avatars0.githubusercontent.com/u/927999?v=4","gravatar_id":"","url":"https://api.github.com/users/lvaleriu","html_url":"https://github.com/lvaleriu","followers_url":"https://api.github.com/users/lvaleriu/followers","following_url":"https://api.github.com/users/lvaleriu/following{/other_user}","gists_url":"https://api.github.com/users/lvaleriu/gists{/gist_id}","starred_url":"https://api.github.com/users/lvaleriu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lvaleriu/subscriptions","organizations_url":"https://api.github.com/users/lvaleriu/orgs","repos_url":"https://api.github.com/users/lvaleriu/repos","events_url":"https://api.github.com/users/lvaleriu/events{/privacy}","received_events_url":"https://api.github.com/users/lvaleriu/received_events","type":"User","site_admin":false},"repo":{"id":119162268,"name":"keras-retinanet","full_name":"lvaleriu/keras-retinanet","owner":{"login":"lvaleriu","id":927999,"avatar_url":"https://avatars0.githubusercontent.com/u/927999?v=4","gravatar_id":"","url":"https://api.github.com/users/lvaleriu","html_url":"https://github.com/lvaleriu","followers_url":"https://api.github.com/users/lvaleriu/followers","following_url":"https://api.github.com/users/lvaleriu/following{/other_user}","gists_url":"https://api.github.com/users/lvaleriu/gists{/gist_id}","starred_url":"https://api.github.com/users/lvaleriu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lvaleriu/subscriptions","organizations_url":"https://api.github.com/users/lvaleriu/orgs","repos_url":"https://api.github.com/users/lvaleriu/repos","events_url":"https://api.github.com/users/lvaleriu/events{/privacy}","received_events_url":"https://api.github.com/users/lvaleriu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lvaleriu/keras-retinanet","description":"Keras implementation of RetinaNet object detection.","fork":true,"url":"https://api.github.com/repos/lvaleriu/keras-retinanet","forks_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/forks","keys_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/teams","hooks_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/hooks","issue_events_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/issues/events{/number}","events_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/events","assignees_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/assignees{/user}","branches_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/branches{/branch}","tags_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/tags","blobs_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/git/refs{/sha}","trees_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/statuses/{sha}","languages_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/languages","stargazers_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/stargazers","contributors_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/contributors","subscribers_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/subscribers","subscription_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/subscription","commits_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/commits{/sha}","git_commits_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/git/commits{/sha}","comments_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/comments{/number}","issue_comment_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/issues/comments{/number}","contents_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/contents/{+path}","compare_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/merges","archive_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/downloads","issues_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/issues{/number}","pulls_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/pulls{/number}","milestones_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/milestones{/number}","notifications_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/labels{/name}","releases_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/releases{/id}","deployments_url":"https://api.github.com/repos/lvaleriu/keras-retinanet/deployments","created_at":"2018-01-27T12:26:27Z","updated_at":"2018-01-27T12:26:29Z","pushed_at":"2018-02-01T08:10:32Z","git_url":"git://github.com/lvaleriu/keras-retinanet.git","ssh_url":"git@github.com:lvaleriu/keras-retinanet.git","clone_url":"https://github.com/lvaleriu/keras-retinanet.git","svn_url":"https://github.com/lvaleriu/keras-retinanet","homepage":null,"size":7439,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"fizyr:master","ref":"master","sha":"0ec3992ab122e8a1227e1aebcdfd95438bc51b0e","user":{"login":"fizyr","id":14974733,"avatar_url":"https://avatars0.githubusercontent.com/u/14974733?v=4","gravatar_id":"","url":"https://api.github.com/users/fizyr","html_url":"https://github.com/fizyr","followers_url":"https://api.github.com/users/fizyr/followers","following_url":"https://api.github.com/users/fizyr/following{/other_user}","gists_url":"https://api.github.com/users/fizyr/gists{/gist_id}","starred_url":"https://api.github.com/users/fizyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fizyr/subscriptions","organizations_url":"https://api.github.com/users/fizyr/orgs","repos_url":"https://api.github.com/users/fizyr/repos","events_url":"https://api.github.com/users/fizyr/events{/privacy}","received_events_url":"https://api.github.com/users/fizyr/received_events","type":"Organization","site_admin":false},"repo":{"id":100249425,"name":"keras-retinanet","full_name":"fizyr/keras-retinanet","owner":{"login":"fizyr","id":14974733,"avatar_url":"https://avatars0.githubusercontent.com/u/14974733?v=4","gravatar_id":"","url":"https://api.github.com/users/fizyr","html_url":"https://github.com/fizyr","followers_url":"https://api.github.com/users/fizyr/followers","following_url":"https://api.github.com/users/fizyr/following{/other_user}","gists_url":"https://api.github.com/users/fizyr/gists{/gist_id}","starred_url":"https://api.github.com/users/fizyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fizyr/subscriptions","organizations_url":"https://api.github.com/users/fizyr/orgs","repos_url":"https://api.github.com/users/fizyr/repos","events_url":"https://api.github.com/users/fizyr/events{/privacy}","received_events_url":"https://api.github.com/users/fizyr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fizyr/keras-retinanet","description":"Keras implementation of RetinaNet object detection.","fork":false,"url":"https://api.github.com/repos/fizyr/keras-retinanet","forks_url":"https://api.github.com/repos/fizyr/keras-retinanet/forks","keys_url":"https://api.github.com/repos/fizyr/keras-retinanet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fizyr/keras-retinanet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fizyr/keras-retinanet/teams","hooks_url":"https://api.github.com/repos/fizyr/keras-retinanet/hooks","issue_events_url":"https://api.github.com/repos/fizyr/keras-retinanet/issues/events{/number}","events_url":"https://api.github.com/repos/fizyr/keras-retinanet/events","assignees_url":"https://api.github.com/repos/fizyr/keras-retinanet/assignees{/user}","branches_url":"https://api.github.com/repos/fizyr/keras-retinanet/branches{/branch}","tags_url":"https://api.github.com/repos/fizyr/keras-retinanet/tags","blobs_url":"https://api.github.com/repos/fizyr/keras-retinanet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fizyr/keras-retinanet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fizyr/keras-retinanet/git/refs{/sha}","trees_url":"https://api.github.com/repos/fizyr/keras-retinanet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fizyr/keras-retinanet/statuses/{sha}","languages_url":"https://api.github.com/repos/fizyr/keras-retinanet/languages","stargazers_url":"https://api.github.com/repos/fizyr/keras-retinanet/stargazers","contributors_url":"https://api.github.com/repos/fizyr/keras-retinanet/contributors","subscribers_url":"https://api.github.com/repos/fizyr/keras-retinanet/subscribers","subscription_url":"https://api.github.com/repos/fizyr/keras-retinanet/subscription","commits_url":"https://api.github.com/repos/fizyr/keras-retinanet/commits{/sha}","git_commits_url":"https://api.github.com/repos/fizyr/keras-retinanet/git/commits{/sha}","comments_url":"https://api.github.com/repos/fizyr/keras-retinanet/comments{/number}","issue_comment_url":"https://api.github.com/repos/fizyr/keras-retinanet/issues/comments{/number}","contents_url":"https://api.github.com/repos/fizyr/keras-retinanet/contents/{+path}","compare_url":"https://api.github.com/repos/fizyr/keras-retinanet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fizyr/keras-retinanet/merges","archive_url":"https://api.github.com/repos/fizyr/keras-retinanet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fizyr/keras-retinanet/downloads","issues_url":"https://api.github.com/repos/fizyr/keras-retinanet/issues{/number}","pulls_url":"https://api.github.com/repos/fizyr/keras-retinanet/pulls{/number}","milestones_url":"https://api.github.com/repos/fizyr/keras-retinanet/milestones{/number}","notifications_url":"https://api.github.com/repos/fizyr/keras-retinanet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fizyr/keras-retinanet/labels{/name}","releases_url":"https://api.github.com/repos/fizyr/keras-retinanet/releases{/id}","deployments_url":"https://api.github.com/repos/fizyr/keras-retinanet/deployments","created_at":"2017-08-14T09:14:29Z","updated_at":"2018-02-01T06:36:49Z","pushed_at":"2018-02-01T08:10:33Z","git_url":"git://github.com/fizyr/keras-retinanet.git","ssh_url":"git@github.com:fizyr/keras-retinanet.git","clone_url":"https://github.com/fizyr/keras-retinanet.git","svn_url":"https://github.com/fizyr/keras-retinanet","homepage":null,"size":7443,"stargazers_count":388,"watchers_count":388,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":161,"mirror_url":null,"archived":false,"open_issues_count":8,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":161,"open_issues":8,"watchers":388,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/253"},"html":{"href":"https://github.com/fizyr/keras-retinanet/pull/253"},"issue":{"href":"https://api.github.com/repos/fizyr/keras-retinanet/issues/253"},"comments":{"href":"https://api.github.com/repos/fizyr/keras-retinanet/issues/253/comments"},"review_comments":{"href":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/253/comments"},"review_comment":{"href":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fizyr/keras-retinanet/pulls/253/commits"},"statuses":{"href":"https://api.github.com/repos/fizyr/keras-retinanet/statuses/7fcf06f404a8a49eea90bf28102bf281bacb5ebd"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"lvaleriu"}}