عضو فعال
تاريخ عضويت: خرداد ۱۳۹۲
پست ها: 16
تشكرها: 13
0 تشكر در 0 پست
|
سلام
برنامه اصلی این الگوریتم را قرار دادم .لطفا راهنمایی ام کنید.منظور ازفاصله داخلی دراین الگوریتم چیست یعنی با چه فرمولی بدست می آید ؟بافرمول خط؟؟؟؟لطفا راهنمایی ام کنید .
% This code re-implement the IDSC shape matching expeirment on the MPEG7 data set
% Experiment settings are follow closely those in
% H. Ling and D.W. Jacobs. Shape Classification Using the Inner-Distance,
% IEEE Trans on Pattern Anal. and Mach. Intell. (PAMI), 29(2):286-299, 2007.
%
% For details, please refer to
%
% Haibin Ling (hbling AT temple.edu)
%
clear;
addpath common_innerdist;
ifig = -1;
sData ='data/';
sImage ='data/mpeg7/';
%% Parameters ----------------------------------------------
n_class = 70;
n_obj = 20;
n_objall = n_obj*n_class;
n_bull = 2*n_obj;
labels = ceil((1:n_objall)/n_obj);
num_start = 8;
search_step = 1;
%-- shape context parameters
n_dist = 8;
n_theta = 12;
bTangent = 1;
bSmoothCont = 1;
n_contsamp = 150;
bSimplecont = 1;
thre = .6;
%-- FILEs --------------------------------------------
sDisAngSamp = ['_' i2s(n_dist,2) 'x' i2s(n_theta,2) 'x' i2s(n_contsamp,3)];
sCont = [sData 'cont_' i2s(n_contsamp) '.mat'];
sSC = [sData 'IDSC' sDisAngSamp '.mat'];
sSC1 = [sData 'IDSC' sDisAngSamp '_1.mat'];
sCont1 = [sData 'cont_' i2s(n_contsamp) '_1.mat'];
fprintf('%s,\n\n', sDisAngSamp);
%-- Extract contours -------------------------------------------------------------
if 1
bReflect = 0;
[cont_all] = batch_contour_f(sImage,n_class,n_obj,n_contsamp,bR eflect);
save(sCont, 'cont_all');
bReflect = 1;
[cont_all] = batch_contour_f(sImage,n_class,n_obj,n_contsamp,bR eflect);
save(sCont1, 'cont_all');
end
%% Compute or Load all the shape context data ------------------------------------
if 1
[SC] = Batch_Comp_IDSC( sImage, sCont, n_class, n_obj, n_dist, n_theta, ...
bTangent, bSmoothCont, bSimplecont, 0);
[SC1] = Batch_Comp_IDSC( sImage, sCont1, n_class, n_obj, n_dist, n_theta, ...
bTangent, bSmoothCont, bSimplecont, 1);
save(sSC, 'SC');
save(sSC1, 'SC1');
else
load(sSC);
load(sSC1);
end
%% classifying each object by comparing its SC to training objects -----------------
fprintf('Compute distance matrix b/w SC .............\n');
%-Compute distance matrix
dismat = zeros(n_objall,n_objall);
for i1=1:n_objall
t0 = clock;
for i2=1:n_objall
if i1~=i2
[dis_sc,costmat] = dist_bw_sc_C( SC{i1},SC{i2}, 0);
[cvec,cost1] = DPMatching_C(costmat,thre,num_start,search_step);
dismat(i1,i2) = cost1;
[dis_sc,costmat] = dist_bw_sc_C( SC{i1},SC1{i2}, 0);
[cvec,cost2] = DPMatching_C(costmat,thre,num_start,search_step);
dismat(i1,i2) = cost2;
dismat(i1,i2) = min(cost1,cost2);
end
end
disp(['Round ' num2str(i1) ' of 1400 finished, ' num2str(etime(clock,t0)) 'sec.']);
end
dismat = min(dismat,dismat');
%% Get final bullseye score
bull_score = Compu_Bullscore(dismat, n_class, n_obj, n_bull, labels);
fprintf('\nBullseye score = %.2f', 100*bull_score);
|