{"action":"created","comment":{"url":"https://api.github.com/repos/waldo-seg/waldo/pulls/comments/187469427","pull_request_review_id":119259157,"id":187469427,"diff_hunk":"@@ -6,8 +6,23 @@\n \"\"\" TODO\n \"\"\"\n \n-\n def visualize_mask(x):\n+    # \"image\" is a dictionary containing masks and image and numpy arrays\n+    mask = x['mask']\n+    red, green, blue, alpha = mask.T  # unpacking blends\n+    white_areas = (red > 0) & (blue > 0) & (green > 0)\n+    black_areas = (red == 0) & (blue == 0) & (green == 0) & (alpha == 255)\n+    # randomly coloring white areas. low is 10 as a threshold.\n+    # dimensions are = Red, Blue, Green, Alpha\n+    # Alpha is set 38 for a ~20% transparency\n+    mask[..., :][white_areas.T] = (\n+        np.random.randint(low=10, high=255), np.random.randint(low=10, high=255),\n+        np.random.randint(low=10, high=255), 38)\n+    # removing black areas\n+    mask[..., :][black_areas.T] = 0\n+\n+    x['mask'] = mask\n+    return None\n     \"\"\"This function accepts an object x that should represent an image with a","path":"scripts/waldo/data_visualization.py","position":22,"original_position":22,"commit_id":"33d5dc32d32b879d86ec4ef42e2b6ece372eeb0b","original_commit_id":"33d5dc32d32b879d86ec4ef42e2b6ece372eeb0b","user":{"login":"danpovey","id":3298747,"avatar_url":"https://avatars1.githubusercontent.com/u/3298747?v=4","gravatar_id":"","url":"https://api.github.com/users/danpovey","html_url":"https://github.com/danpovey","followers_url":"https://api.github.com/users/danpovey/followers","following_url":"https://api.github.com/users/danpovey/following{/other_user}","gists_url":"https://api.github.com/users/danpovey/gists{/gist_id}","starred_url":"https://api.github.com/users/danpovey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danpovey/subscriptions","organizations_url":"https://api.github.com/users/danpovey/orgs","repos_url":"https://api.github.com/users/danpovey/repos","events_url":"https://api.github.com/users/danpovey/events{/privacy}","received_events_url":"https://api.github.com/users/danpovey/received_events","type":"User","site_admin":false},"body":"Move the doc-string to the top of the function, and add calls to validate the object x (e.g.  validate_image_with_mask(x)) before and after the main parts of the function.  Also add code to, if the original image x['image'] had 1 color, upsample to 3 colors.  And you should assume that the leading dimension of the input tensor x['image'] is 1 (or no leading dim), or is 3.  @hhadian should be able to help-- your code is a good starting point but you need to understand the image format.  It would be an array with shape either (for example) (1,256,256) or (256,256) or (3,256,256).  If one of the first 2, it should be broadcast to a shape (3,256,256) before doing what you are doing.  x['mask'] would, in this example, be of shape (255,255), containing integer values: 0 for background or 1,2,3,... for the different object identities.  @YiwenShaoStephen please confirm this.\r\n\r\nAnd you shouldn't be writing to x['mask'], you should be writing to x['image'].","created_at":"2018-05-10T21:46:08Z","updated_at":"2018-05-10T21:46:09Z","html_url":"https://github.com/waldo-seg/waldo/pull/20#discussion_r187469427","pull_request_url":"https://api.github.com/repos/waldo-seg/waldo/pulls/20","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/waldo-seg/waldo/pulls/comments/187469427"},"html":{"href":"https://github.com/waldo-seg/waldo/pull/20#discussion_r187469427"},"pull_request":{"href":"https://api.github.com/repos/waldo-seg/waldo/pulls/20"}}},"pull_request":{"url":"https://api.github.com/repos/waldo-seg/waldo/pulls/20","id":186996812,"html_url":"https://github.com/waldo-seg/waldo/pull/20","diff_url":"https://github.com/waldo-seg/waldo/pull/20.diff","patch_url":"https://github.com/waldo-seg/waldo/pull/20.patch","issue_url":"https://api.github.com/repos/waldo-seg/waldo/issues/20","number":20,"state":"open","locked":false,"title":"Added visualize_mask function","user":{"login":"adelra","id":8910366,"avatar_url":"https://avatars3.githubusercontent.com/u/8910366?v=4","gravatar_id":"","url":"https://api.github.com/users/adelra","html_url":"https://github.com/adelra","followers_url":"https://api.github.com/users/adelra/followers","following_url":"https://api.github.com/users/adelra/following{/other_user}","gists_url":"https://api.github.com/users/adelra/gists{/gist_id}","starred_url":"https://api.github.com/users/adelra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adelra/subscriptions","organizations_url":"https://api.github.com/users/adelra/orgs","repos_url":"https://api.github.com/users/adelra/repos","events_url":"https://api.github.com/users/adelra/events{/privacy}","received_events_url":"https://api.github.com/users/adelra/received_events","type":"User","site_admin":false},"body":"Before visualization:\r\n![b98681c74842c4058bd2f88b06063731c26a90da083b1ef348e0ec734c58752b](https://user-images.githubusercontent.com/8910366/39831170-e5925c42-53d8-11e8-8959-d554e5494aa0.png)\r\n\r\nAfter visualization:\r\n![tmpb9zu5xmn](https://user-images.githubusercontent.com/8910366/39831175-e95190fa-53d8-11e8-8f82-9113e726ae5e.png)\r\n","created_at":"2018-05-09T18:03:20Z","updated_at":"2018-05-10T21:46:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"49b9cf86466f4abd61306ce673e9d227a7bdb3ee","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/waldo-seg/waldo/pulls/20/commits","review_comments_url":"https://api.github.com/repos/waldo-seg/waldo/pulls/20/comments","review_comment_url":"https://api.github.com/repos/waldo-seg/waldo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/waldo-seg/waldo/issues/20/comments","statuses_url":"https://api.github.com/repos/waldo-seg/waldo/statuses/33d5dc32d32b879d86ec4ef42e2b6ece372eeb0b","head":{"label":"adelra:master","ref":"master","sha":"33d5dc32d32b879d86ec4ef42e2b6ece372eeb0b","user":{"login":"adelra","id":8910366,"avatar_url":"https://avatars3.githubusercontent.com/u/8910366?v=4","gravatar_id":"","url":"https://api.github.com/users/adelra","html_url":"https://github.com/adelra","followers_url":"https://api.github.com/users/adelra/followers","following_url":"https://api.github.com/users/adelra/following{/other_user}","gists_url":"https://api.github.com/users/adelra/gists{/gist_id}","starred_url":"https://api.github.com/users/adelra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adelra/subscriptions","organizations_url":"https://api.github.com/users/adelra/orgs","repos_url":"https://api.github.com/users/adelra/repos","events_url":"https://api.github.com/users/adelra/events{/privacy}","received_events_url":"https://api.github.com/users/adelra/received_events","type":"User","site_admin":false},"repo":{"id":132793784,"name":"waldo","full_name":"adelra/waldo","owner":{"login":"adelra","id":8910366,"avatar_url":"https://avatars3.githubusercontent.com/u/8910366?v=4","gravatar_id":"","url":"https://api.github.com/users/adelra","html_url":"https://github.com/adelra","followers_url":"https://api.github.com/users/adelra/followers","following_url":"https://api.github.com/users/adelra/following{/other_user}","gists_url":"https://api.github.com/users/adelra/gists{/gist_id}","starred_url":"https://api.github.com/users/adelra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adelra/subscriptions","organizations_url":"https://api.github.com/users/adelra/orgs","repos_url":"https://api.github.com/users/adelra/repos","events_url":"https://api.github.com/users/adelra/events{/privacy}","received_events_url":"https://api.github.com/users/adelra/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adelra/waldo","description":" image-segmentation and text-localization ","fork":true,"url":"https://api.github.com/repos/adelra/waldo","forks_url":"https://api.github.com/repos/adelra/waldo/forks","keys_url":"https://api.github.com/repos/adelra/waldo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adelra/waldo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adelra/waldo/teams","hooks_url":"https://api.github.com/repos/adelra/waldo/hooks","issue_events_url":"https://api.github.com/repos/adelra/waldo/issues/events{/number}","events_url":"https://api.github.com/repos/adelra/waldo/events","assignees_url":"https://api.github.com/repos/adelra/waldo/assignees{/user}","branches_url":"https://api.github.com/repos/adelra/waldo/branches{/branch}","tags_url":"https://api.github.com/repos/adelra/waldo/tags","blobs_url":"https://api.github.com/repos/adelra/waldo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adelra/waldo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adelra/waldo/git/refs{/sha}","trees_url":"https://api.github.com/repos/adelra/waldo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adelra/waldo/statuses/{sha}","languages_url":"https://api.github.com/repos/adelra/waldo/languages","stargazers_url":"https://api.github.com/repos/adelra/waldo/stargazers","contributors_url":"https://api.github.com/repos/adelra/waldo/contributors","subscribers_url":"https://api.github.com/repos/adelra/waldo/subscribers","subscription_url":"https://api.github.com/repos/adelra/waldo/subscription","commits_url":"https://api.github.com/repos/adelra/waldo/commits{/sha}","git_commits_url":"https://api.github.com/repos/adelra/waldo/git/commits{/sha}","comments_url":"https://api.github.com/repos/adelra/waldo/comments{/number}","issue_comment_url":"https://api.github.com/repos/adelra/waldo/issues/comments{/number}","contents_url":"https://api.github.com/repos/adelra/waldo/contents/{+path}","compare_url":"https://api.github.com/repos/adelra/waldo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adelra/waldo/merges","archive_url":"https://api.github.com/repos/adelra/waldo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adelra/waldo/downloads","issues_url":"https://api.github.com/repos/adelra/waldo/issues{/number}","pulls_url":"https://api.github.com/repos/adelra/waldo/pulls{/number}","milestones_url":"https://api.github.com/repos/adelra/waldo/milestones{/number}","notifications_url":"https://api.github.com/repos/adelra/waldo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adelra/waldo/labels{/name}","releases_url":"https://api.github.com/repos/adelra/waldo/releases{/id}","deployments_url":"https://api.github.com/repos/adelra/waldo/deployments","created_at":"2018-05-09T17:52:47Z","updated_at":"2018-05-10T20:21:06Z","pushed_at":"2018-05-10T20:21:04Z","git_url":"git://github.com/adelra/waldo.git","ssh_url":"git@github.com:adelra/waldo.git","clone_url":"https://github.com/adelra/waldo.git","svn_url":"https://github.com/adelra/waldo","homepage":null,"size":106,"stargazers_count":0,"watchers_count":0,"language":"Perl","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":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"waldo-seg:master","ref":"master","sha":"b4b3e1ba99295eb96578c47e7dc8054af76de75a","user":{"login":"waldo-seg","id":38770818,"avatar_url":"https://avatars2.githubusercontent.com/u/38770818?v=4","gravatar_id":"","url":"https://api.github.com/users/waldo-seg","html_url":"https://github.com/waldo-seg","followers_url":"https://api.github.com/users/waldo-seg/followers","following_url":"https://api.github.com/users/waldo-seg/following{/other_user}","gists_url":"https://api.github.com/users/waldo-seg/gists{/gist_id}","starred_url":"https://api.github.com/users/waldo-seg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waldo-seg/subscriptions","organizations_url":"https://api.github.com/users/waldo-seg/orgs","repos_url":"https://api.github.com/users/waldo-seg/repos","events_url":"https://api.github.com/users/waldo-seg/events{/privacy}","received_events_url":"https://api.github.com/users/waldo-seg/received_events","type":"Organization","site_admin":false},"repo":{"id":131220535,"name":"waldo","full_name":"waldo-seg/waldo","owner":{"login":"waldo-seg","id":38770818,"avatar_url":"https://avatars2.githubusercontent.com/u/38770818?v=4","gravatar_id":"","url":"https://api.github.com/users/waldo-seg","html_url":"https://github.com/waldo-seg","followers_url":"https://api.github.com/users/waldo-seg/followers","following_url":"https://api.github.com/users/waldo-seg/following{/other_user}","gists_url":"https://api.github.com/users/waldo-seg/gists{/gist_id}","starred_url":"https://api.github.com/users/waldo-seg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waldo-seg/subscriptions","organizations_url":"https://api.github.com/users/waldo-seg/orgs","repos_url":"https://api.github.com/users/waldo-seg/repos","events_url":"https://api.github.com/users/waldo-seg/events{/privacy}","received_events_url":"https://api.github.com/users/waldo-seg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/waldo-seg/waldo","description":" image-segmentation and text-localization ","fork":false,"url":"https://api.github.com/repos/waldo-seg/waldo","forks_url":"https://api.github.com/repos/waldo-seg/waldo/forks","keys_url":"https://api.github.com/repos/waldo-seg/waldo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/waldo-seg/waldo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/waldo-seg/waldo/teams","hooks_url":"https://api.github.com/repos/waldo-seg/waldo/hooks","issue_events_url":"https://api.github.com/repos/waldo-seg/waldo/issues/events{/number}","events_url":"https://api.github.com/repos/waldo-seg/waldo/events","assignees_url":"https://api.github.com/repos/waldo-seg/waldo/assignees{/user}","branches_url":"https://api.github.com/repos/waldo-seg/waldo/branches{/branch}","tags_url":"https://api.github.com/repos/waldo-seg/waldo/tags","blobs_url":"https://api.github.com/repos/waldo-seg/waldo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/waldo-seg/waldo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/waldo-seg/waldo/git/refs{/sha}","trees_url":"https://api.github.com/repos/waldo-seg/waldo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/waldo-seg/waldo/statuses/{sha}","languages_url":"https://api.github.com/repos/waldo-seg/waldo/languages","stargazers_url":"https://api.github.com/repos/waldo-seg/waldo/stargazers","contributors_url":"https://api.github.com/repos/waldo-seg/waldo/contributors","subscribers_url":"https://api.github.com/repos/waldo-seg/waldo/subscribers","subscription_url":"https://api.github.com/repos/waldo-seg/waldo/subscription","commits_url":"https://api.github.com/repos/waldo-seg/waldo/commits{/sha}","git_commits_url":"https://api.github.com/repos/waldo-seg/waldo/git/commits{/sha}","comments_url":"https://api.github.com/repos/waldo-seg/waldo/comments{/number}","issue_comment_url":"https://api.github.com/repos/waldo-seg/waldo/issues/comments{/number}","contents_url":"https://api.github.com/repos/waldo-seg/waldo/contents/{+path}","compare_url":"https://api.github.com/repos/waldo-seg/waldo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/waldo-seg/waldo/merges","archive_url":"https://api.github.com/repos/waldo-seg/waldo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/waldo-seg/waldo/downloads","issues_url":"https://api.github.com/repos/waldo-seg/waldo/issues{/number}","pulls_url":"https://api.github.com/repos/waldo-seg/waldo/pulls{/number}","milestones_url":"https://api.github.com/repos/waldo-seg/waldo/milestones{/number}","notifications_url":"https://api.github.com/repos/waldo-seg/waldo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/waldo-seg/waldo/labels{/name}","releases_url":"https://api.github.com/repos/waldo-seg/waldo/releases{/id}","deployments_url":"https://api.github.com/repos/waldo-seg/waldo/deployments","created_at":"2018-04-26T23:20:53Z","updated_at":"2018-05-10T18:44:53Z","pushed_at":"2018-05-10T21:34:00Z","git_url":"git://github.com/waldo-seg/waldo.git","ssh_url":"git@github.com:waldo-seg/waldo.git","clone_url":"https://github.com/waldo-seg/waldo.git","svn_url":"https://github.com/waldo-seg/waldo","homepage":null,"size":108,"stargazers_count":5,"watchers_count":5,"language":"Perl","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":3,"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":6,"open_issues":3,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/waldo-seg/waldo/pulls/20"},"html":{"href":"https://github.com/waldo-seg/waldo/pull/20"},"issue":{"href":"https://api.github.com/repos/waldo-seg/waldo/issues/20"},"comments":{"href":"https://api.github.com/repos/waldo-seg/waldo/issues/20/comments"},"review_comments":{"href":"https://api.github.com/repos/waldo-seg/waldo/pulls/20/comments"},"review_comment":{"href":"https://api.github.com/repos/waldo-seg/waldo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/waldo-seg/waldo/pulls/20/commits"},"statuses":{"href":"https://api.github.com/repos/waldo-seg/waldo/statuses/33d5dc32d32b879d86ec4ef42e2b6ece372eeb0b"}},"author_association":"NONE"}}
{"actor":{"display_login":"danpovey"}}