From 855a80fb7bf2f34810de18ba0a88dee114b0c1f7 Mon Sep 17 00:00:00 2001 From: Ben Klein Date: Fri, 11 Jul 2014 11:20:31 -0400 Subject: [PATCH] Change false accepts to a percentage, moved legends to bottom --- openbr/core/eval.cpp | 10 +++++----- openbr/core/plot.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openbr/core/eval.cpp b/openbr/core/eval.cpp index 27ac297..b169e39 100644 --- a/openbr/core/eval.cpp +++ b/openbr/core/eval.cpp @@ -603,10 +603,10 @@ struct ResolvedDetection struct DetectionOperatingPoint { - float Recall, FalsePositives, Precision; - DetectionOperatingPoint() : Recall(-1), FalsePositives(-1), Precision(-1) {} + float Recall, FalsePositiveRate, Precision; + DetectionOperatingPoint() : Recall(-1), FalsePositiveRate(-1), Precision(-1) {} DetectionOperatingPoint(float TP, float FP, float totalPositives) - : Recall(TP/totalPositives), FalsePositives(FP), Precision(TP/(TP+FP)) {} + : Recall(TP/totalPositives), FalsePositiveRate(FP/totalPositives), Precision(TP/(TP+FP)) {} }; static QStringList computeDetectionResults(const QList &detections, int totalTrueDetections, bool discrete) @@ -637,12 +637,12 @@ static QStringList computeDetectionResults(const QList &detec QStringList lines; lines.reserve(keep); if (keep == 1) { const DetectionOperatingPoint &point = points[0]; - lines.append(QString("%1ROC, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.FalsePositives), QString::number(point.Recall))); + lines.append(QString("%1ROC, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.FalsePositiveRate), QString::number(point.Recall))); lines.append(QString("%1PR, %2, %3").arg(discrete ? "Discrete" : "Continuous", QString::number(point.Recall), QString::number(point.Precision))); } else { for (int i=0; i 1 ? QString(", colour=factor(%1)").arg(p.major.header) : QString()) + (p.minor.size > 1 ? QString(", linetype=factor(%1)").arg(p.minor.header) : QString()) + - QString(", xlab=\"False Accepts\", ylab=\"True Accept Rate\") + theme_minimal()") + + QString(", xlab=\"Percentage of False Accepts Per Image\", ylab=\"True Accept Rate\") + theme_minimal()") + (p.major.size > 1 ? getScale("colour", p.major.header, p.major.size) : QString()) + (p.minor.size > 1 ? QString(" + scale_linetype_discrete(\"%1\")").arg(p.minor.header) : QString()) + - QString(" + scale_x_log10() + scale_y_continuous(labels=percent) + annotation_logticks(sides=\"b\") + ggtitle(\"%1\")\n\n").arg(type))); + QString(" + scale_x_log10(labels=percent) + scale_y_continuous(labels=percent, limits=c(0,1)) + annotation_logticks(sides=\"b\") + ggtitle(\"%1\") + theme(legend.position=\"bottom\"")\n\n").arg(type))); foreach (const QString &type, QStringList() << "Discrete" << "Continuous") p.file.write(qPrintable(QString("qplot(X, Y, data=%1PR%2").arg(type, (p.major.smooth || p.minor.smooth) ? ", geom=\"smooth\", method=loess, level=0.99" : QString(", geom=\"%1\"").arg(plotType)) + @@ -362,12 +362,12 @@ bool PlotDetection(const QStringList &files, const File &destination, bool show) QString(", xlab=\"Recall\", ylab=\"Precision\") + theme_minimal()") + (p.major.size > 1 ? getScale("colour", p.major.header, p.major.size) : QString()) + (p.minor.size > 1 ? QString(" + scale_linetype_discrete(\"%1\")").arg(p.minor.header) : QString()) + - QString(" + scale_x_continuous(labels=percent) + scale_y_continuous(labels=percent) + ggtitle(\"%1\")\n\n").arg(type))); + QString(" + scale_x_continuous(labels=percent, limits=c(0,1)) + scale_y_continuous(labels=percent, limits=c(0,1)) + ggtitle(\"%1\") + theme(legend.position=\"bottom\")\n\n").arg(type))); p.file.write(qPrintable(QString("qplot(X, data=Overlap, geom=\"histogram\", position=\"identity\", xlab=\"Overlap\", ylab=\"Frequency\")") + QString(" + theme_minimal() + scale_x_continuous(minor_breaks=NULL) + scale_y_continuous(minor_breaks=NULL) + theme(axis.text.y=element_blank(), axis.ticks=element_blank(), axis.text.x=element_text(angle=-90, hjust=0))") + (p.major.size > 1 ? (p.minor.size > 1 ? QString(" + facet_grid(%2 ~ %1, scales=\"free\")").arg(p.minor.header, p.major.header) : QString(" + facet_wrap(~ %1, scales = \"free\")").arg(p.major.header)) : QString()) + - QString(" + theme(aspect.ratio=1)\n\n"))); + QString(" + theme(aspect.ratio=1, legend.position=\"bottom\")\n\n"))); p.file.write(qPrintable(QString("ggplot(AverageOverlap, aes(x=%1, y=%2, label=round(X,3)), main=\"Average Overlap\") + geom_text() + theme_minimal()").arg(p.minor.size > 1 ? p.minor.header : "'X'", p.major.size > 1 ? p.major.header : "'Y'") + QString("%1%2\n\n").arg(p.minor.size > 1 ? "" : " + xlab(NULL)", p.major.size > 1 ? "" : " + ylab(NULL)"))); -- libgit2 0.21.4