{"action":"created","comment":{"url":"https://api.github.com/repos/mila-udem/fuel/pulls/comments/31943075","id":31943075,"diff_hunk":"@@ -0,0 +1,64 @@\n+import os\n+import h5py\n+\n+from scipy.io import loadmat\n+\n+from fuel.converters.base import fill_hdf5_file, check_exists\n+\n+ALL_FILES16 = ['caltech101_silhouettes_16_split1.mat'] #, 'caltech101_silhouettes_16_split1.mat']\n+ALL_FILES28 = ['caltech101_silhouettes_28_split1.mat'] #, 'caltech101_silhouettes_28_split1.mat']\n+\n+\n+# TODO: Handel 16x16 dataset\n+\n+@check_exists(required_files=ALL_FILES28)\n+def convert_caltech101_silhouettes28(directory, output_file):\n+    \"\"\" Convert the CalTech 101 Silhouettes Datasets.\n+\n+    ToDo\n+\n+    Parameters\n+    ----------\n+    directory : str\n+        Directory in which the required input files reside.\n+    output_file : str\n+        Where to save the converted dataset.\n+\n+    \"\"\"\n+    with h5py.File(output_file, mode=\"w\") as h5file:\n+        tfd = loadmat(os.path.join(directory, 'caltech101_silhouettes_28_split1.mat'))\n+\n+        train_X = tfd['train_data'].reshape([-1., 1, 28, 28])\n+        valid_X = tfd['val_data'].reshape([-1., 1, 28, 28])\n+        test_X  = tfd['test_data'].reshape([-1., 1, 28, 28])\n+        train_Y = tfd['train_labels']\n+        valid_Y = tfd['val_labels']\n+        test_Y  = tfd['test_labels']\n+\n+        data = (\n+            ('train', 'features', train_X),\n+            ('train', 'targets' , train_Y),\n+            ('valid', 'features', valid_X),\n+            ('valid', 'targets' , valid_Y),\n+            ('test',  'features', test_X),\n+            ('test',  'targets' , test_Y),\n+        )\n+        fill_hdf5_file(h5file, data)\n+\n+        for i, label in enumerate(('batch', 'channel', 'height', 'width')):\n+            h5file['features'].dims[i].label = label\n+\n+        for i, label in enumerate(('batch', 'index')):\n+            h5file['targets'].dims[i].label = label\n+\n+\n+def fill_subparser(subparser):\n+    \"\"\"Sets up a subparser to convert Toronto Face Database files.","path":"fuel/converters/caltech101_silhouettes.py","position":56,"original_position":56,"commit_id":"37f7c50b286bcd44051407c1b4d31824ef6b099c","original_commit_id":"37f7c50b286bcd44051407c1b4d31824ef6b099c","user":{"login":"vdumoulin","id":2034067,"avatar_url":"https://avatars.githubusercontent.com/u/2034067?v=3","gravatar_id":"","url":"https://api.github.com/users/vdumoulin","html_url":"https://github.com/vdumoulin","followers_url":"https://api.github.com/users/vdumoulin/followers","following_url":"https://api.github.com/users/vdumoulin/following{/other_user}","gists_url":"https://api.github.com/users/vdumoulin/gists{/gist_id}","starred_url":"https://api.github.com/users/vdumoulin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vdumoulin/subscriptions","organizations_url":"https://api.github.com/users/vdumoulin/orgs","repos_url":"https://api.github.com/users/vdumoulin/repos","events_url":"https://api.github.com/users/vdumoulin/events{/privacy}","received_events_url":"https://api.github.com/users/vdumoulin/received_events","type":"User","site_admin":false},"body":"Typo: `Toronto Face Database`.","created_at":"2015-06-08T18:15:13Z","updated_at":"2015-06-08T18:15:13Z","html_url":"https://github.com/mila-udem/fuel/pull/156#discussion_r31943075","pull_request_url":"https://api.github.com/repos/mila-udem/fuel/pulls/156","_links":{"self":{"href":"https://api.github.com/repos/mila-udem/fuel/pulls/comments/31943075"},"html":{"href":"https://github.com/mila-udem/fuel/pull/156#discussion_r31943075"},"pull_request":{"href":"https://api.github.com/repos/mila-udem/fuel/pulls/156"}}},"pull_request":{"url":"https://api.github.com/repos/mila-udem/fuel/pulls/156","id":37178183,"html_url":"https://github.com/mila-udem/fuel/pull/156","diff_url":"https://github.com/mila-udem/fuel/pull/156.diff","patch_url":"https://github.com/mila-udem/fuel/pull/156.patch","issue_url":"https://api.github.com/repos/mila-udem/fuel/issues/156","number":156,"state":"open","locked":false,"title":"WIP: Add CalTech101 Silhouettes dataset","user":{"login":"jbornschein","id":241247,"avatar_url":"https://avatars.githubusercontent.com/u/241247?v=3","gravatar_id":"","url":"https://api.github.com/users/jbornschein","html_url":"https://github.com/jbornschein","followers_url":"https://api.github.com/users/jbornschein/followers","following_url":"https://api.github.com/users/jbornschein/following{/other_user}","gists_url":"https://api.github.com/users/jbornschein/gists{/gist_id}","starred_url":"https://api.github.com/users/jbornschein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbornschein/subscriptions","organizations_url":"https://api.github.com/users/jbornschein/orgs","repos_url":"https://api.github.com/users/jbornschein/repos","events_url":"https://api.github.com/users/jbornschein/events{/privacy}","received_events_url":"https://api.github.com/users/jbornschein/received_events","type":"User","site_admin":false},"body":"Binary dataset created by Benjamin M Marlin based on the CalTech101 dataset:\r\n  https://people.cs.umass.edu/~marlin/data.shtml\r\n\r\n- [ ] Documentation\r\n- [ ] Test \r\n- [ ] Handle 16x16 and 28x28 datasets","created_at":"2015-06-08T17:45:59Z","updated_at":"2015-06-08T18:15:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3dcc13c314fae1ba09cf127348b19c5bb5607a9c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mila-udem/fuel/pulls/156/commits","review_comments_url":"https://api.github.com/repos/mila-udem/fuel/pulls/156/comments","review_comment_url":"https://api.github.com/repos/mila-udem/fuel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mila-udem/fuel/issues/156/comments","statuses_url":"https://api.github.com/repos/mila-udem/fuel/statuses/37f7c50b286bcd44051407c1b4d31824ef6b099c","head":{"label":"jbornschein:silhouettes","ref":"silhouettes","sha":"37f7c50b286bcd44051407c1b4d31824ef6b099c","user":{"login":"jbornschein","id":241247,"avatar_url":"https://avatars.githubusercontent.com/u/241247?v=3","gravatar_id":"","url":"https://api.github.com/users/jbornschein","html_url":"https://github.com/jbornschein","followers_url":"https://api.github.com/users/jbornschein/followers","following_url":"https://api.github.com/users/jbornschein/following{/other_user}","gists_url":"https://api.github.com/users/jbornschein/gists{/gist_id}","starred_url":"https://api.github.com/users/jbornschein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbornschein/subscriptions","organizations_url":"https://api.github.com/users/jbornschein/orgs","repos_url":"https://api.github.com/users/jbornschein/repos","events_url":"https://api.github.com/users/jbornschein/events{/privacy}","received_events_url":"https://api.github.com/users/jbornschein/received_events","type":"User","site_admin":false},"repo":{"id":30738208,"name":"fuel","full_name":"jbornschein/fuel","owner":{"login":"jbornschein","id":241247,"avatar_url":"https://avatars.githubusercontent.com/u/241247?v=3","gravatar_id":"","url":"https://api.github.com/users/jbornschein","html_url":"https://github.com/jbornschein","followers_url":"https://api.github.com/users/jbornschein/followers","following_url":"https://api.github.com/users/jbornschein/following{/other_user}","gists_url":"https://api.github.com/users/jbornschein/gists{/gist_id}","starred_url":"https://api.github.com/users/jbornschein/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbornschein/subscriptions","organizations_url":"https://api.github.com/users/jbornschein/orgs","repos_url":"https://api.github.com/users/jbornschein/repos","events_url":"https://api.github.com/users/jbornschein/events{/privacy}","received_events_url":"https://api.github.com/users/jbornschein/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jbornschein/fuel","description":"A data pipeline framework for machine learning","fork":true,"url":"https://api.github.com/repos/jbornschein/fuel","forks_url":"https://api.github.com/repos/jbornschein/fuel/forks","keys_url":"https://api.github.com/repos/jbornschein/fuel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jbornschein/fuel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jbornschein/fuel/teams","hooks_url":"https://api.github.com/repos/jbornschein/fuel/hooks","issue_events_url":"https://api.github.com/repos/jbornschein/fuel/issues/events{/number}","events_url":"https://api.github.com/repos/jbornschein/fuel/events","assignees_url":"https://api.github.com/repos/jbornschein/fuel/assignees{/user}","branches_url":"https://api.github.com/repos/jbornschein/fuel/branches{/branch}","tags_url":"https://api.github.com/repos/jbornschein/fuel/tags","blobs_url":"https://api.github.com/repos/jbornschein/fuel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jbornschein/fuel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jbornschein/fuel/git/refs{/sha}","trees_url":"https://api.github.com/repos/jbornschein/fuel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jbornschein/fuel/statuses/{sha}","languages_url":"https://api.github.com/repos/jbornschein/fuel/languages","stargazers_url":"https://api.github.com/repos/jbornschein/fuel/stargazers","contributors_url":"https://api.github.com/repos/jbornschein/fuel/contributors","subscribers_url":"https://api.github.com/repos/jbornschein/fuel/subscribers","subscription_url":"https://api.github.com/repos/jbornschein/fuel/subscription","commits_url":"https://api.github.com/repos/jbornschein/fuel/commits{/sha}","git_commits_url":"https://api.github.com/repos/jbornschein/fuel/git/commits{/sha}","comments_url":"https://api.github.com/repos/jbornschein/fuel/comments{/number}","issue_comment_url":"https://api.github.com/repos/jbornschein/fuel/issues/comments{/number}","contents_url":"https://api.github.com/repos/jbornschein/fuel/contents/{+path}","compare_url":"https://api.github.com/repos/jbornschein/fuel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jbornschein/fuel/merges","archive_url":"https://api.github.com/repos/jbornschein/fuel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jbornschein/fuel/downloads","issues_url":"https://api.github.com/repos/jbornschein/fuel/issues{/number}","pulls_url":"https://api.github.com/repos/jbornschein/fuel/pulls{/number}","milestones_url":"https://api.github.com/repos/jbornschein/fuel/milestones{/number}","notifications_url":"https://api.github.com/repos/jbornschein/fuel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jbornschein/fuel/labels{/name}","releases_url":"https://api.github.com/repos/jbornschein/fuel/releases{/id}","created_at":"2015-02-13T03:17:36Z","updated_at":"2015-04-12T15:57:25Z","pushed_at":"2015-06-08T17:43:20Z","git_url":"git://github.com/jbornschein/fuel.git","ssh_url":"git@github.com:jbornschein/fuel.git","clone_url":"https://github.com/jbornschein/fuel.git","svn_url":"https://github.com/jbornschein/fuel","homepage":null,"size":631,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mila-udem:master","ref":"master","sha":"442e76afcc32993238666eb7cb19e32521c793a4","user":{"login":"mila-udem","id":11724251,"avatar_url":"https://avatars.githubusercontent.com/u/11724251?v=3","gravatar_id":"","url":"https://api.github.com/users/mila-udem","html_url":"https://github.com/mila-udem","followers_url":"https://api.github.com/users/mila-udem/followers","following_url":"https://api.github.com/users/mila-udem/following{/other_user}","gists_url":"https://api.github.com/users/mila-udem/gists{/gist_id}","starred_url":"https://api.github.com/users/mila-udem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mila-udem/subscriptions","organizations_url":"https://api.github.com/users/mila-udem/orgs","repos_url":"https://api.github.com/users/mila-udem/repos","events_url":"https://api.github.com/users/mila-udem/events{/privacy}","received_events_url":"https://api.github.com/users/mila-udem/received_events","type":"Organization","site_admin":false},"repo":{"id":30722866,"name":"fuel","full_name":"mila-udem/fuel","owner":{"login":"mila-udem","id":11724251,"avatar_url":"https://avatars.githubusercontent.com/u/11724251?v=3","gravatar_id":"","url":"https://api.github.com/users/mila-udem","html_url":"https://github.com/mila-udem","followers_url":"https://api.github.com/users/mila-udem/followers","following_url":"https://api.github.com/users/mila-udem/following{/other_user}","gists_url":"https://api.github.com/users/mila-udem/gists{/gist_id}","starred_url":"https://api.github.com/users/mila-udem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mila-udem/subscriptions","organizations_url":"https://api.github.com/users/mila-udem/orgs","repos_url":"https://api.github.com/users/mila-udem/repos","events_url":"https://api.github.com/users/mila-udem/events{/privacy}","received_events_url":"https://api.github.com/users/mila-udem/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mila-udem/fuel","description":"A data pipeline framework for machine learning","fork":false,"url":"https://api.github.com/repos/mila-udem/fuel","forks_url":"https://api.github.com/repos/mila-udem/fuel/forks","keys_url":"https://api.github.com/repos/mila-udem/fuel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mila-udem/fuel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mila-udem/fuel/teams","hooks_url":"https://api.github.com/repos/mila-udem/fuel/hooks","issue_events_url":"https://api.github.com/repos/mila-udem/fuel/issues/events{/number}","events_url":"https://api.github.com/repos/mila-udem/fuel/events","assignees_url":"https://api.github.com/repos/mila-udem/fuel/assignees{/user}","branches_url":"https://api.github.com/repos/mila-udem/fuel/branches{/branch}","tags_url":"https://api.github.com/repos/mila-udem/fuel/tags","blobs_url":"https://api.github.com/repos/mila-udem/fuel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mila-udem/fuel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mila-udem/fuel/git/refs{/sha}","trees_url":"https://api.github.com/repos/mila-udem/fuel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mila-udem/fuel/statuses/{sha}","languages_url":"https://api.github.com/repos/mila-udem/fuel/languages","stargazers_url":"https://api.github.com/repos/mila-udem/fuel/stargazers","contributors_url":"https://api.github.com/repos/mila-udem/fuel/contributors","subscribers_url":"https://api.github.com/repos/mila-udem/fuel/subscribers","subscription_url":"https://api.github.com/repos/mila-udem/fuel/subscription","commits_url":"https://api.github.com/repos/mila-udem/fuel/commits{/sha}","git_commits_url":"https://api.github.com/repos/mila-udem/fuel/git/commits{/sha}","comments_url":"https://api.github.com/repos/mila-udem/fuel/comments{/number}","issue_comment_url":"https://api.github.com/repos/mila-udem/fuel/issues/comments{/number}","contents_url":"https://api.github.com/repos/mila-udem/fuel/contents/{+path}","compare_url":"https://api.github.com/repos/mila-udem/fuel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mila-udem/fuel/merges","archive_url":"https://api.github.com/repos/mila-udem/fuel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mila-udem/fuel/downloads","issues_url":"https://api.github.com/repos/mila-udem/fuel/issues{/number}","pulls_url":"https://api.github.com/repos/mila-udem/fuel/pulls{/number}","milestones_url":"https://api.github.com/repos/mila-udem/fuel/milestones{/number}","notifications_url":"https://api.github.com/repos/mila-udem/fuel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mila-udem/fuel/labels{/name}","releases_url":"https://api.github.com/repos/mila-udem/fuel/releases{/id}","created_at":"2015-02-12T20:42:44Z","updated_at":"2015-06-08T15:18:39Z","pushed_at":"2015-06-08T18:11:17Z","git_url":"git://github.com/mila-udem/fuel.git","ssh_url":"git@github.com:mila-udem/fuel.git","clone_url":"https://github.com/mila-udem/fuel.git","svn_url":"https://github.com/mila-udem/fuel","homepage":null,"size":2340,"stargazers_count":90,"watchers_count":90,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":51,"mirror_url":null,"open_issues_count":40,"forks":51,"open_issues":40,"watchers":90,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mila-udem/fuel/pulls/156"},"html":{"href":"https://github.com/mila-udem/fuel/pull/156"},"issue":{"href":"https://api.github.com/repos/mila-udem/fuel/issues/156"},"comments":{"href":"https://api.github.com/repos/mila-udem/fuel/issues/156/comments"},"review_comments":{"href":"https://api.github.com/repos/mila-udem/fuel/pulls/156/comments"},"review_comment":{"href":"https://api.github.com/repos/mila-udem/fuel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mila-udem/fuel/pulls/156/commits"},"statuses":{"href":"https://api.github.com/repos/mila-udem/fuel/statuses/37f7c50b286bcd44051407c1b4d31824ef6b099c"}}}}