FDDB roc验证工具使用方法

官方提供的是cpp的代码
环境:vs,opencv

1.配置opencv

首先在vs中新建个项目,把下载到的tgz文件解压,然后把hpp的放到头文件,cpp文件放到原文件,然后调整项目的属性,引入opencv。
参考https://blog.csdn.net/gu1857035894/article/details/125473159,配置opencv
之后运行回报错,提示没有cv.h和highgui.h、IplImage未定义
就在头文件把引入cv的代码换成如下
#include<opencv/cv.h>
#include<opencv/highgui.h>
#include “opencv2/imgproc.hpp”
参考:
https://blog.csdn.net/y601500359/article/details/100974755
https://blog.csdn.net/emperorjade/article/details/49718985
https://blog.csdn.net/yourijing/article/details/50721756

2.调整代码

首先注意调整地址和修改main中argc的默认值,使其为0:
在这里插入图片描述
在这里插入图片描述
输出结果在results.cpp中更改
使用了可能未初始化的本地指针变量“det”、‘l1’,新版cpp要初始化指针,给他们赋值NULL就行
目前我就遇到指针初始化和引入库的问题,如果小伙伴们遇到其他问题,根据错误提示修改就行
编译,执行会得到

void Results::saveROC(string outFile, vector<Results *> *rv){
  string s = outFile + "Cont_or_ROC.txt";
  ofstream osc(s.c_str());

  s = outFile + "Disc_or_ROC.txt";
  ofstream osd(s.c_str());

参考:
https://blog.csdn.net/qq_32108823/article/details/89216186

3.perl、gnuplot

perl是生产gnuplot能够认识的代码,perl执行的是.pl文件,作者在eval__tool中写好了,注意也要修改一些地址:

#!/usr/bin/perl -w
use strict;
#### VARIABLES TO EDIT ####
# where gnuplot is gnuplot的exe文件绝对路径
my $GNUPLOT = "D:/gnuplot/gnuplot/bin/wgnuplot"; 
# where the binary is evaluate的exe文件绝对路径
my $evaluateBin = "F:/evaluation/evaluation/evaluate.cpp"; 
# where the images are fddb图片总路径
my $imDir = "F:/FDDB/originalPics/"; 
# where the folds are fddb路径信息、真值框信息文档路径
my $fddbDir = "F:/FDDB/FDDB-folds"; 
# where the detections are 最终生成的ROC图像存放位置
my $detDir = "F:/FDDB/"; 
###########################
 
my $detFormat = 0; # 0: rectangle, 1: ellipse 2: pixels
 
sub makeGNUplotFile
{
my $rocFile = shift;
my $gnuplotFile = shift;
my $title = shift;
my $pngFile = shift;
 
open(GF, ">$gnuplotFile") or die "Can not open $gnuplotFile for writing\n"; 
#print GF "$GNUPLOT\n";
print GF "set term png\n";
print GF "set size 1,1\n";
print GF "set output \"$pngFile\"\n";
#print GF "set xtics 500\n";
print GF "set ytics 0.1\n";
print GF "set grid\n";
#print GF "set size ratio -1\n";
print GF "set ylabel \"True positive rate\"\n";
print GF "set xlabel \"False positives\"\n";
#print GF "set xr [0:2000]\n";
print GF "set yr [0:1.0]\n";
print GF "set key right bottom\n";
print GF "plot \"$rocFile\" using 2:1 title \"$title\" with lines lw 2 \n";
close(GF);
}
 
my $gpFile = "F:/evaluation/evaluation/ContROC.p"; #存放ContROC图绘图信息的.p文件绝对路径(需要自己先生成)
my $gpFile1 = "F:/evaluation/evaluation/DistROC.p"; #存放DistROC图绘图信息的.p文件绝对路径
my $title = "FaceBoxes";
 
# plot the two ROC curves using GNUplot
makeGNUplotFile("F:/evaluation/evaluation/tempContROC.txt", $gpFile, $title, $detDir."ContROC.png");
makeGNUplotFile("F:/evaluation/evaluation/tempDiscROC.txt", $gpFile1, $title, $detDir."DiscROC.png");

之后执行pl文件就获得了.p文件,吧.p文件拖动到gunplot就可以获得roc曲线了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值