Matlab求 SROCC,KROCC,PLCC,RMSE

2016/11/19

前天写了一篇关于此的文章,写的太草率,纯是留给自己备份,今天向师兄请教,完善一下。特此感谢刘玉涛师兄。

在图像质量评价领域用于考量评价方法的好坏有三个经典相关参数,分别是斯皮尔曼秩相关系数(Spearman rankorder correlation coefficient,SROCC),肯德尔秩次相关系数(Kendallrank-order correlation coefficient,KROCC),皮尔森线性相关系数(Pearsonlinear correlation coefficient,PLCC),它们连同军方跟误差RMSE(Root-mean-square-error)。客观算法的结果和主观评价的结果相关性越高,则以上三个相关系数的值越接近于1,RMSE值越小,说明算法越准确。

对于三个相关系数数:
图像全参考客观评价算法比较
评估图像质量评价算法性能的几个常用的标准
这两篇文章可以作为入门了解。

在Matlab中,有现成的方法来计算这三个相关系数,即corr函数,详细介绍见Matlab官方文档——corr,RSME的算法就无需多言了。

简要使用方法如下,计算同维数两个列向量x,y的相关系数:

corr(x,y,'type','Spearman');//SROCC
corr(x,y,'type','Kendall');//KROCC
corr(x,y,'type','Pearson');//PLCC

值得说明的是PLCC和RMSE的计算,要先将要比较的两组数据或者两个变量的数据进行一下非线性回归分析或拟合之类的操作然后再去算。

因此完整的代码如下:

%this script is used to calculate the pearson linear correlation
%coefficient and root mean sqaured error after regression

%get the objective scores computed by the IQA metric and the subjective
%scores provided by the dataset

function [srocc,krocc,plcc,rmse] = verify_performance(mos,predict_mos)

predict_mos = predict_mos(:);
mos = mos(:);

%initialize the parameters used by the nonlinear fitting function
beta(1) = 10;
beta(2) = 0;
beta(3) = mean(predict_mos);
beta(4) = 0.1;
beta(5) = 0.1;

%fitting a curve using the data
[bayta ehat,J] = nlinfit(predict_mos,mos,@logistic,beta);
%given a ssim value, predict the correspoing mos (ypre) using the fitted curve
[ypre junk] = nlpredci(@logistic,predict_mos,bayta,ehat,J);
% ypre = predict(logistic,fsimValues,bayta,ehat,J);
rmse = sqrt(sum((ypre - mos).^2) / length(mos));%root meas squared error
plcc = corr(mos, ypre, 'type','Pearson'); %pearson linear coefficient
srocc = corr(mos, predict_mos, 'type','spearman');
krocc = corr(mos, predict_mos, 'type','Kendall');
end
function yhat = logistic(bayta,X)

bayta1 = bayta(1); 
bayta2 = bayta(2); 
bayta3 = bayta(3); 
bayta4 = bayta(4);
bayta5 = bayta(5);

logisticPart = 0.5 - 1./(1 + exp(bayta2 * (X - bayta3)));

yhat = bayta1 * logisticPart + bayta4*X + bayta5;

return;

使用时,直接调用verify_performance函数,logistic函数是用来计算PLCC和RMSE之前逻辑回归的,由verify_performance函数调用。

完。

评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值