资源简介
code for Large Scale Metric Learning from Equivalence Constraints
代码片段和文件信息
function [ ds ] = CrossValidatePairs(ds metric_learn_algs pairs X idxa idxb fHPairsToLabel)
%function [dsruns]=CrossValidatePairs(ds metric_learn_algs pairs X
%idxa idxb fHPairsToLabel)
%
% Leave one our cross-validation. The pairs of one fold serve for testing
% the rest for training.
%
% Input:
%
% ds - data struct that stores the result
% metric_learn_algs - algorithms that are used for cross validation
% pairs - [1xN] struct. N is the number of pairs. Fields pairs.fold
% pairs.match pairs.img1 pairs.img2.
% X - input matrix each column is an input vector [DxN*2]. N is the
% number of pairs. D is the feature dimensionality
% idxa - index of image A in X [1xN]
% idxb - index of image B in X [1xN]
% fHPairsToLabel (opt) - function handle to generate real class labels of
% the pairs struct.
%
% Output:
%
% ds - struct [1xnumFolds] that contains the result e.g. ds.kissme for
% our method.
%
% See also CrossValidateViper
%
% copyright by Martin Koestinger (2011)
% Graz University of Technology
% contact koestinger@icg.tugraz.at
%
% For more information see % web(‘http://lrs.icg.tugraz.at/members/koestinger‘)“>the ICG Web site.
if nargin < 7
fHPairsToLabel = [];
end
matches = logical([pairs.match]);
un = unique([pairs.fold]);
for c=un
trainMask = [pairs.fold] ~= c;
testMask = [pairs.fold] == c;
%-- TRAIN --%
for aC=1:length(metric_learn_algs)
cHandle = metric_learn_algs{aC};
if isempty(fHPairsToLabel)
s = learnPairwise(cHandleXidxa(trainMask)idxb(trainMask)matches(trainMask));
else
[CXcy] = feval(fHPairsToLabelpairs(trainMask & matches) X);
s = learn(cHandleCXcy);
end
if ~isempty(fieldnames(s))
ds(c).(cHandle.type) = s;
end
end
%-- TEST --%
names = fieldnames(ds(c));
for nameCounter=1:length(names)
ds(c).(names{nameCounter}).dist = dist(ds(c).(names{nameCounter}).learnAlgo ...
ds(c).(names{nameCounter}) Xidxa(testMask)idxb(testMask));
end
end
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1570 2012-05-31 11:24 KISSME\toolbox\COPYRIGHT
文件 2189 2012-05-31 15:22 KISSME\toolbox\CrossValidatePairs.m
文件 2355 2012-05-31 15:18 KISSME\toolbox\CrossValidateViper.m
文件 4256 2012-06-04 13:47 KISSME\toolbox\evalData.m
文件 635 2012-06-01 16:24 KISSME\toolbox\init.m
文件 2809 2012-05-31 09:26 KISSME\toolbox\install3dpartylibs.m
文件 1570 2012-05-31 11:24 KISSME\workflows\COPYRIGHT
文件 763 2012-05-07 10:28 KISSME\toolbox\helper\PairMetricLearning.m
文件 4877 2012-05-31 17:42 KISSME\toolbox\helper\SOPD.cpp
文件 14336 2012-06-01 16:25 KISSME\toolbox\helper\SOPD.mexw64
文件 357 2012-04-27 09:14 KISSME\toolbox\helper\ToyCarPairsToLabels.m
文件 475 2011-11-24 19:10 KISSME\toolbox\helper\calcMCMC.m
文件 509 2012-05-29 13:56 KISSME\toolbox\helper\cdistM.m
文件 114 2002-07-10 21:45 KISSME\toolbox\helper\col_sum.m
文件 729 2012-05-08 17:33 KISSME\toolbox\helper\exportAndCropFigure.m
文件 1313 2012-06-04 13:49 KISSME\toolbox\helper\icg_plotroc.m
文件 1425 2012-06-04 13:45 KISSME\toolbox\helper\icg_roc.m
文件 296 2012-05-07 17:39 KISSME\toolbox\helper\pairsToLabels.m
文件 716 2011-11-24 19:09 KISSME\toolbox\helper\sqdist.m
文件 722 2011-11-02 17:36 KISSME\toolbox\helper\validateCovMatrix.m
文件 490 2012-05-11 11:32 KISSME\toolbox\learnAlgos\LearnAlgo.m
文件 1653 2012-05-31 15:28 KISSME\toolbox\learnAlgos\LearnAlgoITML.m
文件 6376 2012-06-01 16:18 KISSME\toolbox\learnAlgos\LearnAlgoKISSME.m
文件 1991 2012-05-31 15:27 KISSME\toolbox\learnAlgos\LearnAlgoLDML.m
文件 2936 2012-05-31 16:56 KISSME\toolbox\learnAlgos\LearnAlgoLMNN.m
文件 1122 2012-05-31 15:29 KISSME\toolbox\learnAlgos\LearnAlgoMLEuclidean.m
文件 4866 2012-05-31 16:51 KISSME\toolbox\learnAlgos\LearnAlgoMahal.m
文件 3482 2012-05-11 14:56 KISSME\toolbox\learnAlgos\LearnAlgoSVM.m
文件 2115 2012-06-04 13:50 KISSME\workflows\CVPR\demo_lfw_attributes.m
文件 1812 2012-06-04 13:51 KISSME\workflows\CVPR\demo_lfw_sift.m
文件 2044 2012-06-04 13:51 KISSME\workflows\CVPR\demo_pubfig.m
............此处省略2个文件信息
评论
共有 条评论