Exemplo n.º 1
0
         HError(999,"Can only update linear transforms OR model parameters!");

      xfInfo.useOutXForm = TRUE;

      /* This initialises things - temporary hack - THINK!! */

      CreateAdaptXForm(hset, "tmp");

   } 



   

   /* initialise and  pass information to the forward backward library */

   InitialiseForBack(fbInfo, x, hset, uFlags, pruneInit, pruneInc,

                     pruneLim, minFrwdP);



   if (parMode != 0) {

      ConvLogWt(hset);

   }

   /* 2-model reestimation */

   if (al_hmmUsed){

       if (trace&T_TOP)

           printf("2-model re-estimation enabled\n");

       /* load alignment HMM set */

       CreateHMMSet(&al_hset,&hmmStack,TRUE);

       xfInfo.al_hset = &al_hset;

       if (xfInfo.alXFormExt == NULL) xfInfo.alXFormExt = xfInfo.inXFormExt;

       /* load multiple MMFs */

       if (strlen(al_hmmMMF) > 0 ) {

           char *p,*q;

           Boolean eos;

           p=q=al_hmmMMF;

           for(;;) {

               eos = (*p=='\0');

               if ( ( isspace((int) *p) || *p == '\0' ) && (q!=p) ) {
Exemplo n.º 2
0
      if (uFlags&UPXFORM)  printf("XForms "); 

      if (uFlags&UPMIXES && maxM>1)  printf("MixWeights "); 

      printf("\n\n ");

    

      if (parMode>=0) printf("Parallel-Mode[%d] ",parMode);



      printf("System is ");

      switch (hsKind){

      case PLAINHS:  printf("PLAIN\n");  break;

      case SHAREDHS: printf("SHARED\n"); break;

      case TIEDHS:   printf("TIED\n"); break;

      case DISCRETEHS: printf("DISCRETE\n"); break;

      }



      printf("%d Logical/%d Physical Models Loaded, VecSize=%d\n",L,P,vSize);

      if (hset->numFiles>0)

         printf("%d MMF input files\n",hset->numFiles);

      if (mmfFn != NULL)

         printf("Output to MMF file:  %s\n",mmfFn); 

      fflush(stdout);

   }

   SetVFloor( hset, vFloor, minVar);

   totalPr = 0.0;



   if (xfInfo.inSpkrPat == NULL) xfInfo.inSpkrPat = xfInfo.outSpkrPat; 

   if (xfInfo.paSpkrPat == NULL) xfInfo.paSpkrPat = xfInfo.outSpkrPat; 

   if (uFlags&UPXFORM) {

      if ((hsKind != PLAINHS) && (hsKind != SHAREDHS))

         HError(999,"Can only estimated transforms with PLAINHS and SHAREDHS!");
Exemplo n.º 3
0
/* UpdateModels: update all models and save them in newDir if set,
   new files have newExt if set */
void UpdateModels(void)
{
   int n;
   HLink hmm;
   HMMScanState hss;
   
   if (trace&T_INT){
      printf("Starting Model Update\n"); fflush(stdout);
   }

   if (hsKind==TIEDHS){
      if (uFlags & UPVARS)  /* TIEDHS therefore only done once per HMMSet */
         UpdateTMVars();
      if (uFlags & UPMEANS) 
         UpdateTMMeans();      
      if (uFlags & (UPMEANS|UPVARS))
         FixAllGConsts(&hset);
   }

   NewHMMScan(&hset,&hss);
   do {
      hmm = hss.hmm;   
      n = (int)hmm->hook;
      if (n<minEgs && !(trace&T_OPT))
         HError(-2428,"%s copied: only %d egs\n",HMMPhysName(&hset,hmm),n);
      if (n>=minEgs) {
         if (uFlags & UPTRANS)
            UpdateTrans(hmm);
         if (maxMixes>1 && uFlags & UPMIXES)
            UpdateWeights(hmm);
      }
      if (trace&T_OPT) {
         if (n<minEgs)
            printf("Model %s copied: only %d examples\n",
                   HMMPhysName(&hset,hmm),n);
         else
            printf("Model %s updated with %d examples\n",
                   HMMPhysName(&hset,hmm),n);
         fflush(stdout);
      }
   } while (GoNextHMM(&hss));
   EndHMMScan(&hss);
   if (trace&T_TOP){
      printf("Saving hmm's to dir %s\n",(newDir==NULL)?"Current":newDir); 
      fflush(stdout);
   }

   if(SaveHMMSet(&hset,newDir,newExt,NULL,saveBinary)<SUCCESS)
      HError(2411,"UpdateModels: SaveHMMSet failed");
   ResetHeaps();                               /* Clean Up */
   if (trace&T_TOP)
      printf("Reestimation complete - average log prob per frame = %e\n",
             totalPr/(double)totalT);
}