Пример #1
0
  /**
   * Writes the result HTML pages for the evaluation of multiple jobs/algorithms
   *
   * @param results The NemaEvaluationResultSet to write results pages for.
   * @param jobIDToResultPlotFileList map of a jobId to the results plots for that job.
   * @param summaryCsv the summary csv file that summarizes all jobs.
   * @param jobIDToPerTrackCSV map of jobId to individual per-track results csv files for that job.
   * @param jobIDToTgz map of jobId to the tar-balls of individual job results.
   * @param outputDir directory to write the HTML pages to.
   */
  private void writeHtmlAnalysisPages(NemaEvaluationResultSet results, File outputDir) {
    String jobId;
    Map<NemaTrackList, List<NemaData>> sysResults;
    List<Page> resultPages = new ArrayList<Page>();
    List<PageItem> items;
    Page aPage;
    int numJobs = results.getJobIds().size();

    TableItem legendTable = createLegendTable(results);

    // do intro page to describe task
    {
      resultPages.add(createIntroHtmlPage(results, legendTable));
    }

    /* Do per system pages */
    {
      for (Iterator<String> it = results.getJobIds().iterator(); it.hasNext(); ) {
        jobId = it.next();
        items = new ArrayList<PageItem>();
        sysResults = results.getPerTrackEvaluationAndResults(jobId);

        /* Plot onset transcription against GT for each track result for each system */
        PageItem[] plots = plotTranscriptionForJob(jobId, results);
        for (int i = 0; i < plots.length; i++) {
          items.add(plots[i]);
        }

        aPage =
            new Page(
                results.getJobName(jobId) + "_results", results.getJobName(jobId), items, true);
        resultPages.add(aPage);
      }
    }

    if (results.getJobIds().size() > 1) {
      // do comparative plot page
      {
        getLogger().info("Creating comparison plots page...");
        items = new ArrayList<PageItem>();
        PageItem[] plots = plotTranscriptionForAllJobs(results);
        for (int i = 0; i < plots.length; i++) {
          items.add(plots[i]);
        }
        getLogger().info("\tdone.");
        aPage = new Page("comparisonPlots", "Comparative plots", items, true);
        resultPages.add(aPage);
      }
    }

    Page.writeResultPages(results.getTask().getName(), outputDir, resultPages);
  }
