{"action":"created","comment":{"url":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/comments/61156116","id":61156116,"diff_hunk":"@@ -80,107 +140,142 @@ int main(int argc, char *argv[]) {\n   typedef kaldi::int64 int64;\n   try {\n     const char *usage =\n-        \"Extract iVectors for utterances, using a trained iVector extractor,\\n\"\n-        \"and features and Gaussian-level posteriors\\n\"\n-        \"Usage:  ivector-extract [options] <model-in> <feature-rspecifier> \"\n-        \"<posteriors-rspecifier> <ivector-wspecifier>\\n\"\n+        \"Extract iVectors for sessions using a sliding window over segments,\\n\"\n+\t\"using a trained iVector extractor and features and Gaussian-level posteriors\\n\"\n+        \"Usage:  ivector-extract [options] <model-in> <segments-rxfilename> <feature-rspecifier> \"\n+        \"<posteriors-rspecifier> <ivector-wspecifier> <ivector-ranges-wspecifier> <ivector-weights-wspecifier>\\n\"\n         \"e.g.: \\n\"\n         \" fgmm-global-gselect-to-post 1.ubm '$feats' 'ark:gunzip -c gselect.1.gz|' ark:- | \\\\\\n\"\n-        \"  ivector-extract final.ie '$feats' ark,s,cs:- ark,t:ivectors.1.ark\\n\";\n+        \"  ivector-extract-dense final.ie segments '$feats' ark,s,cs:- ark,t:ivectors.1.ark \\\\\\n\"\n+\t\"   ark,t:ivector_ranges.1.ark ark,t:ivector_weights.1.ark\\n\";\n \n     ParseOptions po(usage);\n     bool compute_objf_change = true;\n     int32 chunk_size = 100,\n \t  period = 50;\n+    double frame_shift = 0.01;\n     IvectorEstimationOptions opts;\n     TaskSequencerConfig sequencer_config;\n     po.Register(\"compute-objf-change\", &compute_objf_change,\n                 \"If true, compute the change in objective function from using \"\n                 \"nonzero iVector (a potentially useful diagnostic).  Combine \"\n                 \"with --verbose=2 for per-utterance information\");\n     po.Register(\"chunk-size\", &chunk_size,\n-\t\t\"Todo\");\n+\t\t\"Size of the sliding window in frames.\");\n     po.Register(\"period\", &period,\n-\t\t\"Todo\");\n+\t\t\"Offset of each window in frames.\");\n+    po.Register(\"frame-shift\", &frame_shift,\n+\t\t\"With of frames. Used to compute ivector ranges.\");\n     \n     opts.Register(&po);\n     sequencer_config.Register(&po);\n     \n     po.Read(argc, argv);\n     \n-    if (po.NumArgs() != 4) {\n+    if (po.NumArgs() != 7) {\n       po.PrintUsage();\n       exit(1);\n     }\n \n     std::string ivector_extractor_rxfilename = po.GetArg(1),\n-        feature_rspecifier = po.GetArg(2),\n-        posterior_rspecifier = po.GetArg(3),\n-        ivectors_wspecifier = po.GetArg(4);\n-\n-\n-    // g_num_threads affects how ComputeDerivedVars is called when we read the\n-    // extractor.\n-    g_num_threads = sequencer_config.num_threads; \n-    IvectorExtractor extractor;\n-    ReadKaldiObject(ivector_extractor_rxfilename, &extractor);\n+\tsegments_rxfilename = po.GetArg(2),\n+        feature_rspecifier = po.GetArg(3),\n+        posterior_rspecifier = po.GetArg(4),\n+        ivectors_wspecifier = po.GetArg(5),\n+\tivector_ranges_wspecifier = po.GetArg(6),\n+\tivector_weights_wspecifier = po.GetArg(7);\n \n     double tot_auxf_change = 0.0, tot_t = 0.0;\n     int32 num_done = 0, num_err = 0;\n+    \n+    IvectorExtractor extractor;\n+    ReadKaldiObject(ivector_extractor_rxfilename, &extractor);\n   \n-    SequentialBaseFloatMatrixReader feature_reader(feature_rspecifier);\n+    unordered_map<std::string, std::vector<Segments*> > record2seg;\n+    PrepareSegments(segments_rxfilename, &record2seg);\n+\n+    RandomAccessBaseFloatMatrixReader feature_reader(feature_rspecifier);\n     RandomAccessPosteriorReader posterior_reader(posterior_rspecifier);\n     BaseFloatMatrixWriter ivectors_writer(ivectors_wspecifier);\n-  \n-    for (; !feature_reader.Done(); feature_reader.Next()) {\n-      std::string utt = feature_reader.Key();\n-      if (!posterior_reader.HasKey(utt)) {\n-        KALDI_WARN << \"No posteriors for utterance \" << utt;\n-        num_err++;\n-        continue;\n-      }\n-      const Matrix<BaseFloat> &mat = feature_reader.Value();\n-      Posterior posterior = posterior_reader.Value(utt);\n+    TokenVectorWriter ivector_ranges_writer(ivector_ranges_wspecifier);\n+    TokenVectorWriter ivector_weights_writer(ivector_weights_wspecifier);","path":"src/ivectorbin/ivector-extract-dense.cc","position":168,"original_position":168,"commit_id":"5a02eb22b5f9cb99590bf75321bfc6b82761f827","original_commit_id":"5a02eb22b5f9cb99590bf75321bfc6b82761f827","user":{"login":"david-ryan-snyder","id":5439976,"avatar_url":"https://avatars.githubusercontent.com/u/5439976?v=3","gravatar_id":"","url":"https://api.github.com/users/david-ryan-snyder","html_url":"https://github.com/david-ryan-snyder","followers_url":"https://api.github.com/users/david-ryan-snyder/followers","following_url":"https://api.github.com/users/david-ryan-snyder/following{/other_user}","gists_url":"https://api.github.com/users/david-ryan-snyder/gists{/gist_id}","starred_url":"https://api.github.com/users/david-ryan-snyder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-ryan-snyder/subscriptions","organizations_url":"https://api.github.com/users/david-ryan-snyder/orgs","repos_url":"https://api.github.com/users/david-ryan-snyder/repos","events_url":"https://api.github.com/users/david-ryan-snyder/events{/privacy}","received_events_url":"https://api.github.com/users/david-ryan-snyder/received_events","type":"User","site_admin":false},"body":"See if you can make the weights writer a BaseFloatWriter","created_at":"2016-04-26T20:15:32Z","updated_at":"2016-04-26T20:15:32Z","html_url":"https://github.com/david-ryan-snyder/kaldi/pull/7#discussion_r61156116","pull_request_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/comments/61156116"},"html":{"href":"https://github.com/david-ryan-snyder/kaldi/pull/7#discussion_r61156116"},"pull_request":{"href":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/7","id":67944824,"html_url":"https://github.com/david-ryan-snyder/kaldi/pull/7","diff_url":"https://github.com/david-ryan-snyder/kaldi/pull/7.diff","patch_url":"https://github.com/david-ryan-snyder/kaldi/pull/7.patch","issue_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/issues/7","number":7,"state":"open","locked":false,"title":"ivector-extract-dense.cc now functions as specified","user":{"login":"mmaciej2","id":16909404,"avatar_url":"https://avatars.githubusercontent.com/u/16909404?v=3","gravatar_id":"","url":"https://api.github.com/users/mmaciej2","html_url":"https://github.com/mmaciej2","followers_url":"https://api.github.com/users/mmaciej2/followers","following_url":"https://api.github.com/users/mmaciej2/following{/other_user}","gists_url":"https://api.github.com/users/mmaciej2/gists{/gist_id}","starred_url":"https://api.github.com/users/mmaciej2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmaciej2/subscriptions","organizations_url":"https://api.github.com/users/mmaciej2/orgs","repos_url":"https://api.github.com/users/mmaciej2/repos","events_url":"https://api.github.com/users/mmaciej2/events{/privacy}","received_events_url":"https://api.github.com/users/mmaciej2/received_events","type":"User","site_admin":false},"body":"This now functions as specified. It outputs session-level matrices of ivectors that have been extracted over sliding windows of the segments listed in the segments file. In addition, it outputs \"ivector_ranges\" that are the start and end times of each ivector extracted from a session and \"ivector_weights\" which are the number of frames used for each ivector.","created_at":"2016-04-26T19:35:01Z","updated_at":"2016-04-26T20:15:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"630091250c94ed5eb615a2b74b365dbe58d08a34","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/7/commits","review_comments_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/7/comments","review_comment_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/issues/7/comments","statuses_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/statuses/5a02eb22b5f9cb99590bf75321bfc6b82761f827","head":{"label":"mmaciej2:kaldi-diarization","ref":"kaldi-diarization","sha":"5a02eb22b5f9cb99590bf75321bfc6b82761f827","user":{"login":"mmaciej2","id":16909404,"avatar_url":"https://avatars.githubusercontent.com/u/16909404?v=3","gravatar_id":"","url":"https://api.github.com/users/mmaciej2","html_url":"https://github.com/mmaciej2","followers_url":"https://api.github.com/users/mmaciej2/followers","following_url":"https://api.github.com/users/mmaciej2/following{/other_user}","gists_url":"https://api.github.com/users/mmaciej2/gists{/gist_id}","starred_url":"https://api.github.com/users/mmaciej2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmaciej2/subscriptions","organizations_url":"https://api.github.com/users/mmaciej2/orgs","repos_url":"https://api.github.com/users/mmaciej2/repos","events_url":"https://api.github.com/users/mmaciej2/events{/privacy}","received_events_url":"https://api.github.com/users/mmaciej2/received_events","type":"User","site_admin":false},"repo":{"id":55438119,"name":"kaldi","full_name":"mmaciej2/kaldi","owner":{"login":"mmaciej2","id":16909404,"avatar_url":"https://avatars.githubusercontent.com/u/16909404?v=3","gravatar_id":"","url":"https://api.github.com/users/mmaciej2","html_url":"https://github.com/mmaciej2","followers_url":"https://api.github.com/users/mmaciej2/followers","following_url":"https://api.github.com/users/mmaciej2/following{/other_user}","gists_url":"https://api.github.com/users/mmaciej2/gists{/gist_id}","starred_url":"https://api.github.com/users/mmaciej2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmaciej2/subscriptions","organizations_url":"https://api.github.com/users/mmaciej2/orgs","repos_url":"https://api.github.com/users/mmaciej2/repos","events_url":"https://api.github.com/users/mmaciej2/events{/privacy}","received_events_url":"https://api.github.com/users/mmaciej2/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mmaciej2/kaldi","description":"This is now the official location of the Kaldi project.","fork":true,"url":"https://api.github.com/repos/mmaciej2/kaldi","forks_url":"https://api.github.com/repos/mmaciej2/kaldi/forks","keys_url":"https://api.github.com/repos/mmaciej2/kaldi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mmaciej2/kaldi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mmaciej2/kaldi/teams","hooks_url":"https://api.github.com/repos/mmaciej2/kaldi/hooks","issue_events_url":"https://api.github.com/repos/mmaciej2/kaldi/issues/events{/number}","events_url":"https://api.github.com/repos/mmaciej2/kaldi/events","assignees_url":"https://api.github.com/repos/mmaciej2/kaldi/assignees{/user}","branches_url":"https://api.github.com/repos/mmaciej2/kaldi/branches{/branch}","tags_url":"https://api.github.com/repos/mmaciej2/kaldi/tags","blobs_url":"https://api.github.com/repos/mmaciej2/kaldi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mmaciej2/kaldi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mmaciej2/kaldi/git/refs{/sha}","trees_url":"https://api.github.com/repos/mmaciej2/kaldi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mmaciej2/kaldi/statuses/{sha}","languages_url":"https://api.github.com/repos/mmaciej2/kaldi/languages","stargazers_url":"https://api.github.com/repos/mmaciej2/kaldi/stargazers","contributors_url":"https://api.github.com/repos/mmaciej2/kaldi/contributors","subscribers_url":"https://api.github.com/repos/mmaciej2/kaldi/subscribers","subscription_url":"https://api.github.com/repos/mmaciej2/kaldi/subscription","commits_url":"https://api.github.com/repos/mmaciej2/kaldi/commits{/sha}","git_commits_url":"https://api.github.com/repos/mmaciej2/kaldi/git/commits{/sha}","comments_url":"https://api.github.com/repos/mmaciej2/kaldi/comments{/number}","issue_comment_url":"https://api.github.com/repos/mmaciej2/kaldi/issues/comments{/number}","contents_url":"https://api.github.com/repos/mmaciej2/kaldi/contents/{+path}","compare_url":"https://api.github.com/repos/mmaciej2/kaldi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mmaciej2/kaldi/merges","archive_url":"https://api.github.com/repos/mmaciej2/kaldi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mmaciej2/kaldi/downloads","issues_url":"https://api.github.com/repos/mmaciej2/kaldi/issues{/number}","pulls_url":"https://api.github.com/repos/mmaciej2/kaldi/pulls{/number}","milestones_url":"https://api.github.com/repos/mmaciej2/kaldi/milestones{/number}","notifications_url":"https://api.github.com/repos/mmaciej2/kaldi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mmaciej2/kaldi/labels{/name}","releases_url":"https://api.github.com/repos/mmaciej2/kaldi/releases{/id}","deployments_url":"https://api.github.com/repos/mmaciej2/kaldi/deployments","created_at":"2016-04-04T19:17:11Z","updated_at":"2016-04-04T19:17:21Z","pushed_at":"2016-04-26T19:25:13Z","git_url":"git://github.com/mmaciej2/kaldi.git","ssh_url":"git@github.com:mmaciej2/kaldi.git","clone_url":"https://github.com/mmaciej2/kaldi.git","svn_url":"https://github.com/mmaciej2/kaldi","homepage":"http://kaldi-asr.org","size":101546,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"david-ryan-snyder:kaldi-diarization","ref":"kaldi-diarization","sha":"eeec20d99b18f3f9b369a275ebe1fd7fa32b9e86","user":{"login":"david-ryan-snyder","id":5439976,"avatar_url":"https://avatars.githubusercontent.com/u/5439976?v=3","gravatar_id":"","url":"https://api.github.com/users/david-ryan-snyder","html_url":"https://github.com/david-ryan-snyder","followers_url":"https://api.github.com/users/david-ryan-snyder/followers","following_url":"https://api.github.com/users/david-ryan-snyder/following{/other_user}","gists_url":"https://api.github.com/users/david-ryan-snyder/gists{/gist_id}","starred_url":"https://api.github.com/users/david-ryan-snyder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-ryan-snyder/subscriptions","organizations_url":"https://api.github.com/users/david-ryan-snyder/orgs","repos_url":"https://api.github.com/users/david-ryan-snyder/repos","events_url":"https://api.github.com/users/david-ryan-snyder/events{/privacy}","received_events_url":"https://api.github.com/users/david-ryan-snyder/received_events","type":"User","site_admin":false},"repo":{"id":40438658,"name":"kaldi","full_name":"david-ryan-snyder/kaldi","owner":{"login":"david-ryan-snyder","id":5439976,"avatar_url":"https://avatars.githubusercontent.com/u/5439976?v=3","gravatar_id":"","url":"https://api.github.com/users/david-ryan-snyder","html_url":"https://github.com/david-ryan-snyder","followers_url":"https://api.github.com/users/david-ryan-snyder/followers","following_url":"https://api.github.com/users/david-ryan-snyder/following{/other_user}","gists_url":"https://api.github.com/users/david-ryan-snyder/gists{/gist_id}","starred_url":"https://api.github.com/users/david-ryan-snyder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david-ryan-snyder/subscriptions","organizations_url":"https://api.github.com/users/david-ryan-snyder/orgs","repos_url":"https://api.github.com/users/david-ryan-snyder/repos","events_url":"https://api.github.com/users/david-ryan-snyder/events{/privacy}","received_events_url":"https://api.github.com/users/david-ryan-snyder/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/david-ryan-snyder/kaldi","description":"This is now the official location of the Kaldi project.","fork":true,"url":"https://api.github.com/repos/david-ryan-snyder/kaldi","forks_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/forks","keys_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/teams","hooks_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/hooks","issue_events_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/issues/events{/number}","events_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/events","assignees_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/assignees{/user}","branches_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/branches{/branch}","tags_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/tags","blobs_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/git/refs{/sha}","trees_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/statuses/{sha}","languages_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/languages","stargazers_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/stargazers","contributors_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/contributors","subscribers_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/subscribers","subscription_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/subscription","commits_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/commits{/sha}","git_commits_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/git/commits{/sha}","comments_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/comments{/number}","issue_comment_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/issues/comments{/number}","contents_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/contents/{+path}","compare_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/merges","archive_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/downloads","issues_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/issues{/number}","pulls_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls{/number}","milestones_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/milestones{/number}","notifications_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/labels{/name}","releases_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/releases{/id}","deployments_url":"https://api.github.com/repos/david-ryan-snyder/kaldi/deployments","created_at":"2015-08-09T14:16:59Z","updated_at":"2015-12-07T07:32:09Z","pushed_at":"2016-04-26T19:35:01Z","git_url":"git://github.com/david-ryan-snyder/kaldi.git","ssh_url":"git@github.com:david-ryan-snyder/kaldi.git","clone_url":"https://github.com/david-ryan-snyder/kaldi.git","svn_url":"https://github.com/david-ryan-snyder/kaldi","homepage":"http://kaldi-asr.org","size":101532,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/7"},"html":{"href":"https://github.com/david-ryan-snyder/kaldi/pull/7"},"issue":{"href":"https://api.github.com/repos/david-ryan-snyder/kaldi/issues/7"},"comments":{"href":"https://api.github.com/repos/david-ryan-snyder/kaldi/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/david-ryan-snyder/kaldi/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/david-ryan-snyder/kaldi/statuses/5a02eb22b5f9cb99590bf75321bfc6b82761f827"}}}}