{"action":"created","comment":{"url":"https://api.github.com/repos/pytorch/vision/pulls/comments/238697624","pull_request_review_id":181300958,"id":238697624,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzODY5NzYyNA==","diff_hunk":"@@ -0,0 +1,154 @@\n+from collections import defaultdict\n+from PIL import Image\n+from six.moves import html_parser\n+\n+import glob\n+import os\n+import torch.utils.data as data\n+\n+\n+class Flickr8kParser(html_parser.HTMLParser):\n+    \"\"\"Parser for extracting captions from the Flickr8k dataset web page.\"\"\"\n+\n+    def __init__(self, root):\n+        super(Flickr8kParser, self).__init__()\n+\n+        self.root = root\n+\n+        # Data structure to store captions\n+        self.annotations = {}\n+\n+        # State variables\n+        self.in_table = False\n+        self.current_tag = None\n+        self.current_img = None\n+\n+    def handle_starttag(self, tag, attrs):\n+        self.current_tag = tag\n+\n+        if tag == 'table':\n+            self.in_table = True\n+\n+    def handle_endtag(self, tag):\n+        self.current_tag = None\n+\n+        if tag == 'table':\n+            self.in_table = False\n+\n+    def handle_data(self, data):\n+        if self.in_table:\n+            if data == 'Image Not Found':\n+                self.current_img = None\n+            elif self.current_tag == 'a':\n+                img_id = data.split('/')[-2]\n+                img_id = os.path.join(self.root, img_id + '_*.jpg')\n+                img_id = glob.glob(filename)[0]","path":"torchvision/datasets/flickr.py","position":null,"original_position":45,"commit_id":"b71a836150bdcea2f18cdde49de0aa6b48cc204d","original_commit_id":"5abce7e603f854cc6f8580b6368d9e701e0d88f1","user":{"login":"adamjstewart","id":12021217,"node_id":"MDQ6VXNlcjEyMDIxMjE3","avatar_url":"https://avatars2.githubusercontent.com/u/12021217?v=4","gravatar_id":"","url":"https://api.github.com/users/adamjstewart","html_url":"https://github.com/adamjstewart","followers_url":"https://api.github.com/users/adamjstewart/followers","following_url":"https://api.github.com/users/adamjstewart/following{/other_user}","gists_url":"https://api.github.com/users/adamjstewart/gists{/gist_id}","starred_url":"https://api.github.com/users/adamjstewart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamjstewart/subscriptions","organizations_url":"https://api.github.com/users/adamjstewart/orgs","repos_url":"https://api.github.com/users/adamjstewart/repos","events_url":"https://api.github.com/users/adamjstewart/events{/privacy}","received_events_url":"https://api.github.com/users/adamjstewart/received_events","type":"User","site_admin":false},"body":"Oops, copy-n-paste bug. Good job linter!","created_at":"2018-12-04T15:00:52Z","updated_at":"2018-12-04T15:00:52Z","html_url":"https://github.com/pytorch/vision/pull/674#discussion_r238697624","pull_request_url":"https://api.github.com/repos/pytorch/vision/pulls/674","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/pytorch/vision/pulls/comments/238697624"},"html":{"href":"https://github.com/pytorch/vision/pull/674#discussion_r238697624"},"pull_request":{"href":"https://api.github.com/repos/pytorch/vision/pulls/674"}},"in_reply_to_id":238695484},"pull_request":{"url":"https://api.github.com/repos/pytorch/vision/pulls/674","id":235305824,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM1MzA1ODI0","html_url":"https://github.com/pytorch/vision/pull/674","diff_url":"https://github.com/pytorch/vision/pull/674.diff","patch_url":"https://github.com/pytorch/vision/pull/674.patch","issue_url":"https://api.github.com/repos/pytorch/vision/issues/674","number":674,"state":"open","locked":false,"title":"Add Flickr8k and Flickr30k Datasets","user":{"login":"adamjstewart","id":12021217,"node_id":"MDQ6VXNlcjEyMDIxMjE3","avatar_url":"https://avatars2.githubusercontent.com/u/12021217?v=4","gravatar_id":"","url":"https://api.github.com/users/adamjstewart","html_url":"https://github.com/adamjstewart","followers_url":"https://api.github.com/users/adamjstewart/followers","following_url":"https://api.github.com/users/adamjstewart/following{/other_user}","gists_url":"https://api.github.com/users/adamjstewart/gists{/gist_id}","starred_url":"https://api.github.com/users/adamjstewart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamjstewart/subscriptions","organizations_url":"https://api.github.com/users/adamjstewart/orgs","repos_url":"https://api.github.com/users/adamjstewart/repos","events_url":"https://api.github.com/users/adamjstewart/events{/privacy}","received_events_url":"https://api.github.com/users/adamjstewart/received_events","type":"User","site_admin":false},"body":"Adds the following datasets, with a few caveats.\r\n\r\n### Flickr8k\r\n\r\nThis dataset is fairly problematic. One does not simply download Flickr8k. Much like [SBU](https://github.com/pytorch/vision/pull/665), Flickr8k has a [web page](http://nlp.cs.illinois.edu/HockenmaierGroup/8k-pictures.html) that lists URLs for images and captions. Some of these URLs have been replaced with \"Image Not Found\". Other URLs are now dead. There is no text file containing caption labels, so I had to write an HTML parser for the web page itself. Another thing to note is that some images appear twice on the web page, meaning they actually have 10 captions. I decided to take the last 5 captions to keep things uniform. I also skipped \"Image Not Found\" captions. I happen to know someone who knows someone who works in this particular professor's lab and has access to a tarball with all the original images, but for someone without this tarball, this file may require hacking.\r\n\r\n### Flickr30k\r\n\r\nThis dataset was much nicer to package. The only annoying thing is that there is no way to automatically download it, you have to download it yourself from [Google Drive](https://drive.google.com/file/d/0B_PL6p-5reUAZEM4MmRQQ2VVSlk/view). According to the [web page](http://web.engr.illinois.edu/~bplumme2/Flickr30kEntities/), this Google Drive link is supposedly temporary, but from what I've heard, it's been \"temporary\" for years.","created_at":"2018-12-03T01:54:30Z","updated_at":"2018-12-04T15:00:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c701efae9e32a936b429b10915c054e23de655b8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pytorch/vision/pulls/674/commits","review_comments_url":"https://api.github.com/repos/pytorch/vision/pulls/674/comments","review_comment_url":"https://api.github.com/repos/pytorch/vision/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pytorch/vision/issues/674/comments","statuses_url":"https://api.github.com/repos/pytorch/vision/statuses/b71a836150bdcea2f18cdde49de0aa6b48cc204d","head":{"label":"adamjstewart:features/flickr","ref":"features/flickr","sha":"b71a836150bdcea2f18cdde49de0aa6b48cc204d","user":{"login":"adamjstewart","id":12021217,"node_id":"MDQ6VXNlcjEyMDIxMjE3","avatar_url":"https://avatars2.githubusercontent.com/u/12021217?v=4","gravatar_id":"","url":"https://api.github.com/users/adamjstewart","html_url":"https://github.com/adamjstewart","followers_url":"https://api.github.com/users/adamjstewart/followers","following_url":"https://api.github.com/users/adamjstewart/following{/other_user}","gists_url":"https://api.github.com/users/adamjstewart/gists{/gist_id}","starred_url":"https://api.github.com/users/adamjstewart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamjstewart/subscriptions","organizations_url":"https://api.github.com/users/adamjstewart/orgs","repos_url":"https://api.github.com/users/adamjstewart/repos","events_url":"https://api.github.com/users/adamjstewart/events{/privacy}","received_events_url":"https://api.github.com/users/adamjstewart/received_events","type":"User","site_admin":false},"repo":{"id":158428804,"node_id":"MDEwOlJlcG9zaXRvcnkxNTg0Mjg4MDQ=","name":"vision","full_name":"adamjstewart/vision","private":false,"owner":{"login":"adamjstewart","id":12021217,"node_id":"MDQ6VXNlcjEyMDIxMjE3","avatar_url":"https://avatars2.githubusercontent.com/u/12021217?v=4","gravatar_id":"","url":"https://api.github.com/users/adamjstewart","html_url":"https://github.com/adamjstewart","followers_url":"https://api.github.com/users/adamjstewart/followers","following_url":"https://api.github.com/users/adamjstewart/following{/other_user}","gists_url":"https://api.github.com/users/adamjstewart/gists{/gist_id}","starred_url":"https://api.github.com/users/adamjstewart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamjstewart/subscriptions","organizations_url":"https://api.github.com/users/adamjstewart/orgs","repos_url":"https://api.github.com/users/adamjstewart/repos","events_url":"https://api.github.com/users/adamjstewart/events{/privacy}","received_events_url":"https://api.github.com/users/adamjstewart/received_events","type":"User","site_admin":false},"html_url":"https://github.com/adamjstewart/vision","description":"Datasets, Transforms and Models specific to Computer Vision","fork":true,"url":"https://api.github.com/repos/adamjstewart/vision","forks_url":"https://api.github.com/repos/adamjstewart/vision/forks","keys_url":"https://api.github.com/repos/adamjstewart/vision/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adamjstewart/vision/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adamjstewart/vision/teams","hooks_url":"https://api.github.com/repos/adamjstewart/vision/hooks","issue_events_url":"https://api.github.com/repos/adamjstewart/vision/issues/events{/number}","events_url":"https://api.github.com/repos/adamjstewart/vision/events","assignees_url":"https://api.github.com/repos/adamjstewart/vision/assignees{/user}","branches_url":"https://api.github.com/repos/adamjstewart/vision/branches{/branch}","tags_url":"https://api.github.com/repos/adamjstewart/vision/tags","blobs_url":"https://api.github.com/repos/adamjstewart/vision/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adamjstewart/vision/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adamjstewart/vision/git/refs{/sha}","trees_url":"https://api.github.com/repos/adamjstewart/vision/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adamjstewart/vision/statuses/{sha}","languages_url":"https://api.github.com/repos/adamjstewart/vision/languages","stargazers_url":"https://api.github.com/repos/adamjstewart/vision/stargazers","contributors_url":"https://api.github.com/repos/adamjstewart/vision/contributors","subscribers_url":"https://api.github.com/repos/adamjstewart/vision/subscribers","subscription_url":"https://api.github.com/repos/adamjstewart/vision/subscription","commits_url":"https://api.github.com/repos/adamjstewart/vision/commits{/sha}","git_commits_url":"https://api.github.com/repos/adamjstewart/vision/git/commits{/sha}","comments_url":"https://api.github.com/repos/adamjstewart/vision/comments{/number}","issue_comment_url":"https://api.github.com/repos/adamjstewart/vision/issues/comments{/number}","contents_url":"https://api.github.com/repos/adamjstewart/vision/contents/{+path}","compare_url":"https://api.github.com/repos/adamjstewart/vision/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adamjstewart/vision/merges","archive_url":"https://api.github.com/repos/adamjstewart/vision/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adamjstewart/vision/downloads","issues_url":"https://api.github.com/repos/adamjstewart/vision/issues{/number}","pulls_url":"https://api.github.com/repos/adamjstewart/vision/pulls{/number}","milestones_url":"https://api.github.com/repos/adamjstewart/vision/milestones{/number}","notifications_url":"https://api.github.com/repos/adamjstewart/vision/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adamjstewart/vision/labels{/name}","releases_url":"https://api.github.com/repos/adamjstewart/vision/releases{/id}","deployments_url":"https://api.github.com/repos/adamjstewart/vision/deployments","created_at":"2018-11-20T17:42:22Z","updated_at":"2018-12-03T01:40:52Z","pushed_at":"2018-12-04T15:00:15Z","git_url":"git://github.com/adamjstewart/vision.git","ssh_url":"git@github.com:adamjstewart/vision.git","clone_url":"https://github.com/adamjstewart/vision.git","svn_url":"https://github.com/adamjstewart/vision","homepage":null,"size":2194,"stargazers_count":0,"watchers_count":0,"language":"Jupyter Notebook","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":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pytorch:master","ref":"master","sha":"878a771f441049f937ed3a5773d87d4570211e50","user":{"login":"pytorch","id":21003710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDAzNzEw","avatar_url":"https://avatars3.githubusercontent.com/u/21003710?v=4","gravatar_id":"","url":"https://api.github.com/users/pytorch","html_url":"https://github.com/pytorch","followers_url":"https://api.github.com/users/pytorch/followers","following_url":"https://api.github.com/users/pytorch/following{/other_user}","gists_url":"https://api.github.com/users/pytorch/gists{/gist_id}","starred_url":"https://api.github.com/users/pytorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytorch/subscriptions","organizations_url":"https://api.github.com/users/pytorch/orgs","repos_url":"https://api.github.com/users/pytorch/repos","events_url":"https://api.github.com/users/pytorch/events{/privacy}","received_events_url":"https://api.github.com/users/pytorch/received_events","type":"Organization","site_admin":false},"repo":{"id":73328905,"node_id":"MDEwOlJlcG9zaXRvcnk3MzMyODkwNQ==","name":"vision","full_name":"pytorch/vision","private":false,"owner":{"login":"pytorch","id":21003710,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxMDAzNzEw","avatar_url":"https://avatars3.githubusercontent.com/u/21003710?v=4","gravatar_id":"","url":"https://api.github.com/users/pytorch","html_url":"https://github.com/pytorch","followers_url":"https://api.github.com/users/pytorch/followers","following_url":"https://api.github.com/users/pytorch/following{/other_user}","gists_url":"https://api.github.com/users/pytorch/gists{/gist_id}","starred_url":"https://api.github.com/users/pytorch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pytorch/subscriptions","organizations_url":"https://api.github.com/users/pytorch/orgs","repos_url":"https://api.github.com/users/pytorch/repos","events_url":"https://api.github.com/users/pytorch/events{/privacy}","received_events_url":"https://api.github.com/users/pytorch/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/pytorch/vision","description":"Datasets, Transforms and Models specific to Computer Vision","fork":false,"url":"https://api.github.com/repos/pytorch/vision","forks_url":"https://api.github.com/repos/pytorch/vision/forks","keys_url":"https://api.github.com/repos/pytorch/vision/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pytorch/vision/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pytorch/vision/teams","hooks_url":"https://api.github.com/repos/pytorch/vision/hooks","issue_events_url":"https://api.github.com/repos/pytorch/vision/issues/events{/number}","events_url":"https://api.github.com/repos/pytorch/vision/events","assignees_url":"https://api.github.com/repos/pytorch/vision/assignees{/user}","branches_url":"https://api.github.com/repos/pytorch/vision/branches{/branch}","tags_url":"https://api.github.com/repos/pytorch/vision/tags","blobs_url":"https://api.github.com/repos/pytorch/vision/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pytorch/vision/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pytorch/vision/git/refs{/sha}","trees_url":"https://api.github.com/repos/pytorch/vision/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pytorch/vision/statuses/{sha}","languages_url":"https://api.github.com/repos/pytorch/vision/languages","stargazers_url":"https://api.github.com/repos/pytorch/vision/stargazers","contributors_url":"https://api.github.com/repos/pytorch/vision/contributors","subscribers_url":"https://api.github.com/repos/pytorch/vision/subscribers","subscription_url":"https://api.github.com/repos/pytorch/vision/subscription","commits_url":"https://api.github.com/repos/pytorch/vision/commits{/sha}","git_commits_url":"https://api.github.com/repos/pytorch/vision/git/commits{/sha}","comments_url":"https://api.github.com/repos/pytorch/vision/comments{/number}","issue_comment_url":"https://api.github.com/repos/pytorch/vision/issues/comments{/number}","contents_url":"https://api.github.com/repos/pytorch/vision/contents/{+path}","compare_url":"https://api.github.com/repos/pytorch/vision/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pytorch/vision/merges","archive_url":"https://api.github.com/repos/pytorch/vision/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pytorch/vision/downloads","issues_url":"https://api.github.com/repos/pytorch/vision/issues{/number}","pulls_url":"https://api.github.com/repos/pytorch/vision/pulls{/number}","milestones_url":"https://api.github.com/repos/pytorch/vision/milestones{/number}","notifications_url":"https://api.github.com/repos/pytorch/vision/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pytorch/vision/labels{/name}","releases_url":"https://api.github.com/repos/pytorch/vision/releases{/id}","deployments_url":"https://api.github.com/repos/pytorch/vision/deployments","created_at":"2016-11-09T23:11:43Z","updated_at":"2018-12-04T14:47:19Z","pushed_at":"2018-12-04T15:00:17Z","git_url":"git://github.com/pytorch/vision.git","ssh_url":"git@github.com:pytorch/vision.git","clone_url":"https://github.com/pytorch/vision.git","svn_url":"https://github.com/pytorch/vision","homepage":null,"size":2191,"stargazers_count":2378,"watchers_count":2378,"language":"Jupyter Notebook","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1150,"mirror_url":null,"archived":false,"open_issues_count":116,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":1150,"open_issues":116,"watchers":2378,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pytorch/vision/pulls/674"},"html":{"href":"https://github.com/pytorch/vision/pull/674"},"issue":{"href":"https://api.github.com/repos/pytorch/vision/issues/674"},"comments":{"href":"https://api.github.com/repos/pytorch/vision/issues/674/comments"},"review_comments":{"href":"https://api.github.com/repos/pytorch/vision/pulls/674/comments"},"review_comment":{"href":"https://api.github.com/repos/pytorch/vision/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pytorch/vision/pulls/674/commits"},"statuses":{"href":"https://api.github.com/repos/pytorch/vision/statuses/b71a836150bdcea2f18cdde49de0aa6b48cc204d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"adamjstewart"}}