Пример #2
0
  /**
   * Writes the result HTML pages for the evaluation of multiple jobs/algorithms
   *
   * @param results The NemaEvaluationResultSet to write results pages for.
   * @param jobIDToResultPlotFileList map of a jobId to the results plots for that job.
   * @param summaryCsv the summary csv file that summarizes all jobs.
   * @param jobIDToPerTrackCSV map of jobId to individual per-track results csv files for that job.
   * @param jobIDToTgz map of jobId to the tar-balls of individual job results.
   * @param outputDir directory to write the HTML pages to.
   */
  private void writeResultHtmlPages(
      NemaEvaluationResultSet results,
      List<String> classNames,
      /*Map<String, File[]> jobIDToResultPlotFileList, */ File summaryCsv,
      File perClassFMeasureCsv,
      File perClassPrecisionCsv,
      File perClassRecallCsv,
      Map<String, File> jobIDToPerTrackCSV,
      Map<String, File> jobIDToTgz,
      File outputDir) {
    String jobId;
    Map<NemaTrackList, List<NemaData>> sysResults;
    List<Page> resultPages = new ArrayList<Page>();
    List<PageItem> items;
    Page aPage;
    int numJobs = results.getJobIds().size();

    TableItem legendTable = createLegendTable(results);

    // do intro page to describe task
    {
      resultPages.add(createIntroHtmlPage(results, legendTable));
    }

    /* Do summary page */
    {
      items = new ArrayList<PageItem>();
      items.add(legendTable);

      List<String> metrics = new ArrayList<String>();
      metrics.add(NemaDataConstants.ONSET_DETECTION_AVG_FMEASURE);
      metrics.add(NemaDataConstants.ONSET_DETECTION_AVG_PRECISION);
      metrics.add(NemaDataConstants.ONSET_DETECTION_AVG_RECALL);

      Table summaryTable =
          WriteCsvResultFiles.prepSummaryTable(
              results.getJobIdToOverallEvaluation(), results.getJobIdToJobName(), metrics);

      items.add(
          new TableItem(
              "summary_results",
              "Summary Results",
              summaryTable.getColHeaders(),
              summaryTable.getRows()));
      aPage = new Page("summary", "Summary", items, false);
      resultPages.add(aPage);
    }

    /* Do per class page */
    {
      items = new ArrayList<PageItem>();
      items.add(legendTable);

      Table perClassFMeasureTable =
          WriteCsvResultFiles.prepTableDataOverClassArrays(
              results.getJobIdToOverallEvaluation(),
              results.getJobIdToJobName(),
              classNames,
              NemaDataConstants.ONSET_DETECTION_AVG_FMEASURE_BY_CLASS);

      Table perClassPrecisionTable =
          WriteCsvResultFiles.prepTableDataOverClassArrays(
              results.getJobIdToOverallEvaluation(),
              results.getJobIdToJobName(),
              classNames,
              NemaDataConstants.ONSET_DETECTION_AVG_PRECISION_BY_CLASS);

      Table perClassRecallTable =
          WriteCsvResultFiles.prepTableDataOverClassArrays(
              results.getJobIdToOverallEvaluation(),
              results.getJobIdToJobName(),
              classNames,
              NemaDataConstants.ONSET_DETECTION_AVG_RECALL_BY_CLASS);

      items.add(
          new TableItem(
              "fmeasure_class",
              "F-Measure per Class",
              perClassFMeasureTable.getColHeaders(),
              perClassFMeasureTable.getRows()));

      items.add(
          new TableItem(
              "precision_class",
              "Pecision per Class",
              perClassPrecisionTable.getColHeaders(),
              perClassPrecisionTable.getRows()));

      items.add(
          new TableItem(
              "recall_class",
              "Recall per Class",
              perClassRecallTable.getColHeaders(),
              perClassRecallTable.getRows()));

      aPage = new Page("results_per_class", "Results per Class", items, false);
      resultPages.add(aPage);
    }

    /* Do per system pages */
    {
      for (Iterator<String> it = results.getJobIds().iterator(); it.hasNext(); ) {
        jobId = it.next();
        items = new ArrayList<PageItem>();
        TableItem filtLegend = filterLegendTable(legendTable, jobId);
        if (filtLegend != null) {
          items.add(filtLegend);
        }
        sysResults = results.getPerTrackEvaluationAndResults(jobId);

        /* Add per track table */
        Table perTrackTable =
            WriteCsvResultFiles.prepTableDataOverTracks(
                results.getTestSetTrackLists(),
                sysResults,
                results.getTrackEvalMetricsAndResultsKeys());

        items.add(
            new TableItem(
                results.getJobName(jobId) + "_results",
                results.getJobName(jobId) + " Per Track Results",
                perTrackTable.getColHeaders(),
                perTrackTable.getRows()));

        /* Plot onset transcription against GT for each track result for each system */
        PageItem[] plots = plotTranscriptionForJob(jobId, results);
        for (int i = 0; i < plots.length; i++) {
          items.add(plots[i]);
        }

        aPage =
            new Page(
                results.getJobName(jobId) + "_results", results.getJobName(jobId), items, true);
        resultPages.add(aPage);
      }
    }

    if (results.getJobIds().size() > 1) {
      // do comparative plot page
      {
        getLogger().info("Creating comparison plots page...");
        items = new ArrayList<PageItem>();
        items.add(legendTable);
        PageItem[] plots = plotTranscriptionForAllJobs(results);
        for (int i = 0; i < plots.length; i++) {
          items.add(plots[i]);
        }
        getLogger().info("\tdone.");
        aPage = new Page("comparisonPlots", "Comparative plots", items, true);
        resultPages.add(aPage);
      }
    }

    /* Do files page */
    {
      items = new ArrayList<PageItem>();

      /* CSVs */
      List<String> CSVPaths = new ArrayList<String>(numJobs + 4);
      CSVPaths.add(IOUtil.makeRelative(summaryCsv, outputDir));
      CSVPaths.add(IOUtil.makeRelative(perClassFMeasureCsv, outputDir));
      CSVPaths.add(IOUtil.makeRelative(perClassPrecisionCsv, outputDir));
      CSVPaths.add(IOUtil.makeRelative(perClassRecallCsv, outputDir));
      for (Iterator<String> it = results.getJobIds().iterator(); it.hasNext(); ) {
        jobId = it.next();
        CSVPaths.add(IOUtil.makeRelative(jobIDToPerTrackCSV.get(jobId), outputDir));
      }

      items.add(new FileListItem("dataCSVs", "CSV result files", CSVPaths));

      /* System tar-balls */
      List<String> tarballPaths = new ArrayList<String>(numJobs);
      for (Iterator<String> it = results.getJobIds().iterator(); it.hasNext(); ) {
        jobId = it.next();
        tarballPaths.add(IOUtil.makeRelative(jobIDToTgz.get(jobId), outputDir));
      }
      items.add(new FileListItem("tarballs", "Per algorithm evaluation tarball", tarballPaths));
      aPage = new Page("files", "Raw data files", items, true);
      resultPages.add(aPage);
    }

    Page.writeResultPages(results.getTask().getName(), outputDir, resultPages);
  }