اطلاعیه

Collapse
No announcement yet.

عملکردبرنامه اصلی

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    عملکردبرنامه اصلی

    سلام
    از دوستان کسی می تونه برای درک بهتر این برنامه ،برنامه را توضیح دهد که چگونه کارمیکند ؟و ifig , num_start,.. توضیح دهد؟
    کد:
    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	= 100; 
    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,bReflect); 
    save(sCont, 'cont_all'); 
    bReflect	= 1; 
    [cont_all] = batch_contour_f(sImage,n_class,n_obj,n_contsamp,bReflect); 
    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);
    ممنون میشم دوستان کمکم کنند.
لطفا صبر کنید...
X