Commit bff4b06d209282b42442a833ba5928bfbbc61a2d
Merge branch 'master' of https://github.com/biometrics/openbr
Showing
2 changed files
with
21 additions
and
29 deletions
sdk/core/plot.cpp
| ... | ... | @@ -348,13 +348,15 @@ struct RPlot |
| 348 | 348 | "SD <- data[grep(\"SD\",data$Plot),-c(1)]\n" |
| 349 | 349 | "BC <- data[grep(\"BC\",data$Plot),-c(1)]\n" |
| 350 | 350 | "CMC <- data[grep(\"CMC\",data$Plot),-c(1)]\n" |
| 351 | - "rm(data)\n" | |
| 351 | + "FAR$Error <- \"FAR\"\n" | |
| 352 | + "FRR$Error <- \"FRR\"\n" | |
| 353 | + "ERR <- rbind(FAR, FRR)\n" | |
| 354 | + "rm(data, FAR, FRR)\n" | |
| 352 | 355 | "\n" |
| 353 | 356 | "# Format data\n" |
| 354 | 357 | "Metadata$Y<-factor(Metadata$Y, levels=c(\"Genuine\",\"Impostor\",\"Ignored\",\"Gallery\",\"Probe\"))\n" |
| 355 | 358 | "DET$Y <- as.numeric(as.character(DET$Y))\n" |
| 356 | - "FAR$Y <- as.numeric(as.character(FAR$Y))\n" | |
| 357 | - "FRR$Y <- as.numeric(as.character(FRR$Y))\n" | |
| 359 | + "ERR$Y <- as.numeric(as.character(ERR$Y))\n" | |
| 358 | 360 | "SD$Y <- as.factor(unique(as.character(SD$Y)))\n" |
| 359 | 361 | "BC$Y <- as.numeric(as.character(BC$Y))\n" |
| 360 | 362 | "CMC$Y <- as.numeric(as.character(CMC$Y))\n"); |
| ... | ... | @@ -428,23 +430,23 @@ bool br::Plot(const QStringList &files, const QString &destination, bool show) |
| 428 | 430 | |
| 429 | 431 | RPlot p(files, destination); |
| 430 | 432 | |
| 431 | - p.file.write(qPrintable(QString("qplot(X, Y, data=DET, geom=\"line\"") + | |
| 433 | + p.file.write(qPrintable(QString("qplot(X, 1-Y, data=DET, geom=\"line\"") + | |
| 432 | 434 | (p.majorSize > 1 ? QString(", colour=factor(%1)").arg(p.majorHeader) : QString()) + |
| 433 | 435 | (p.minorSize > 1 ? QString(", linetype=factor(%1)").arg(p.minorHeader) : QString()) + |
| 434 | - QString(", xlab=\"False Accept Rate\", ylab=\"False Reject Rate\") + geom_abline(alpha=0.5, colour=\"grey\", linetype=\"dashed\") + theme_minimal()") + | |
| 436 | + QString(", xlab=\"False Accept Rate\", ylab=\"True Accept Rate\") + theme_minimal()") + | |
| 435 | 437 | (p.majorSize > 1 ? getScale("colour", p.majorHeader, p.majorSize) : QString()) + |
| 436 | 438 | (p.minorSize > 1 ? QString(" + scale_linetype_discrete(\"%1\")").arg(p.minorHeader) : QString()) + |
| 437 | - QString(" + scale_x_continuous(trans=\"log10\") + scale_y_continuous(trans=\"log10\")") + | |
| 438 | - QString("\nggsave(\"%1\")\n").arg(p.subfile("DET")))); | |
| 439 | + QString(" + scale_x_log10() + scale_y_continuous(labels=percent)") + | |
| 440 | + QString("\nggsave(\"%1\")\n").arg(p.subfile("ROC")))); | |
| 439 | 441 | |
| 440 | - p.file.write(qPrintable(QString("qplot(X, 1-Y, data=DET, geom=\"line\"") + | |
| 442 | + p.file.write(qPrintable(QString("qplot(X, Y, data=DET, geom=\"line\"") + | |
| 441 | 443 | (p.majorSize > 1 ? QString(", colour=factor(%1)").arg(p.majorHeader) : QString()) + |
| 442 | 444 | (p.minorSize > 1 ? QString(", linetype=factor(%1)").arg(p.minorHeader) : QString()) + |
| 443 | - QString(", xlab=\"False Accept Rate\", ylab=\"True Accept Rate\") + theme_minimal()") + | |
| 445 | + QString(", xlab=\"False Accept Rate\", ylab=\"False Reject Rate\") + geom_abline(alpha=0.5, colour=\"grey\", linetype=\"dashed\") + theme_minimal()") + | |
| 444 | 446 | (p.majorSize > 1 ? getScale("colour", p.majorHeader, p.majorSize) : QString()) + |
| 445 | 447 | (p.minorSize > 1 ? QString(" + scale_linetype_discrete(\"%1\")").arg(p.minorHeader) : QString()) + |
| 446 | - QString(" + scale_x_continuous(trans=\"log10\") + scale_y_continuous(labels=percent)") + | |
| 447 | - QString("\nggsave(\"%1\")\n").arg(p.subfile("ROC")))); | |
| 448 | + QString(" + scale_x_log10() + scale_y_log10()") + | |
| 449 | + QString("\nggsave(\"%1\")\n").arg(p.subfile("DET")))); | |
| 448 | 450 | |
| 449 | 451 | p.file.write(qPrintable(QString("qplot(X, data=SD, geom=\"histogram\", fill=Y, position=\"identity\", alpha=I(1/2)") + |
| 450 | 452 | QString(", xlab=\"Score%1\"").arg((p.flip ? p.majorSize : p.minorSize) > 1 ? " / " + (p.flip ? p.majorHeader : p.minorHeader) : QString()) + |
| ... | ... | @@ -469,26 +471,17 @@ bool br::Plot(const QStringList &files, const QString &destination, bool show) |
| 469 | 471 | QString(", ylab=\"True Accept Rate%1\") + theme_minimal()").arg(p.minorSize > 1 ? " / " + p.minorHeader : QString()) + |
| 470 | 472 | (p.majorSize > 1 ? getScale("fill", p.majorHeader, p.majorSize) : QString()) + |
| 471 | 473 | (p.minorSize > 1 ? QString(" + facet_grid(%2 ~ X)").arg(p.minorHeader) : QString(" + facet_wrap(~ X)")) + |
| 472 | - QString(" + theme(legend.position=\"none\", axis.text.x=element_text(angle=-90, hjust=0)) + geom_text(data=BC, aes(label=Y, y=0.05))") + | |
| 474 | + QString(" + scale_y_continuous(labels=percent) + theme(legend.position=\"none\", axis.text.x=element_text(angle=-90, hjust=0)) + geom_text(data=BC, aes(label=Y, y=0.05))") + | |
| 473 | 475 | QString("\nggsave(\"%1\")\n").arg(p.subfile("BC")))); |
| 474 | 476 | |
| 475 | - p.file.write(qPrintable(QString("qplot(X, Y, data=FAR, geom=\"line\"") + | |
| 476 | - ((p.flip ? p.majorSize : p.minorSize) > 1 ? QString(", colour=factor(%1)").arg(p.flip ? p.majorHeader : p.minorHeader) : QString()) + | |
| 477 | - QString(", xlab=\"Score%1\", ylab=\"False Accept Rate\") + theme_minimal()").arg((p.flip ? p.minorSize : p.majorSize) > 1 ? " / " + (p.flip ? p.minorHeader : p.majorHeader) : QString()) + | |
| 478 | - ((p.flip ? p.majorSize : p.minorSize) > 1 ? getScale("colour", p.flip ? p.majorHeader : p.minorHeader, p.flip ? p.majorSize : p.minorSize) : QString()) + | |
| 479 | - QString(" + scale_y_continuous(trans=\"log10\")") + | |
| 480 | - ((p.flip ? p.minorSize : p.majorSize) > 1 ? QString(" + facet_wrap(~ %1, scales=\"free_x\")").arg(p.flip ? p.minorHeader : p.majorHeader) : QString()) + | |
| 481 | - QString(" + theme(aspect.ratio=1)") + | |
| 482 | - QString("\nggsave(\"%1\")\n").arg(p.subfile("FAR")))); | |
| 483 | - | |
| 484 | - p.file.write(qPrintable(QString("qplot(X, Y, data=FRR, geom=\"line\"") + | |
| 477 | + p.file.write(qPrintable(QString("qplot(X, Y, data=ERR, geom=\"line\", linetype=Error") + | |
| 485 | 478 | ((p.flip ? p.majorSize : p.minorSize) > 1 ? QString(", colour=factor(%1)").arg(p.flip ? p.majorHeader : p.minorHeader) : QString()) + |
| 486 | - QString(", xlab=\"Score%1\", ylab=\"False Reject Rate\") + theme_minimal()").arg((p.flip ? p.minorSize : p.majorSize) > 1 ? " / " + (p.flip ? p.minorHeader : p.majorHeader) : QString()) + | |
| 479 | + QString(", xlab=\"Score%1\", ylab=\"Error Rate\") + theme_minimal()").arg((p.flip ? p.minorSize : p.majorSize) > 1 ? " / " + (p.flip ? p.minorHeader : p.majorHeader) : QString()) + | |
| 487 | 480 | ((p.flip ? p.majorSize : p.minorSize) > 1 ? getScale("colour", p.flip ? p.majorHeader : p.minorHeader, p.flip ? p.majorSize : p.minorSize) : QString()) + |
| 488 | - QString(" + scale_y_continuous(trans=\"log10\")") + | |
| 481 | + QString(" + scale_y_log10()") + | |
| 489 | 482 | ((p.flip ? p.minorSize : p.majorSize) > 1 ? QString(" + facet_wrap(~ %1, scales=\"free_x\")").arg(p.flip ? p.minorHeader : p.majorHeader) : QString()) + |
| 490 | 483 | QString(" + theme(aspect.ratio=1)") + |
| 491 | - QString("\nggsave(\"%1\")\n").arg(p.subfile("FRR")))); | |
| 484 | + QString("\nggsave(\"%1\")\n").arg(p.subfile("ERR")))); | |
| 492 | 485 | |
| 493 | 486 | return p.finalize(show); |
| 494 | 487 | } | ... | ... |
sdk/openbr.h
| ... | ... | @@ -253,18 +253,17 @@ BR_EXPORT const char *br_objects(const char *abstractions = ".*", const char *im |
| 253 | 253 | * |
| 254 | 254 | * In order of their output, the figures are: |
| 255 | 255 | * -# Metadata table |
| 256 | - * -# Detection Error Tradeoff (DET) | |
| 257 | 256 | * -# Receiver Operating Characteristic (ROC) |
| 257 | + * -# Detection Error Tradeoff (DET) | |
| 258 | 258 | * -# Score Distribution (SD) histogram |
| 259 | 259 | * -# True Accept Rate Bar Chart (BC) |
| 260 | 260 | * -# Cumulative Match Characteristic (CMC) |
| 261 | - * -# False Accept Rate (FAR) curve | |
| 262 | - * -# False Reject Rate (FRR) curve | |
| 261 | + * -# Error Rate (ERR) curve | |
| 263 | 262 | * |
| 264 | 263 | * Several files will be created: |
| 265 | 264 | * - <i>destination</i><tt>.R</tt> which is the auto-generated R script used to render the figures. |
| 266 | 265 | * - <i>destination</i><tt>.pdf</tt> which has all of the figures in one file (convenient for attaching in an email). |
| 267 | - * - <i>destination</i><tt>_DET.pdf</tt>, ..., <i>destination</i><tt>_FAR.pdf</tt> which has each figure in a separate file (convenient for including in a presentation). | |
| 266 | + * - <i>destination</i><tt>_ROC.pdf</tt>, ..., <i>destination</i><tt>_ERR.pdf</tt> which has each figure in a separate file (convenient for including in a presentation). | |
| 268 | 267 | * |
| 269 | 268 | * \param num_files Number of <tt>.csv</tt> files. |
| 270 | 269 | * \param files <tt>.csv</tt> files created using \ref br_eval. | ... | ... |