{"action":"created","comment":{"url":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/comments/61425574","id":61425574,"diff_hunk":"@@ -0,0 +1,90 @@\n+\"\"\"A script for parsing the Alov bounding box `.ann` files.\"\"\"\n+\n+import sys\n+import os\n+import itertools\n+import shutil\n+import pandas as pd\n+\n+def parse_file(bbox_dir, filename): \n+    \"\"\"Parse an individual `.ann` file and output the relevant elements.\n+\n+    Args: \n+    ----\n+        bbox_dir: str\n+            Holds the directory path to the `.ann` file. \n+        filename: str\n+            Holds the name of the `.ann` file. \n+\n+    Output: \n+    ------\n+        output_lst: list of lists \n+            Holds the elements grabbed from the `.ann` file. \n+    \"\"\"\n+\n+    parsed_df = pd.read_table(bbox_dir + filename, sep=' ', header=None)\n+    parsed_df['filename'] = filename\n+    parsed_df['directory'] = parsed_df['filename'].apply(lambda fn: fn.split('_')[0])\n+\n+    return parsed_df\n+\n+def cp_files(filepaths_df, input_dir, output_dir): \n+    \"\"\"Copy over the files given by the attributes in the dataframe. \n+\n+    Args: \n+    -----\n+        filepaths_df: pandas DataFrame\n+            Holds 3 columns, each of which holds a piece that \n+            determines the input filepaths. We'll copy the files \n+            at these filepaths to the output_dir.\n+        input_dir: str\n+            Holds the first part of the input directory path, used \n+            for obtaining the full path pointing to the files to copy. \n+        output_dir: str\n+            Holds the directory of where to copy the file. \n+    \"\"\"\n+    \n+    # The video numbers are zero padded on the left. \n+    filepaths_df['vid_num'] = filepaths_df['frame'].astype(str).apply(lambda \n+            frame: frame.zfill(8))\n+\n+    # Need to replace the filename ext. in the DataFrame with `.jpg` and \n+    # provide the full relative path point to what to move. \n+    filepaths_df['filename'] = filepaths_df['filename'].apply(lambda filename: \n+            filename.replace('.ann', ''))\n+    filepaths_df['input_filepath'] = input_dir + \\","path":"code/data_setup/parse_alov_bb.py","position":55,"original_position":55,"commit_id":"90ba115ec522e4840d83fb491a0ccaceea892db6","original_commit_id":"90ba115ec522e4840d83fb491a0ccaceea892db6","user":{"login":"dansbecker","id":1390442,"avatar_url":"https://avatars.githubusercontent.com/u/1390442?v=3","gravatar_id":"","url":"https://api.github.com/users/dansbecker","html_url":"https://github.com/dansbecker","followers_url":"https://api.github.com/users/dansbecker/followers","following_url":"https://api.github.com/users/dansbecker/following{/other_user}","gists_url":"https://api.github.com/users/dansbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/dansbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dansbecker/subscriptions","organizations_url":"https://api.github.com/users/dansbecker/orgs","repos_url":"https://api.github.com/users/dansbecker/repos","events_url":"https://api.github.com/users/dansbecker/events{/privacy}","received_events_url":"https://api.github.com/users/dansbecker/received_events","type":"User","site_admin":false},"body":"At the top of the file, I would add\r\n```\r\nfrom os.path import join\r\n```\r\n\r\nThen  this line becomes\r\n```\r\nfilepaths_df['input_filepath'] = join(input_dir, filepaths_df['directory_path'], filepaths_df['filename'], filepaths_df['vid_num']) + \".jpg\"\r\n\r\n","created_at":"2016-04-28T13:24:13Z","updated_at":"2016-04-28T13:24:13Z","html_url":"https://github.com/dansbecker/motion-tracking/pull/10#discussion_r61425574","pull_request_url":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/comments/61425574"},"html":{"href":"https://github.com/dansbecker/motion-tracking/pull/10#discussion_r61425574"},"pull_request":{"href":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/10","id":68124638,"html_url":"https://github.com/dansbecker/motion-tracking/pull/10","diff_url":"https://github.com/dansbecker/motion-tracking/pull/10.diff","patch_url":"https://github.com/dansbecker/motion-tracking/pull/10.patch","issue_url":"https://api.github.com/repos/dansbecker/motion-tracking/issues/10","number":10,"state":"open","locked":false,"title":"Python alov parse port","user":{"login":"sallamander","id":12429170,"avatar_url":"https://avatars.githubusercontent.com/u/12429170?v=3","gravatar_id":"","url":"https://api.github.com/users/sallamander","html_url":"https://github.com/sallamander","followers_url":"https://api.github.com/users/sallamander/followers","following_url":"https://api.github.com/users/sallamander/following{/other_user}","gists_url":"https://api.github.com/users/sallamander/gists{/gist_id}","starred_url":"https://api.github.com/users/sallamander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sallamander/subscriptions","organizations_url":"https://api.github.com/users/sallamander/orgs","repos_url":"https://api.github.com/users/sallamander/repos","events_url":"https://api.github.com/users/sallamander/events{/privacy}","received_events_url":"https://api.github.com/users/sallamander/received_events","type":"User","site_admin":false},"body":"@dansbecker This is nearly done, too. I just need to add some functionality for actually copying/moving the right frames from one location to another. ","created_at":"2016-04-27T21:04:59Z","updated_at":"2016-04-28T13:24:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"68bf547da6ad3230d7ad344d9e403ff1092f0cfe","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/10/commits","review_comments_url":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/10/comments","review_comment_url":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dansbecker/motion-tracking/issues/10/comments","statuses_url":"https://api.github.com/repos/dansbecker/motion-tracking/statuses/90ba115ec522e4840d83fb491a0ccaceea892db6","head":{"label":"dansbecker:python_alov_parse_port","ref":"python_alov_parse_port","sha":"90ba115ec522e4840d83fb491a0ccaceea892db6","user":{"login":"dansbecker","id":1390442,"avatar_url":"https://avatars.githubusercontent.com/u/1390442?v=3","gravatar_id":"","url":"https://api.github.com/users/dansbecker","html_url":"https://github.com/dansbecker","followers_url":"https://api.github.com/users/dansbecker/followers","following_url":"https://api.github.com/users/dansbecker/following{/other_user}","gists_url":"https://api.github.com/users/dansbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/dansbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dansbecker/subscriptions","organizations_url":"https://api.github.com/users/dansbecker/orgs","repos_url":"https://api.github.com/users/dansbecker/repos","events_url":"https://api.github.com/users/dansbecker/events{/privacy}","received_events_url":"https://api.github.com/users/dansbecker/received_events","type":"User","site_admin":false},"repo":{"id":56811181,"name":"motion-tracking","full_name":"dansbecker/motion-tracking","owner":{"login":"dansbecker","id":1390442,"avatar_url":"https://avatars.githubusercontent.com/u/1390442?v=3","gravatar_id":"","url":"https://api.github.com/users/dansbecker","html_url":"https://github.com/dansbecker","followers_url":"https://api.github.com/users/dansbecker/followers","following_url":"https://api.github.com/users/dansbecker/following{/other_user}","gists_url":"https://api.github.com/users/dansbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/dansbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dansbecker/subscriptions","organizations_url":"https://api.github.com/users/dansbecker/orgs","repos_url":"https://api.github.com/users/dansbecker/repos","events_url":"https://api.github.com/users/dansbecker/events{/privacy}","received_events_url":"https://api.github.com/users/dansbecker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dansbecker/motion-tracking","description":"Inspired by http://arxiv.org/pdf/1604.01802v1.pdf","fork":false,"url":"https://api.github.com/repos/dansbecker/motion-tracking","forks_url":"https://api.github.com/repos/dansbecker/motion-tracking/forks","keys_url":"https://api.github.com/repos/dansbecker/motion-tracking/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dansbecker/motion-tracking/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dansbecker/motion-tracking/teams","hooks_url":"https://api.github.com/repos/dansbecker/motion-tracking/hooks","issue_events_url":"https://api.github.com/repos/dansbecker/motion-tracking/issues/events{/number}","events_url":"https://api.github.com/repos/dansbecker/motion-tracking/events","assignees_url":"https://api.github.com/repos/dansbecker/motion-tracking/assignees{/user}","branches_url":"https://api.github.com/repos/dansbecker/motion-tracking/branches{/branch}","tags_url":"https://api.github.com/repos/dansbecker/motion-tracking/tags","blobs_url":"https://api.github.com/repos/dansbecker/motion-tracking/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dansbecker/motion-tracking/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dansbecker/motion-tracking/git/refs{/sha}","trees_url":"https://api.github.com/repos/dansbecker/motion-tracking/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dansbecker/motion-tracking/statuses/{sha}","languages_url":"https://api.github.com/repos/dansbecker/motion-tracking/languages","stargazers_url":"https://api.github.com/repos/dansbecker/motion-tracking/stargazers","contributors_url":"https://api.github.com/repos/dansbecker/motion-tracking/contributors","subscribers_url":"https://api.github.com/repos/dansbecker/motion-tracking/subscribers","subscription_url":"https://api.github.com/repos/dansbecker/motion-tracking/subscription","commits_url":"https://api.github.com/repos/dansbecker/motion-tracking/commits{/sha}","git_commits_url":"https://api.github.com/repos/dansbecker/motion-tracking/git/commits{/sha}","comments_url":"https://api.github.com/repos/dansbecker/motion-tracking/comments{/number}","issue_comment_url":"https://api.github.com/repos/dansbecker/motion-tracking/issues/comments{/number}","contents_url":"https://api.github.com/repos/dansbecker/motion-tracking/contents/{+path}","compare_url":"https://api.github.com/repos/dansbecker/motion-tracking/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dansbecker/motion-tracking/merges","archive_url":"https://api.github.com/repos/dansbecker/motion-tracking/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dansbecker/motion-tracking/downloads","issues_url":"https://api.github.com/repos/dansbecker/motion-tracking/issues{/number}","pulls_url":"https://api.github.com/repos/dansbecker/motion-tracking/pulls{/number}","milestones_url":"https://api.github.com/repos/dansbecker/motion-tracking/milestones{/number}","notifications_url":"https://api.github.com/repos/dansbecker/motion-tracking/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dansbecker/motion-tracking/labels{/name}","releases_url":"https://api.github.com/repos/dansbecker/motion-tracking/releases{/id}","deployments_url":"https://api.github.com/repos/dansbecker/motion-tracking/deployments","created_at":"2016-04-21T23:14:58Z","updated_at":"2016-04-25T17:11:19Z","pushed_at":"2016-04-28T12:07:07Z","git_url":"git://github.com/dansbecker/motion-tracking.git","ssh_url":"git@github.com:dansbecker/motion-tracking.git","clone_url":"https://github.com/dansbecker/motion-tracking.git","svn_url":"https://github.com/dansbecker/motion-tracking","homepage":null,"size":27,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":2,"default_branch":"master"}},"base":{"label":"dansbecker:master","ref":"master","sha":"fcb14790eb0b776a98923a7fdd3619b274ab7214","user":{"login":"dansbecker","id":1390442,"avatar_url":"https://avatars.githubusercontent.com/u/1390442?v=3","gravatar_id":"","url":"https://api.github.com/users/dansbecker","html_url":"https://github.com/dansbecker","followers_url":"https://api.github.com/users/dansbecker/followers","following_url":"https://api.github.com/users/dansbecker/following{/other_user}","gists_url":"https://api.github.com/users/dansbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/dansbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dansbecker/subscriptions","organizations_url":"https://api.github.com/users/dansbecker/orgs","repos_url":"https://api.github.com/users/dansbecker/repos","events_url":"https://api.github.com/users/dansbecker/events{/privacy}","received_events_url":"https://api.github.com/users/dansbecker/received_events","type":"User","site_admin":false},"repo":{"id":56811181,"name":"motion-tracking","full_name":"dansbecker/motion-tracking","owner":{"login":"dansbecker","id":1390442,"avatar_url":"https://avatars.githubusercontent.com/u/1390442?v=3","gravatar_id":"","url":"https://api.github.com/users/dansbecker","html_url":"https://github.com/dansbecker","followers_url":"https://api.github.com/users/dansbecker/followers","following_url":"https://api.github.com/users/dansbecker/following{/other_user}","gists_url":"https://api.github.com/users/dansbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/dansbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dansbecker/subscriptions","organizations_url":"https://api.github.com/users/dansbecker/orgs","repos_url":"https://api.github.com/users/dansbecker/repos","events_url":"https://api.github.com/users/dansbecker/events{/privacy}","received_events_url":"https://api.github.com/users/dansbecker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dansbecker/motion-tracking","description":"Inspired by http://arxiv.org/pdf/1604.01802v1.pdf","fork":false,"url":"https://api.github.com/repos/dansbecker/motion-tracking","forks_url":"https://api.github.com/repos/dansbecker/motion-tracking/forks","keys_url":"https://api.github.com/repos/dansbecker/motion-tracking/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dansbecker/motion-tracking/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dansbecker/motion-tracking/teams","hooks_url":"https://api.github.com/repos/dansbecker/motion-tracking/hooks","issue_events_url":"https://api.github.com/repos/dansbecker/motion-tracking/issues/events{/number}","events_url":"https://api.github.com/repos/dansbecker/motion-tracking/events","assignees_url":"https://api.github.com/repos/dansbecker/motion-tracking/assignees{/user}","branches_url":"https://api.github.com/repos/dansbecker/motion-tracking/branches{/branch}","tags_url":"https://api.github.com/repos/dansbecker/motion-tracking/tags","blobs_url":"https://api.github.com/repos/dansbecker/motion-tracking/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dansbecker/motion-tracking/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dansbecker/motion-tracking/git/refs{/sha}","trees_url":"https://api.github.com/repos/dansbecker/motion-tracking/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dansbecker/motion-tracking/statuses/{sha}","languages_url":"https://api.github.com/repos/dansbecker/motion-tracking/languages","stargazers_url":"https://api.github.com/repos/dansbecker/motion-tracking/stargazers","contributors_url":"https://api.github.com/repos/dansbecker/motion-tracking/contributors","subscribers_url":"https://api.github.com/repos/dansbecker/motion-tracking/subscribers","subscription_url":"https://api.github.com/repos/dansbecker/motion-tracking/subscription","commits_url":"https://api.github.com/repos/dansbecker/motion-tracking/commits{/sha}","git_commits_url":"https://api.github.com/repos/dansbecker/motion-tracking/git/commits{/sha}","comments_url":"https://api.github.com/repos/dansbecker/motion-tracking/comments{/number}","issue_comment_url":"https://api.github.com/repos/dansbecker/motion-tracking/issues/comments{/number}","contents_url":"https://api.github.com/repos/dansbecker/motion-tracking/contents/{+path}","compare_url":"https://api.github.com/repos/dansbecker/motion-tracking/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dansbecker/motion-tracking/merges","archive_url":"https://api.github.com/repos/dansbecker/motion-tracking/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dansbecker/motion-tracking/downloads","issues_url":"https://api.github.com/repos/dansbecker/motion-tracking/issues{/number}","pulls_url":"https://api.github.com/repos/dansbecker/motion-tracking/pulls{/number}","milestones_url":"https://api.github.com/repos/dansbecker/motion-tracking/milestones{/number}","notifications_url":"https://api.github.com/repos/dansbecker/motion-tracking/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dansbecker/motion-tracking/labels{/name}","releases_url":"https://api.github.com/repos/dansbecker/motion-tracking/releases{/id}","deployments_url":"https://api.github.com/repos/dansbecker/motion-tracking/deployments","created_at":"2016-04-21T23:14:58Z","updated_at":"2016-04-25T17:11:19Z","pushed_at":"2016-04-28T12:07:07Z","git_url":"git://github.com/dansbecker/motion-tracking.git","ssh_url":"git@github.com:dansbecker/motion-tracking.git","clone_url":"https://github.com/dansbecker/motion-tracking.git","svn_url":"https://github.com/dansbecker/motion-tracking","homepage":null,"size":27,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/10"},"html":{"href":"https://github.com/dansbecker/motion-tracking/pull/10"},"issue":{"href":"https://api.github.com/repos/dansbecker/motion-tracking/issues/10"},"comments":{"href":"https://api.github.com/repos/dansbecker/motion-tracking/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dansbecker/motion-tracking/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/dansbecker/motion-tracking/statuses/90ba115ec522e4840d83fb491a0ccaceea892db6"}}}}