AUC_shuffled.m

function [score,tp,fp] = AUC_shuffled(saliencyMap, fixationMap, otherMap, Nsplits, stepSize, toPlot)
% saliencyMap is the saliency map
% fixationMap is the human fixation map (binary matrix)
% otherMap is a binary fixation map (like fixationMap) by taking the union of
% fixations from M other random images (Borji uses M=10)
% Nsplits is number of random splits
% stepSize is for sweeping through saliency map
% if toPlot=1, displays ROC curve if nargin < 6, toPlot = 0; end
if nargin < 5, stepSize = .1; end
if nargin < 4, Nsplits = 100; end score=nan; % If there are no fixations to predict, return NaN
if ~any(fixationMap)
disp('no fixationMap');
return
end % make the saliencyMap the size of fixationMap
if size(saliencyMap, 1)~=size(fixationMap, 1) || size(saliencyMap, 2)~=size(fixationMap, 2)
saliencyMap = imresize(saliencyMap, size(fixationMap));
end % normalize saliency map
saliencyMap = (saliencyMap-min(saliencyMap(:)))/(max(saliencyMap(:))-min(saliencyMap(:))); if sum(isnan(saliencyMap(:)))==length(saliencyMap(:))
disp('NaN saliencyMap');
return
end S = saliencyMap(:);
F = fixationMap(:);
Oth = otherMap(:); Sth = S(F>0); % sal map values at fixation locations
Nfixations = length(Sth); % for each fixation, sample Nsplits values from the sal map at locations
% specified by otherMap ind = find(Oth>0); % find fixation locations on other images Nfixations_oth = min(Nfixations,length(ind));
randfix = nan(Nfixations_oth,Nsplits); for i=1:Nsplits
randind = ind(randperm(length(ind))); % randomize choice of fixation locations
randfix(:,i) = S(randind(1:Nfixations_oth)); % sal map values at random fixation locations of other random images
end % calculate AUC per random split (set of random locations)
auc = nan(1,Nsplits);
for s = 1:Nsplits curfix = randfix(:,s); allthreshes = fliplr([0:stepSize:double(max([Sth;curfix]))]);
tp = zeros(length(allthreshes)+2,1);
fp = zeros(length(allthreshes)+2,1);
tp(1)=0; tp(end) = 1;
fp(1)=0; fp(end) = 1; for i = 1:length(allthreshes)
thresh = allthreshes(i);
tp(i+1) = sum((Sth >= thresh))/Nfixations;
fp(i+1) = sum((curfix >= thresh))/Nfixations_oth;
end auc(s) = trapz(fp,tp);
end score = mean(auc); % mean across random splits if toPlot
subplot(121); imshow(saliencyMap, []); title('SaliencyMap with fixations to be predicted');
hold on;
[y, x] = find(fixationMap);
plot(x, y, '.r');
subplot(122); plot(fp, tp, '.b-'); title(['Area under ROC curve: ', num2str(score)])
end

  main.m

clear;
clc;
smap_path='E:\Dataset180303\final_data\smap_Result1\';
gmap_path='E:\Dataset180303\final_data\image_resize_gt\'; smap_file=dir(smap_path); for j=3:length(smap_file)
disp(j-2);
gmap_name=strcat(gmap_path,num2str(j-2), '.jpg');
% gmap_name=strcat(gmap_path,smap_file(j).name);
smap_name=strcat(smap_path,num2str(j-2 + 0 ), '.jpg');
% smap_name=strcat(smap_path,num2str(j-2+ 0 ), '_SaliencyMap', '.jpg');
gmap=imresize(imread(gmap_name), [224, 224], 'bicubic');
smap=imresize(imread(smap_name), [224, 224], 'bicubic');
sal_map=mat2gray(smap);
if gmap==0
continue;
end if size(gmap,3)==3
gt_final_map=rgb2gray(gmap);
else
gt_final_map = gmap;
end
sal_map=imresize(sal_map,0.5);
gt_final_map=imresize(gt_final_map,0.5); threshold_value = graythresh(gt_final_map);
gt_final_map_bin = im2bw(gt_final_map, threshold_value); % c=calcAUCscore(sal_map,gt_final_map);
% [score,tp,fp] = AUC_shuffled(saliencyMap, fixationMap, otherMap, Nsplits, stepSize, toPlot)
[c,tp,fp]=AUC_shuffled(sal_map,gt_final_map_bin,gt_final_map);
idx=find(isnan(c));
c(idx)=0.5;
c = abs(c);
a(j-2,1)=mean(c);
end
% b(i-2,1)=mean(a);
% clear a;
% end
sAUC = mean(a);

  

