步骤1:先定义KLdiv函数:

function score = KLdiv(saliencyMap, fixationMap)
% saliencyMap is the saliency map
% fixationMap is the human fixation map map1 = im2double(imresize(saliencyMap, size(fixationMap)));
map2 = im2double(fixationMap); % make sure map1 and map2 sum to 1
if any(map1(:))
map1 = map1/sum(map1(:));
end if any(map2(:))
map2 = map2/sum(map2(:));
end % compute KL-divergence
score = sum(sum(map2 .* log(eps + map2./(map1+eps))));

  步骤2:再写一个主函数调用它:

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 = KLdiv(sal_map, 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
KLdiv = mean(a);

  

显著性检测(saliency detection)评价指标之KL散度距离Matlab代码实现的更多相关文章

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

    AUC_shuffled.m function [score,tp,fp] = AUC_shuffled(saliencyMap, fixationMap, otherMap, Nsplits, st ...

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

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

  3. 视觉显著性简介 Saliency Detection

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

  4. paper 22:kl-divergence(KL散度)实现代码

    这个函数很重要: function KL = kldiv(varValue,pVect1,pVect2,varargin) %KLDIV Kullback-Leibler or Jensen-Shan ...

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

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

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

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

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

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

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

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

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

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

随机推荐

  1. access登录窗口校验代码一

    Private Sub login_Click()If IsNull(Me.username) ThenMsgBox "请输入用户名!", vbExclamationElseIf ...

  2. 转:<mvc:annotation-driven/>的注解意义

    <mvc:annotation-driven /> 是一种简写形式,完全可以手动配置替代这种简写形式,简写形式可以让初学都快速应用默认配置方案.<mvc:annotation-dri ...

  3. DjangoRestFramework的外键反向关系序列化的一个问题

    先用文档中的样例: Models定义: class Album(models.Model): album_name = models.CharField(max_length=100) artist ...

  4. nginx for Windows

    zt from nginx official site. Known issuesPossible future enhancements Version of nginx for Windows u ...

  5. java线程之线程通信控制

    在上篇我们看到,A线程往公共资源库(对象)提供了一条数据,然后B线程从库中提取了数据并打印出来. 实际项目中,我们不可能只往库中提供一条数据,而且库的大小也不会是无穷大的,那么我们就会有这样一 个需求 ...

  6. printf输出格式介绍(转)

    格式代码 A ABC ABCDEFGH %S A ABC ABCDEFGH %5S ####A ##ABC ABCDEFGH %.5S A ABC ABCDE %5.5S ####A ##ABC AB ...

  7. CRM客户关系管理系统(九)

    第九章.filter_horizontal优化和kingadmin删除功能 9.1.filter_horizontal优化 (1)添加Choose ALL 和Remove ALL table_obj_ ...

  8. 设计模式的征途—17.模板方法(Template Method)模式

    在现实生活中,很多事情都需要经过几个步骤才能完成,例如请客吃饭,无论吃什么,一般都包含:点单.吃东西.买单等几个步骤,通常情况下这几个步骤的次序是:点单=>吃东西=>买单.在这3个步骤中, ...

  9. 洛谷 P1879 解题报告

    P1879 [USACO06NOV]玉米田Corn Fields 题目描述 农场主\(John\)新买了一块长方形的新牧场,这块牧场被划分成\(M\)行\(N\)列\((1 ≤ M ≤ 12; 1 ≤ ...

  10. git - 简明指南

    助你入门 git 的简明指南,木有高深内容 ;) 作者:罗杰·杜德勒 感谢:@tfnico, @fhd 和 Namics如有纰漏,请在 github 提报问题 安装 下载 git OSX 版 下载 g ...