Example #1
0
  public void run() throws Exception {
    try {
      SpkDiarizationLogger.setup();
      parameter = new Parameter();
      String[] parameterScoreIdent = {
        "",
        "--sGender",
        "--sByCluster",
        "--fInputDesc=audio2sphinx,1:3:2:0:0:0,13,1:1:300:4",
        "--sOutputFormat=seg,UTF8",
        fInputMask,
        "--sTop=8," + this.ubm_gmm,
        s_inputMaskRoot + baseName + ".spl.3.seg",
        s_outputMaskRoot + baseName + ".g.3.seg",
        "--tInputMask=" + gmm_model,
        "--sOutputMask=" + outputRoot + "/" + baseName + ".ident.M.GiacomoMameli.gmm.seg",
        show
      };
      parameter.readParameters(parameterScoreIdent);

      if (parameter.show.isEmpty() == false) {
        // clusters
        ClusterSet clusterSet = MainTools.readClusterSet(parameter);
        // FeatureSet featureSet2 = Diarization.loadFeature(parameter, clusterSetBase,
        // parameter.getParameterInputFeature().getFeaturesDescription().getFeaturesFormat()
        // + ",1:1:0:0:0:0,13,0:0:0:0");
        // ClusterSet clusterSet = new ClusterSet();
        // MSegInit.make(featureSet2, clusterSetBase, clusterSet, parameter);
        // clusterSet.collapse();
        // Features
        AudioFeatureSet featureSet = MainTools.readFeatureSet(parameter, clusterSet);
        // Top Gaussian model
        GMMArrayList gmmTopGaussianList = MainTools.readGMMForTopGaussian(parameter, featureSet);

        // Compute Model
        GMMArrayList gmmList = MainTools.readGMMContainer(parameter);

        clusterSetResult = make(featureSet, clusterSet, gmmList, gmmTopGaussianList, parameter);

        // System.out.println("===");
        // System.out.println(clusterSetResult.getFirstCluster().getInformations().replaceAll("]",
        // "").split("=")[1] );
        // Seg outPut
        MainTools.writeClusterSet(parameter, clusterSetResult, false);
      }
    } catch (DiarizationException e) {
      logger.log(Level.SEVERE, "error \t exception ", e);
      e.printStackTrace();
    }
  }
  /**
   * The main method.
   *
   * @param args the arguments
   */
  public static void main(String[] args) {
    try {
      SpkDiarizationLogger.setup();
      arguments = args;
      Parameter parameter = getParameter(args);
      if (args.length <= 1) {
        parameter.help = true;
      }
      parameter.logCmdLine(args);
      info(parameter, "Diarization");

      if (parameter.show.isEmpty() == false) {
        DiarizationTV diarizationTV = new DiarizationTV();
        if (parameter.getParameterDiarization().getSystem()
            == ParameterBNDiarization.SystemString[1]) {
          parameter
              .getParameterSegmentationSplit()
              .setSegmentMaximumLength(
                  (10 * parameter.getParameterSegmentationInputFile().getRate()));
        }
        if (parameter.getParameterDiarization().getThread() > 0) {
          logger.info("Diarization tuning");
          diarizationTV.tunEster2Corpus(parameter);
        } else {
          logger.info("Diarization BN");
          diarizationTV.ester2Version(parameter);
        }
      }
    } catch (DiarizationException e) {
      logger.log(Level.SEVERE, "Diarization error", e);
      e.printStackTrace();
    } catch (IOException e) {
      logger.log(Level.SEVERE, "IOExecption error", e);
      e.printStackTrace();
    } catch (Exception e) {
      logger.log(Level.SEVERE, "Execption error", e);
      e.printStackTrace();
    }
  }
 /** Run. */
 public void run() {
   ClusterSet clusterSet = getNextClusterSet();
   while (clusterSet != null) {
     Parameter parameter = getParameter(arguments);
     parameter.show = clusterSet.getShowNames().first();
     logger.finer("-------------------------------------------");
     logger.finer("--- " + parameter.show + " ---");
     logger.finer("-------------------------------------------");
     TreeMap<String, DiarizationResultList> showResult;
     try {
       showResult = tunEster2Diarization(parameter, clusterSet);
       sumResult(showResult);
       System.gc();
     } catch (DiarizationException e) {
       logger.log(Level.SEVERE, "Diarization error", e);
       e.printStackTrace();
     } catch (Exception e) {
       logger.log(Level.SEVERE, "Exception error", e);
       e.printStackTrace();
     }
     clusterSet = getNextClusterSet();
   }
 }