{"id":26373,"date":"2025-05-15T18:02:46","date_gmt":"2025-05-15T10:02:46","guid":{"rendered":"http:\/\/139.9.1.231\/?p=26373"},"modified":"2025-05-28T15:33:50","modified_gmt":"2025-05-28T07:33:50","slug":"ctc-forced_align","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2025\/05\/15\/ctc-forced_align\/","title":{"rendered":"CTC \u5f3a\u5236\u5bf9\u9f50-\u97f3\u9891\u548c\u6587\u672c"},"content":{"rendered":"\n<ul class=\"has-light-pink-background-color has-background\"><li><strong><em>https:\/\/github.com\/SpeechColab\/GigaSpeech2\/tree\/main\/pipeline\/force_alignment<\/em><\/strong><\/li><li><strong><em>https:\/\/github.com\/MahmoudAshraf97\/ctc-forced-aligner\/<\/em><\/strong><\/li><li><strong><em>https:\/\/github.com\/facebookresearch\/fairseq\/tree\/main\/examples\/mms\/data_prep<\/em><\/strong><\/li><li><strong><em><a href=\"https:\/\/pytorch.ac.cn\/audio\/stable\/tutorials\/ctc_forced_alignment_api_tutorial.html\">https:\/\/pytorch.ac.cn\/audio\/stable\/tutorials\/ctc_forced_alignment_api_tutorial.html<\/a><\/em><\/strong><\/li><\/ul>\n\n\n\n<h2>CTC\u7b97\u6cd5<\/h2>\n\n\n\n<p>CTC\u7b97\u6cd5\u7684\u5173\u952e\u5728\u4e8e\u4f7f\u7528\u4e00\u4e2a\u7279\u6b8a\u7684\u6807\u8bb0\uff0c\u901a\u5e38\u79f0\u4e3a<strong>\u7a7a\u767d\u6807\u8bb0<\/strong>\uff08blank token\uff09\u3002\u8fd9\u662f\u4e00\u4e2a\u6211\u4eec\u4eba\u4e3a\u52a0\u5165\u8bcd\u6c47\u8868\u7684\u989d\u5916\u6807\u8bb0\u3002\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u7a7a\u767d\u6807\u8bb0\u88ab\u8868\u793a\u4e3a<code>_<\/code>\u3002\u6211\u4eec\u7528\u8fd9\u4e2a\u7279\u6b8a\u7684\u6807\u8bb0\u6765\u8868\u793a\u5b57\u6bcd\u7ec4\u4e4b\u95f4\u7684\u786c\u8fb9\u754c\u3002<\/p>\n\n\n\n<p>CTC\u6a21\u578b\u7684\u5b8c\u6574\u8f93\u51fa\u7c7b\u4f3c\u4e8e\u5982\u4e0b\u7684\u5e8f\u5217\uff1aCopied<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">B_R_II_O_N_||_S_AWW_|||||_S_OMEE_TH_ING_||_C_L_O_S_E||TO|_P_A_N_I_C_||_ON||HHI_S||_OP_P_O_N_EN_T_'SS||_F_AA_C_E||_W_H_EN||THE||M_A_NN_||||_F_I_N_AL_LL_Y||||_RREE_C_O_GG_NN_II_Z_ED|||HHISS|||_ER_RRR_ORR||||<\/pre>\n\n\n\n<p>\u8be5\u5e8f\u5217\u4e2d\u7684<code>|<\/code>\u6807\u8bb0\u662f\u5355\u8bcd\u5206\u9694\u7b26\u3002\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u4f7f\u7528<code>|<\/code>\u800c\u4e0d\u662f\u7a7a\u683c\u4f5c\u4e3a\u5355\u8bcd\u5206\u9694\u7b26\uff0c\u8fd9\u6837\u53ef\u4ee5\u66f4\u5bb9\u6613\u5730\u770b\u51fa\u5355\u8bcd\u7684\u5206\u9694\u4f4d\u7f6e\uff0c\u4f46\u5b83\u4eec\u7684\u4f5c\u7528\u662f\u4e00\u6837\u7684\u3002<\/p>\n\n\n\n<p>CTC\u7a7a\u767d\u6807\u8bb0\u4f7f\u6211\u4eec\u80fd\u591f\u8fc7\u6ee4\u6389\u91cd\u590d\u7684\u5b57\u6bcd\u3002\u4f8b\u5982\u9884\u6d4b\u5e8f\u5217\u4e2d\u7684\u6700\u540e\u4e00\u4e2a\u5355\u8bcd\uff0c<code>_ER_RRR_ORR<\/code>\u3002\u5982\u679c\u6ca1\u6709CTC\u7a7a\u767d\u6807\u8bb0\uff0c\u8fd9\u4e2a\u5355\u8bcd\u770b\u8d77\u6765\u662f\u8fd9\u6837\u7684\uff1aCopied<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ERRRRORR<\/pre>\n\n\n\n<p>\u5982\u679c\u6211\u4eec\u7b80\u5355\u5730\u53bb\u6389\u975eCTC\u7ed3\u679c\u4e2d\u7684\u91cd\u590d\u5b57\u7b26\uff0c\u90a3\u4e48\u5b83\u5c31\u53d8\u6210\u4e86<code>EROR<\/code>\u3002\u663e\u7136\u8fd9\u4e0d\u662f\u6b63\u786e\u7684\u62fc\u5199\u3002\u4f46\u662f\u6709\u4e86CTC\u7a7a\u767d\u6807\u8bb0\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u5728\u6bcf\u4e2a\u5b57\u6bcd\u7ec4\u4e2d\u53bb\u6389\u91cd\u590d\u7684\u5b57\u6bcd\uff1aCopied<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">_ER_RRR_ORR<\/pre>\n\n\n\n<p>\u53d8\u4e3a\uff1aCopied<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">_ER_R_OR<\/pre>\n\n\n\n<p>\u6700\u540e\u6211\u4eec\u53bb\u6389\u7a7a\u767d\u6807\u8bb0<code>_<\/code>\uff0c\u5f97\u5230\u6700\u7ec8\u7684\u5355\u8bcd\uff1aCopied<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ERROR<\/pre>\n\n\n\n<p>\u5982\u679c\u6211\u4eec\u5c06\u8fd9\u79cd\u903b\u8f91\u5e94\u7528\u5230\u6574\u4e2a\u6587\u672c\uff0c\u5305\u62ec<code>|<\/code>\uff0c\u5e76\u5c06\u5269\u4f59\u7684<code>|<\/code>\u5b57\u7b26\u66ff\u6362\u4e3a\u7a7a\u683c\uff0c\u90a3\u4e48\u6700\u7ec8\u7684CTC\u89e3\u7801\u8f93\u51fa\u4f1a\u53d8\u6210\uff1aCopied<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">BRION SAW SOMETHING CLOSE TO PANIC ON HIS OPPONENT'S FACE WHEN THE MAN FINALLY RECOGNIZED HIS ERROR<\/pre>\n\n\n\n<p>\u603b\u7ed3\u4e00\u4e0b\uff0cCTC\u6a21\u578b\u5bf9\u5e94\u6bcf20\u6beb\u79d2\u7684\u8f93\u5165\u97f3\u9891\uff08\u5305\u62ec\u90e8\u5206\u91cd\u53e0\uff09\u4f1a\u751f\u6210\u4e00\u4e2a\u9884\u6d4b\u6807\u8bb0\u3002\u8fd9\u6837\u7684\u9884\u6d4b\u89c4\u5219\u4f1a\u751f\u6210\u5f88\u591a\u91cd\u590d\u7684\u5b57\u6bcd\u3002\u5229\u7528CTC\u7a7a\u767d\u6807\u8bb0\uff0c\u6211\u4eec\u53ef\u4ee5\u8f7b\u677e\u5730\u79fb\u9664\u8fd9\u4e9b\u91cd\u590d\u7684\u5b57\u6bcd\uff0c\u800c\u4e0d\u4f1a\u7834\u574f\u5355\u8bcd\u7684\u6b63\u786e\u62fc\u5199\u3002\u8fd9\u662f\u4e00\u79cd\u975e\u5e38\u7b80\u5355\u548c\u65b9\u4fbf\u7684\u65b9\u6cd5\uff0c\u53ef\u4ee5\u89e3\u51b3\u8f93\u51fa\u6587\u672c\u4e0e\u8f93\u5165\u97f3\u9891\u7684\u5bf9\u9f50\u95ee\u9898\u3002\ud83d\udca1 \u5728\u5b9e\u9645\u7684Wav2Vec2\u6a21\u578b\u4e2d\uff0cCTC\u7a7a\u767d\u6807\u8bb0\u4e0e\u586b\u5145\u6807\u8bb0&#8220;\u662f\u76f8\u540c\u7684\u3002\u6a21\u578b\u4f1a\u9884\u6d4b\u5f88\u591a\u8fd9\u6837\u7684&#8220;\u6807\u8bb0\uff0c\u4f8b\u5982\u5f53\u5f53\u524d20\u6beb\u79d2\u7684\u97f3\u9891\u6ca1\u6709\u660e\u786e\u7684\u5b57\u7b26\u53ef\u4ee5\u9884\u6d4b\u65f6\u3002\u4f7f\u7528\u76f8\u540c\u7684\u6807\u8bb0\u4f5c\u4e3a\u586b\u5145\u548cCTC\u7a7a\u767d\u6807\u8bb0\u53ef\u4ee5\u7b80\u5316\u89e3\u7801\u7b97\u6cd5\uff0c\u5e76\u6709\u52a9\u4e8e\u4fdd\u6301\u8bcd\u6c47\u8868\u7684\u5c0f\u89c4\u6a21\u3002<\/p>\n\n\n\n<p>\u6211\u4eec\u53ef\u4ee5\u5728Transomer\u7f16\u7801\u6a21\u578b\u7b80\u5355\u5730\u52a0\u5165CTC\uff1a\u5c06\u7f16\u7801\u5668\u7684\u8f93\u51fa\u5e8f\u5217\u8fdb\u5165\u4e00\u4e2a\u7ebf\u6027\u5c42\uff0c\u8be5\u7ebf\u6027\u5c42\u5c06\u97f3\u9891\u7279\u5f81\u6620\u5c04\u5230\u8bcd\u6c47\u8868\u3002\u6a21\u578b\u4f7f\u7528\u7279\u6b8a\u7684CTC\u635f\u5931\u8fdb\u884c\u8bad\u7ec3\u3002<\/p>\n\n\n\n<p>CTC\u7684\u4e00\u4e2a\u7f3a\u70b9\u5728\u4e8e\uff0c\u5b83\u53ef\u80fd\u4f1a\u8f93\u51fa<em>\u542c\u8d77\u6765<\/em>\u6b63\u786e\u4f46<em>\u62fc\u5199<\/em>\u4e0d\u6b63\u786e\u7684\u5355\u8bcd\u3002\u6bd5\u7adf\uff0cCTC\u5206\u7c7b\u5934\u53ea\u8003\u8651\u4e86\u5355\u4e2a\u5b57\u7b26\uff0c\u800c\u6ca1\u6709\u5904\u7406\u6574\u4e2a\u5355\u8bcd\u3002\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u989d\u5916\u7684\u8bed\u8a00\u6a21\u578b\u6765\u63d0\u9ad8\u97f3\u9891\u7684\u8f6c\u5f55\u8d28\u91cf\u3002\u8fd9\u4e2a\u8bed\u8a00\u6a21\u578b\u5b9e\u9645\u4e0a\u662f\u4f5c\u4e3a\u4e86CTC\u8f93\u51fa\u7684\u62fc\u5199\u68c0\u67e5\u5668\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>CTC\uff08Connectionist Temporal Classification\uff09\u5f3a\u5236\u5bf9\u9f50\u662f\u4e00\u79cd\u5c06\u97f3\u9891\u4e0e\u5df2\u77e5\u6587\u672c\u7cbe\u786e\u5bf9\u9f50\u7684\u6280\u672f\uff0c\u5e7f\u6cdb\u5e94\u7528\u4e8e\u81ea\u52a8\u5b57\u5e55\u751f\u6210\u3001\u8bed\u97f3\u5207\u5206\u3001\u8bed\u97f3\u5408\u6210\u7b49\u9886\u57df\u3002\u5176\u6838\u5fc3\u539f\u7406\u7ed3\u5408\u4e86\u58f0\u5b66\u6a21\u578b\u7684\u8f93\u51fa\u548c\u52a8\u6001\u89c4\u5212\u7b97\u6cd5\uff08\u5982 Viterbi \u7b97\u6cd5\uff09\u6765\u5b9e\u73b0\u5b57\u7ea7\u522b\u7684\u65f6\u95f4\u6233\u5bf9\u9f50\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2>\u6838\u5fc3\u539f\u7406<\/h2>\n\n\n\n<h3>1. <strong>\u8f93\u5165\u6570\u636e<\/strong><\/h3>\n\n\n\n<ul><li><strong>log_probs<\/strong>\uff1a\u6a21\u578b\u8f93\u51fa\u7684\u5bf9\u6570\u6982\u7387\u5f20\u91cf\uff0c\u5f62\u72b6\u4e3a <code>(B, T, C)<\/code>\uff0c\u5176\u4e2d\uff1a<ul><li><code>B<\/code>\uff1a\u6279\u6b21\u5927\u5c0f\uff08\u5f53\u524d\u4ec5\u652f\u6301 <code>B=1<\/code>\uff09\uff1b<\/li><li><code>T<\/code>\uff1a\u65f6\u95f4\u5e27\u6570\uff1b<\/li><li><code>C<\/code>\uff1a\u5b57\u7b26\u96c6\u5927\u5c0f\uff08\u5305\u62ec blank \u7b26\u53f7\uff09\u3002<\/li><\/ul><\/li><li><strong>targets<\/strong>\uff1a\u76ee\u6807\u6587\u672c\u7684\u7d22\u5f15\u5e8f\u5217\uff0c\u5f62\u72b6\u4e3a <code>(B, L)<\/code>\uff0c\u5176\u4e2d <code>L<\/code> \u4e3a\u76ee\u6807\u5e8f\u5217\u957f\u5ea6\u3002<\/li><li><strong>input_lengths<\/strong>\uff08\u53ef\u9009\uff09\uff1a\u8f93\u5165\u5e8f\u5217\u7684\u5b9e\u9645\u957f\u5ea6\u3002<\/li><li><strong>target_lengths<\/strong>\uff08\u53ef\u9009\uff09\uff1a\u76ee\u6807\u5e8f\u5217\u7684\u5b9e\u9645\u957f\u5ea6\u3002<\/li><li><strong>blank<\/strong>\uff1ablank \u7b26\u53f7\u7684\u7d22\u5f15\uff0c\u9ed8\u8ba4\u503c\u4e3a <code>0<\/code>\u3002<\/li><\/ul>\n\n\n\n<h3>2. <strong>\u5bf9\u9f50\u8fc7\u7a0b<\/strong><\/h3>\n\n\n\n<p><code>forced_align<\/code> \u51fd\u6570\u901a\u8fc7<strong>\u52a8\u6001\u89c4\u5212\u7b97\u6cd5\uff08\u5982 Viterbi\uff09<\/strong>\u5728<strong>\u6240\u6709\u53ef\u80fd\u7684\u5bf9\u9f50\u8def\u5f84\u4e2d\u5bfb\u627e\u6982\u7387\u6700\u9ad8\u7684\u8def\u5f84<\/strong>\u3002\u8be5\u7b97\u6cd5\u901a\u8fc7\u586b\u5145\u4e00\u4e2a\u5927\u5c0f\u4e3a <code>(S, T)<\/code> \u7684\u77e9\u9635\uff08\u5176\u4e2d <code>S<\/code> \u662f\u76ee\u6807\u5e8f\u5217\u957f\u5ea6\uff0c<code>T<\/code> \u662f\u65f6\u95f4\u5e27\u6570\uff09\uff0c\u5e76\u8bb0\u5f55\u6bcf\u4e2a\u72b6\u6001\u7684\u6700\u4f18\u524d\u9a71\uff0c\u4ee5\u4fbf\u5728\u586b\u5145\u5b8c\u6210\u540e\u56de\u6eaf\u5f97\u5230\u6700\u4f18\u8def\u5f84\u3002<\/p>\n\n\n\n<h3>3. <strong>\u8f93\u51fa\u7ed3\u679c<\/strong><\/h3>\n\n\n\n<ul><li class=\"\"><strong>alignment<\/strong>\uff1a\u6bcf\u4e2a\u65f6\u95f4\u6b65\u5bf9\u5e94\u7684\u6807\u7b7e\u7d22\u5f15\uff0c\u5f62\u72b6\u4e3a <code>(T,)<\/code>\u3002<\/li><li class=\"\"><strong>scores<\/strong>\uff1a\u6bcf\u4e2a\u65f6\u95f4\u6b65\u5bf9\u5e94\u6807\u7b7e\u7684\u5bf9\u6570\u6982\u7387\uff0c\u5f62\u72b6\u4e3a <code>(T,)<\/code>\u3002<\/li><\/ul>\n\n\n\n<p>\u901a\u8fc7\u8fd9\u4e9b\u8f93\u51fa\uff0c\u53ef\u4ee5\u786e\u5b9a\u6bcf\u4e2a\u5b57\u7b26\u5728\u97f3\u9891\u4e2d\u7684\u65f6\u95f4\u4f4d\u7f6e\uff0c\u5b9e\u73b0\u5b57\u7ea7\u522b\u7684\u5bf9\u9f50\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<h2>\ud83d\udd27 \u5b9e\u9645\u5e94\u7528<\/h2>\n\n\n\n<p>\u4e3a\u4e86\u7b80\u5316\u5f3a\u5236\u5bf9\u9f50\u7684\u6d41\u7a0b\uff0ctorchaudio \u63d0\u4f9b\u4e86\u9ad8\u7ea7 API <code>torchaudio.pipelines.Wav2Vec2FABundle<\/code>\uff0c\u8be5 API \u96c6\u6210\u4e86\u9884\u8bad\u7ec3\u7684 Wav2Vec2 \u6a21\u578b\u548c <code>forced_align<\/code> \u51fd\u6570\uff0c\u7528\u6237\u53ea\u9700\u63d0\u4f9b\u97f3\u9891\u548c\u5bf9\u5e94\u7684\u6587\u672c\uff0c\u5373\u53ef\u83b7\u53d6\u6bcf\u4e2a\u8bcd\u6216\u5b57\u7b26\u7684\u65f6\u95f4\u6233\u3002\u8be5\u5de5\u5177\u652f\u6301\u591a\u8bed\u8a00\u5bf9\u9f50\uff0c\u9002\u7528\u4e8e\u5404\u79cd\u8bed\u97f3\u5904\u7406\u4efb\u52a1\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/github.com\/SpeechColab\/GigaSpeech2\/tree\/main\/pi &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2025\/05\/15\/ctc-forced_align\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">CTC \u5f3a\u5236\u5bf9\u9f50-\u97f3\u9891\u548c\u6587\u672c<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,38,34],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/26373"}],"collection":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/comments?post=26373"}],"version-history":[{"count":12,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/26373\/revisions"}],"predecessor-version":[{"id":26417,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/26373\/revisions\/26417"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=26373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=26373"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=26373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}