From 71b3f99e3bfc4b46a65b7ed1a94e5055855330ef Mon Sep 17 00:00:00 2001 From: Scott Klum Date: Mon, 1 Jun 2020 15:03:40 -0600 Subject: [PATCH] Add multiple operating points to evaluation tables --- openbr/core/plot.cpp | 4 +++- share/openbr/plotting/plot_utils.R | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/openbr/core/plot.cpp b/openbr/core/plot.cpp index d6c2874..5f04470 100644 --- a/openbr/core/plot.cpp +++ b/openbr/core/plot.cpp @@ -213,8 +213,10 @@ bool Plot(const QStringList &files, const File &destination, bool show) } // optional plot metadata and accuracy tables - if (destination.getBool("metadata", true)) + if (destination.getBool("metadata", true)) { p.file.write("plotTAR(tableData=TF)\n"); + p.file.write("plotTAR(tableData=TF,operatingPoint=1e-6)\n"); + } // Write plots QString plot = "plot <- plotLine(lineData=%1, options=list(%2), flipY=%3)\nplot\n"; diff --git a/share/openbr/plotting/plot_utils.R b/share/openbr/plotting/plot_utils.R index 07da098..02b43c1 100644 --- a/share/openbr/plotting/plot_utils.R +++ b/share/openbr/plotting/plot_utils.R @@ -62,17 +62,17 @@ plotTable <- function(tableData=NULL, name=NULL, labels=NULL) { } } -plotTAR <- function(tableData=NULL) { +plotTAR <- function(tableData=NULL, operatingPoint=1e-4) { if (nrow(tableData) == 0) return() major <- majorHeader minor <- if(minorHeader == "") majorHeader else minorHeader - tableData <- tableData[grep(1e-4,tableData$X),] + tableData <- tableData[grep(operatingPoint,tableData$X),] mat <- matrix(tableData$Y, nrow=length(tableData[,major][!duplicated(tableData[,major])]), ncol=length(tableData[,minor][!duplicated(tableData[,minor])]), byrow=FALSE) colnames(mat) <- tableData[,minor][!duplicated(tableData[,minor])] rownames(mat) <- tableData[,major][!duplicated(tableData[,major])] table <- as.table(mat) print(textplot(table)) - print(title("True Accept Rate at FAR=1e-4")) + print(title(paste("True Accept Rate at FAR=", toString(operatingPoint)))) } plotLandmarkTables <- function(tableData=NULL) { -- libgit2 0.21.4