diff --git a/openbr/core/plot.cpp b/openbr/core/plot.cpp index 9106f52..d6c2874 100644 --- a/openbr/core/plot.cpp +++ b/openbr/core/plot.cpp @@ -213,22 +213,8 @@ bool Plot(const QStringList &files, const File &destination, bool show) } // optional plot metadata and accuracy tables - if (destination.getBool("metadata", true)) { - p.file.write("\n# Write metadata table\n"); - p.file.write(qPrintable(QString("plotMetadata(metadata=Metadata, title=\"%1 - %2\")\n").arg(PRODUCT_NAME, PRODUCT_VERSION))); - - if (!destination.getBool("csv")) p.file.write("plot.new()\n"); - QString table = "plotTable(tableData=%1, name=%2, labels=%3)\n"; - p.file.write(qPrintable(table.arg("TF", "\"Table of True Accept Rates at various False Accept Rates\"", - "c(\"FAR = 1e-06\", \"FAR = 1e-05\", \"FAR = 1e-04\", \"FAR = 1e-03\", \"FAR = 1e-02\", \"FAR = 1e-01\")"))); - p.file.write(qPrintable(table.arg("FT", "\"Table of False Accept Rates at various True Accept Rates\"", - "c(\"TAR = 0.40\", \"TAR = 0.50\", \"TAR = 0.65\", \"TAR = 0.75\", \"TAR = 0.85\", \"TAR = 0.95\")"))); - p.file.write(qPrintable(table.arg("CT", "\"Table of retrieval rate at various ranks\"", - "c(\"Rank 1\", \"Rank 5\", \"Rank 10\", \"Rank 20\", \"Rank 50\", \"Rank 100\")"))); - p.file.write(qPrintable(table.arg("TS", "\"Template Size by Algorithm\"", - "c(\"Template Size (bytes):\")"))); - p.file.write("\n"); - } + if (destination.getBool("metadata", true)) + p.file.write("plotTAR(tableData=TF)\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 16cb592..07da098 100644 --- a/share/openbr/plotting/plot_utils.R +++ b/share/openbr/plotting/plot_utils.R @@ -62,6 +62,19 @@ plotTable <- function(tableData=NULL, name=NULL, labels=NULL) { } } +plotTAR <- function(tableData=NULL) { + if (nrow(tableData) == 0) return() + major <- majorHeader + minor <- if(minorHeader == "") majorHeader else minorHeader + tableData <- tableData[grep(1e-4,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")) +} + plotLandmarkTables <- function(tableData=NULL) { if (majorSize > 1) { var <- majorHeader