supervised discrete hashing的evaluate_macro代码理解:在主程序中调用时,evaluate_macro的前一个输入参数是cateTrainTest,是训练样本数*测试样本数的矩阵。evaluate_macro函数体中,对每个测试样本,retrieved_relevant_num代表TP;relevant_num代表TP+FN;retrieved_num代表TP+FP。所有样本分别的平均precision即是最终的输出precision,所有样本分别的平均recall即是最终的输出recall。
cat_apcal函数是计算MAP的,代码意义很好理解,比如按距离排序,前七个只有1、3、5和7是和query相同的类,则MAP=(1+2/3+3/5+4/7)/4 (This is with discussing with Shu Zhang). 但Deep hashing for compact (CVPR 2015) mean average
precision (mAP): which computes the area under the precision-recall curve.
matlab曲线下如何求面积?
如果知道函数表达式的话,调用quad函数就可以了。如果不知道函数表达式只知道这一系列离散点,x和y,则trapz(x,y)即可
例1:本机Hashing\code\ITQ\delete\test_cifar_PCA_ITQ_V01.m,对画出的precison和recall曲线,计算曲线下的面积,用trapz(recall,precision)即可
Shu Zhang说不知以上两种是否等价,如果按照Deep hashing for compact (CVPR 2015)算面积,则直接就能看出不同的方法谁的MAP大,因为谁的曲线在上方就谁大

身份证照片和真人的比对有两个指标
误识率:他明明不是张三,但你错误地把他判断成了张三。误识率1%,意味着有100个人来冒充其他人,有1个人会冒充成功。应该就是FAR
识别率:张三有10%左右的概率被系统说你不是张三,识别率90%。应该就是1-FRR
二代证比真人:识别率90% (误识率1%)
即使在1%的认假率的情况下,识别率目前可能大概做到90%左右。当然这个前提条件是说,我们用的是二代证卡内的那张低质量,压缩得非常狠,照片的分辨率不够高的那张小照片。如果我们用的是一张清晰的,近期的证件照,那么这个结论可以做到大概,误识率可以做到万分之一的情况下,识别率可以做到90%以上的正确率。
Reference
造就Talk | 山世光:天眼系统终将开启,你准备好了吗?http://mp.weixin.qq.com/s?__biz=MzAwNTcyNDU5MQ==&mid=509662068&idx=1&sn=f14840fb7927497ad0d49e1d18eb6b5a&scene=1&srcid=0529xR8z0qC240GLkQZuUAG9&from=groupmessage&isappinstalled=0#wechat_redirect 已看两次

http://www.mathworks.com/matlabcentral/fileexchange/37758-performance-measures-for-classification/content/Evaluate.m

function EVAL = Evaluate(ACTUAL,PREDICTED)
% This fucntion evaluates the performance of a classification model by 
% calculating the common performance measures: Accuracy, Sensitivity, 
% Specificity, Precision, Recall, F-Measure, G-mean.
% Input: ACTUAL = Column matrix with actual class labels of the training
%                 examples
%        PREDICTED = Column matrix with predicted class labels by the
%                    classification model
% Output: EVAL = Row matrix with all the performance measures


idx = (ACTUAL()==1);

p = length(ACTUAL(idx));
n = length(ACTUAL(~idx));
N = p+n;

tp = sum(ACTUAL(idx)==PREDICTED(idx));
tn = sum(ACTUAL(~idx)==PREDICTED(~idx));
fp = n-tn;
fn = p-tp;

tp_rate = tp/p;
tn_rate = tn/n;

accuracy = (tp+tn)/N;
sensitivity = tp_rate;
specificity = tn_rate;
precision = tp/(tp+fp);
recall = sensitivity;
f_measure = 2*((precision*recall)/(precision + recall));
gmean = sqrt(tp_rate*tn_rate);

EVAL = [accuracy sensitivity specificity precision recall f_measure gmean];