[Subject Prev][Subject Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hts-users:02318] Re: Fwd: So influential stream weight?


Hi,

Junichi Yamagishi wrote:

Hui from IDIAP found a bug of HTS again.

I have already reported this to Heiga and he would
kindly send the patch for this issue to you soon.

Here is the patch code to fix this problem. The problem was in computation of mixture component-level posterior probabilities. HTS-2.1 didn't handle stream weights properly.

It should be noted that all mixture components in a stream will have exactly the same mean, variance, and mixture weights after reestimation if you set stream weight=0.0, because all mixture components in a stream have the same posterior probability. So stream weight=0.0 && mixture components>1 doesn't make sense.

Best regards,

Heiga ZEN (Byung Ha CHUN)

--
--------------------------
Heiga ZEN (Byung Ha CHUN)
Speech Technology Group
Cambridge Research Lab
Toshiba Research Europe
phone: +44 1223 436975


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email ______________________________________________________________________
--- HFB.c	2008-08-07 13:36:19.003411000 +0000
+++ HFB.c	2009-12-16 10:17:12.309655000 +0000
@@ -1297,28 +1297,17 @@
 		     else
 		        outprobj[s] = NULL; 
                   }
-               if (S>1) {
-                  if (!seenStr)
-                     outprobj[s][0] *= si->weights[s];
-		     sum += outprobj[s][0];
-               }
+               if (S>1)
+                  sum += si->weights[s] * outprobj[s][0];
             }
                if (S>1){
                outprobj[0][0] = sum;
-               /*if (seenStr) {
-                     outprobj[0][0] = sum/2;
-               } 
-               else { 
-                     outprobj[0][0] = sum;
-                     for (s=1;s<=S;s++)
-                        outprobj[s][0] = sum - outprobj[s][0];
-               }*/
                }
                if (trace&T_OUT && NonSkipRegion(skipstart,skipend,t)) {
                   printf(" %d. ",j); PrLog(outprobj[0][0]);
                   if (S>1){
                      printf("[ ");
-                  for (s=1; s<=S; s++) PrLog(outprobj[0][0] - outprobj[s][0]);
+                  for (s=1; s<=S; s++) PrLog(outprobj[0][0] - si->weights[s]*outprobj[s][0]);
                      printf("]");
                   }
                }
@@ -1932,7 +1921,7 @@
                        int t, DVector *aqt, DVector *aqt1, DVector *bqt, int S,
                        Boolean twoDataFiles, LogDouble pr)
 {
-   int i,s,j,k,kk,m=0,mx,M=0,N,vSize,d,*maxDur;
+   int i,s,j,k,kk,m=0,mx,M=0,N,vSize,order,d,*maxDur;
    Vector mu_jm,var,mean=NULL,invk,otvs;
    TMixRec *tmRec = NULL;
    float **outprob;
@@ -1945,6 +1934,7 @@
    HMMSet *hset;
    HSetKind hsKind;
    AlphaBeta *ab;
+   StateInfo *si;
    StreamElem *ste, *al_ste=NULL;
    StreamInfo *sti, *al_sti=NULL;
    MixtureElem *me;
@@ -1991,6 +1981,7 @@
    }
          
    for (j=2;j<N;j++) {
+      si = hmm->svec[j].info;
       if (fbInfo->maxM>1){
          initx = hmm->transP[1][j] + aqt[1][1];
          if (t>1) {
@@ -2047,7 +2038,7 @@
             ab->occm[t][q][j][s] = CreateVector(&ab->abMem, M);
             ZeroVector(ab->occm[t][q][j][s]);
          }
-         if (fbInfo->twoModels) { /* component probs of update hmm */
+         if (fbInfo->twoModels || si->weights[s]!=1.0) { /* component probs of update hmm */
             norm = LZERO;
             for (mx=1; mx<=M; mx++) {
                if (alCompLevel) {
@@ -2072,13 +2063,17 @@
                      otvs = ApplyCompFXForm(mp,o2[t].fv[s],inxform,&det,t);
                   }
                   }
-               else {
+               else if (fbInfo->twoModels) {
                   otvs = ApplyCompFXForm(mp,o[t].fv[s],inxform,&det,t);
                }
-               wght = MixLogWeight(hset,me->weight);
-               comp_prob[mx]=wght+MOutP(otvs,mp)+det;
-               if (comp_prob[mx]>LSMALL)
-               norm = LAdd(norm,comp_prob[mx]);
+               else
+                  otvs = o[t].fv[s];
+               order = SpaceOrder(otvs);
+               wght = si->weights[s] * MixLogWeight(hset,me->weight);
+               prob = (fbInfo->twoModels) ? MOutP(otvs,mp)+det : outprob[s][mx];
+               comp_prob[mx] = (!hset->msdflag[s] || (hset->msdflag[s] && order==VectorSize(mp->mean))) ? si->weights[s]*prob : LZERO;  /* MSD check */
+               if (wght+comp_prob[mx]>LSMALL)
+                  norm = LAdd(norm,wght+comp_prob[mx]);
             }
          }
 
@@ -2118,26 +2113,30 @@
                   x -= pr;
                }
               else if (fbInfo->twoModels) {      /* note: only SHAREDHS or PLAINHS */
+                  c_jm = si->weights[s] * wght;
                   x = LZERO;
                   for (d=1; d<=maxDur[j]; d++)
                      if (aqt[j][d]>LSMALL && bqt[j][d]>LSMALL)
                         x = LAdd(x,aqt[j][d]+bqt[j][d]);
-                  x += comp_prob[m]-pr-norm;
+                  x += c_jm+comp_prob[m]-pr-norm;
               }
               else {
-                 c_jm=wght;
+                  c_jm = si->weights[s] * wght;
                  x = initx+c_jm;
                  switch(hsKind) {
                  case TIEDHS :
                     tmp = tmRec->probs[mx].prob;
                     prob = (tmp>=MINLARG)?log(tmp)+tmRec->maxP:LZERO;
+                     prob = (prob>LSMALL) ? si->weights[s] * prob : LZERO;
                     break;
                  case SHAREDHS:
                   case PLAINHS : 
 		    if (S==1)
 		       prob = outprob[0][mx];
-		    else
+                    else if (si->weights[s]==1.0)
 		       prob = outprob[s][mx];
+                    else
+                        prob = si->weights[s] * outprob[s][0] + comp_prob[mx] - norm;
                     break;
                  default:
                     x=LZERO;
@@ -2145,8 +2144,7 @@
                  }
                  x += prob;
                  if (S>1)      /* adjust for parallel streams */
-                     x += outprob[0][0] - outprob[s][0];
-                     /* x += outprob[s][0] */
+                     x += outprob[0][0] - si->weights[s] * outprob[s][0];
               }
               if (twoDataFiles){  /* switch to new data for mu & var est */
                   otvs = o2[t].fv[s];

References
[hts-users:02315] Fwd: So influential stream weight?, Junichi Yamagishi