显著性检测(saliency detection)评价指标之sAUC(shuffled AUC)的Matlab代码实现的更多相关文章

  1. 显著性检测(saliency detection)评价指标之NSS的Matlab代码实现

    calcNSSscore.m function [ score ] = calcNSSscore( salMap, eyeMap ) %calcNSSscore Calculate NSS score ...

  2. 显著性检测(saliency detection)评价指标之KL散度距离Matlab代码实现

    步骤1:先定义KLdiv函数: function score = KLdiv(saliencyMap, fixationMap) % saliencyMap is the saliency map % ...

  3. 视觉显著性简介 Saliency Detection

    内容转移到博客文章系列:显著性检测 1.简介 视觉显著性包括从下而上和从上往下两种机制.从下而上也可以认为是数据驱动,即图像本身对人的吸引,从上而下则是在人意识控制下对图像进行注意.科研主要做的是从下 ...

  4. paper 27 :图像/视觉显著性检测技术发展情况梳理(Saliency Detection、Visual Attention)

    1. 早期C. Koch与S. Ullman的研究工作. 他们提出了非常有影响力的生物启发模型. C. Koch and S. Ullman . Shifts in selective visual ...

  5. 视觉显著性检测(Visual saliency detection)相关概念

    视觉显著性检测(Visual saliency detection)指通过智能算法模拟人的视觉特点,提取图像中的显著区域(即人类感兴趣的区域). 视觉注意机制(Visual Attention Mec ...

  6. (不断更新)关于显著性检测的调研-Salient Object Detection: A Survey

    <Salient Object Detection: A Survey>作者:Ali Borji.Ming-Ming Cheng.Huaizu Jiang and Jia Li 基本按照文 ...

  7. 视频显著性检测-----Predicting Video Saliency using Object-to-Motion CNN and Two-layer Convolutional LSTM

    帧内显著性检测: 将卷积网络的多层特征进行组合通过unsampling 得到粗显著性预测: 帧间显著性检测: (粗检测结果+新卷积网络的特征图,最后+之前卷积网络的卷积特征输入到LSTM中)进行预测. ...

  8. {Links}{Matting}{Saliency Detection}{Superpixel}Source links

    自然图像抠图/视频抠像技术发展情况梳理(image matting, alpha matting, video matting)--计算机视觉专题1 http://blog.csdn.net/ansh ...

  9. [精读]Spationtemporal Saliency Detection Using Textural Contrast and Its Applications

    Spationtemporal Saliency Detection Using Textural Contrast and Its Applications Last Edit 2013/12/3 ...

随机推荐

  1. PL/SQL 设置

    1.如何批量导出建表语句?    通过菜单选择[Tools]–>[Export User Objects...],在打开的窗口中选择准备导出的表即可. 通过此种方式导出的sql脚本中不会有ins ...

  2. oracle超出打开游标的最大数的原因和解决方案

    oracle超出打开游标的最大数的原因和解决方案 分类: Oracle相关2012-06-05 10:36 6362人阅读 评论(0) 收藏 举报 oracle数据库sqljavasessionsys ...

  3. jboss7开发配置指南

    1      Jboss7下载与安装 1.1     官方下载 路径:http://www.jboss.org/jbossas/downloads,目前最新稳定版本为7.1.1 final,分别有zi ...

  4. Xamarin引用第三方包错误解决方法

    http://www.cnblogs.com/ThenDog/p/7623720.html

  5. linux上安装redis的踩坑过程

    redis用处很广泛,我不再啰嗦了,我按照网上教程想在linux上安装下,开始了踩坑过程,网上买了一个linux centos7.3,滴滴云的,巨坑无比啊,不建议大家用这家的! redis 为4.0, ...

  6. C++笔记019:C++中的const修饰的是一个真正的常量

    原创笔记,转载请注明出处! 点击[关注],关注也是一种美德~ 程序一: 我们知道数组的下标不能为变量,必须是一个确定的值.在C语言中看程序: #define a 10 int main() { //第 ...

  7. C# 操作PDF 图层(Layer)——添加、删除图层、设置图层可见性

    前言 通过添加图层,我们可以将文本.图片.表格.图形等元素精确定位于页面指定位置,将这些元素进行叠放.组合形成页面的最终效果.此外,对于页面中已有的图层我们也可以进行设置图层可见性.删除图层等操作.因 ...

  8. 关于前端本地压缩图片,兼容IOS/Android/PC且自动按需加载文件之lrz.bundle.js

    一.介绍说明主要特点: ①在前端压缩好要上传的图片可以更快的发送给后端,因此也特别适合在移动设备上使用. ②兼容IOS/Android,修复了IOS/Android某些版本已知的BUG. ③按需加载文 ...

  9. Mysql 查询条件中字符串尾部有空格也能匹配上的问题

    一.表结构 TABLE person id name 1 你 2 你(一个空格) 3 你(二个空格) 二.查询与结果 select * from person where `name` = ? 无论 ...

  10. JQuery(三)-- AJAX的深入理解以及JQuery的使用

    HTTP HTTP http: 超文本传输协议.特点:  简单.快速.灵活.无状态.无连接 URL: 统一资源定位符. 组成:协议名://主机IP:端口号/项目资源地址?传递参数的键值对#锚点 ①ip ...