FDDB数据集-人脸检测-ROC曲线绘制

来源:互联网 发布:oracle大数据查询优化 编辑:程序博客网 时间:2024/05/22 12:51

FDDB数据集自带的绘ROC曲线程序,但是也可以用于其它目标检测数据集上面,来评估算法性能。

1. evaluate程序的编译

下载evaluation code, 链接: http://vis-www.cs.umass.edu/fddb/results.html
源代码依赖opencv,直接 make 可能因为版本原因找不到opencv,所以参照 http://vis-www.cs.umass.edu/fddb/faq.html 中的最后一条,对Makefile文件进行修改

# Manually provide the inputs to include files and libraries.INCS = -I/usr/local/include/opencvLIBS = -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui       -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d        -lopencv_objdetect -lopencv_contrib -lopencv_legacy# Change the order in the evaluate. evaluate: $(OBJS)        $(CC) $(OBJS) -o $@ $(LIBS)

2. 生成 roc 数据文件

程序具体的使用方法可以参照(http://vis-www.cs.umass.edu/fddb/README.txt)

# evaluate程序的参数说明./evaluate [OPTIONS]   -h              : print usage   -a fileName     : file with face annotations (default: ellipseList.txt)  # 注释文件必须是椭圆,因为代码中是按照椭圆的数据格式读取的   -d fileName     : file with detections (default: faceList.txt)   -f format       : representation of faces in the detection file (default: 0)                   : [ 0 (rectangle), 1 (ellipse) or  2 (pixels) ]   -i dirName      : directory where the original images are stored (default: ~/scratch/Data/facesInTheWild/)   -l fileName     : file with list of images to be evaluated (default: temp.txt)     -r fileName     : prefix for files to store the ROC curves (default: temp)   -s showMatchedImage # evaluate程序帮助中没有说明此参数,可以将椭圆及预测框画在对应图像上并显示出来

各参数的示例
-a 参数
注释文件结构,其中图像的注释信息(label),在源代码的EllipseR中有说明
其中 major_axis_radius minor_axis_radius angle center_x center_y 1
分别对应 长轴半径 短轴半径 长轴方向 x轴中心坐标 y轴中心坐标 1
示例:

livet1/videoImage/livet_1_179.jpg155.2    51.0    0   434.6   419.5   1livet1/videoImage/livet_1_354.jpg252.8    67.8    0   26.4    96.9    147.4    50.4    0   23.7    327.2   1

-d 参数 为预测输出的文件结构,
示例:

livet1/videoImage/livet_1_179.jpg1395.217590332   402.91708374    107.763519287   78.0846252441   0.961679816246  1livet1/videoImage/livet_1_354.jpg24.12399768829   74.584564209    95.432261467    103.784500122   0.99744617939   12.01198101044   292.987335205   85.8906831741   99.1528930664   0.893540740013  1

-f 是预测输出文件的格式,与-a参数无关
-i 图像的父路径
-l 图像路径及文件名,最终读图像时使用的路径是 dirName+fileName,
示例:

livet1/videoImage/livet_1_179.jpglivet1/videoImage/livet_1_354.jpg
  • r 生成roc文件的前缀

这里有必要说明的一点是,源代码中默认的根据系统不同,给参数文档中每张图像名的后面追加了后缀.jpg或.ppm,如果系统为windows,则为.jpg,否则为.ppm
代码中可以在 evaluate.cpp 第205行看到,

string imFullName = imDir + imName + annotImageFormat; // string imFullName = imDir + imName; // 如果参数文档中已经包含了后缀,可以这样修改,即直接把annoImageFormat去掉

3. 根据 roc 数据文件绘制roc曲线

下载Comparison Code,解压后把第二步生成的roc文件放入rocCurves/

# 安装gnuplot,它是一个命令行的交互式绘图工具sudo apt-get install gnuplot# 绘制曲线,按照contROC.p里的内容,将自己的ROC文件名添加进代码中gnuplot  contROC.p

生成的曲线如下
这里写图片描述

原创粉丝点击