介绍
项目地址:https://davischallenge.org/davis2016/code.html
下载
如下图所示,在DAVIS2016-Download页面,下载matlab代码和数据集
注意事项:
目录结构:
DAVIS2016
|--DAVIS
|--davis-matlab-davis-2016
代码下载:
- 不要用 git clone,git clone的结果是下载了2017的代码。直接在github下载zip,解压。
- 解压时会遇到aux文件夹内容解压失败,这是因为aux是windows保留的名称,因此不能创建名称为aux的文件夹或文件。
创建文件夹aux_ : ..\DAVIS2016\davis-matlab-davis-2016\measures\aux_
把aux中对应内容解压到aux_中
修改 ..\DAVIS2016\davis-matlab-davis-2016\startup.m
使用数据库
参考https://github.com/davisvideochallenge/davis-matlab/tree/davis-2016
安装
- 修改db_root_dir.m,使得地址指向DAVIS数据库在你系统中解压的位置(包含文件夹Annotations和JPEGImages)。
- 运行startup.m,添加必要的路径和执行一些检查操作。
- 如果上一步出问题了,就执行build.m,进行重编译。(没用过)
代码使用
-
demo_sweep.m
脚本包含了一个读取数据集图像和注释的demo.
% ------------------------------------------------------------------------
% Jordi Pont-Tuset - http://jponttuset.github.io/
% April 2016
% ------------------------------------------------------------------------
% This file is part of the DAVIS package presented in:
% Federico Perazzi, Jordi Pont-Tuset, Brian McWilliams,
% Luc Van Gool, Markus Gross, Alexander Sorkine-Hornung
% A Benchmark Dataset and Evaluation Methodology for Video Object Segmentation
% CVPR 2016
% Please consider citing the paper if you use this code.
% ------------------------------------------------------------------------
% This script simply reads all images, annotations and
% shows how to sweep all results
% ------------------------------------------------------------------------
addpath(fullfile(db_matlab_root_dir,'db_util'));
% Name of a result technique
% result_id = 'fcp';
% Get the ids of all sequences
seq_ids = db_seqs();
%seq_ids={'bear';'blackswan';'bmx-bumps';'bmx-trees';'boat';'breakdance';'breakdance-flare';'bus';'camel';'car-roundabout';'car-shadow';'car-turn';'cows';'dance-jump';'dance-twirl';'dog';'dog-agility';'drift-chicane';'drift-straight';'drift-turn';'elephant';'flamingo';'goat';'hike';'hockey';'horsejump-high';'horsejump-low';'kite-surf';'kite-walk';'libby';'lucia';'mallard-fly';'mallard-water';'motocross-bumps';'motocross-jump';'motorbike';'paragliding';'paragliding-launch';'parkour';'rhino';'rollerblade';'scooter-black';'scooter-gray';'soapbox';'soccerball';'stroller';'surf';'swing';'tennis';'train'};
% Sweep all sequences
for s_id = 1:length(seq_ids)
% Get all frame ids for that sequence
frame_ids = db_frame_ids(seq_ids{s_id});
%frame_ids={'00000','00001','00002','00003','00004','00005','00006','00007','00008','00009','00010'……};
fprintf('%s contains %d images: \n',seq_ids{s_id},length(frame_ids));
% Sweep all frames
for f_id = 2:length(frame_ids)-1
fprintf('.');
% Read the original image
image = db_read_image(seq_ids{s_id}, frame_ids{f_id});
%doing three things:
%construct the path of the reading images,
%check whether it exit,
%and read the image according to the path.
%image_path = fullfile(db_im_dir, seq_id, [frame_id '.jpg']);
%image = imread(imamge_path);
% Read the object annotation
annot = db_read_annot(seq_ids{s_id}, frame_ids{f_id});
% Read a result
% The result must be store in the path which is in the form of
% '..\db_root_dir\Results\Segmentations\db_im_size\result_id\seq_id\frame_id.png'
% '..\DAVIS\Results\Segmentations\480p\SCBU\bear\00001.png'
result = db_read_result(seq_ids{s_id}, frame_ids{f_id}, result_id);
end
fprintf('\n');
end
-
measures/eval_result.m
在一个确定的子集上对所选方法进行评估,子集和方法都在demo中修改参数确定
实验用的方法SCBU https://mp.csdn.net/postedit/83042190
这个measures/eval_result.m并非demo,而是一个function,需要自己写个demo调用它,先研究这函数输入输出
% main.m
addpath(fullfile(db_matlab_root_dir,'db_util'));
addpath(fullfile(db_matlab_root_dir,'measures'));
[eval, raw_eval] = eval_result('SCBU', {'J','F','T'},'all');
%function [eval, raw_eval] = eval_result(result_id, measures, gt_set)
输入
- result_id:要评估的方法的ID,比如'my_method'、'SCBU'、'MCD5.8ms'等等,函数根据这个ID找到存储预处理好的该方法的结果的位置,读取处理结果,得到相应的指标值。
- measures:要评估的指标,三种
- gt_set:用哪个集合作为gt集合,有三种:'all'、'train'、'val'
输出
- eval:一个1*1的struct
- raw_eval :保存了每一帧的
结果会以.mat的形式保存在 ..\DAVIS2016\davis-matlab-davis-2016\eval_results中。之后画图或者画表格时会用到。
-
experiments\experiments_params.m
画图或者画表格的参数在这个文件中调整,在后面补上我们要验证的算法'SCBU'
% List of techniques compared
techniques = {'mcg','sf-lab','sf-mot',...
'nlc','cvos','trc','msg',...
'key','sal','fst',...
'tsp','sea','hvs','jmp','fcp','bvs','ofl','msk','SCBU'};
% Names to be shown on the tables
techniques_paper = {'MCG','SF-LAB','SF-MOT',...
'NLC','CVOS','TRC','MSG',...
'KEY','SAL','FST',...
'TSP','SEA','HVS','JMP','FCP','BVS','OFL','MSK','SCBU'};
% Output folder to save files
paper_data = '~/tmp';
-
experiments\global_table.m
一个demo,用来画原论文中的表格2,直接运行即可得到下面表格的数据。各个方法的评价指标值,比较表格。
-
experiments\attribute_table.m
一个demo,用来画原论文中的表格3,直接运行即可得到下面的表格数据。在不同的挑战下各算法性能比较。