亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? do_naive_bayes_evaluation.m

?? 一個學習自然場景類別的貝葉斯模型、基于“詞袋”模型的目標分類。來源于Feifei Li的論文。是近年來的目標識別模型熱點之一。
?? M
字號:
function do_naive_bayes_evaluation(config_file)

%% Test and plot graphs for a naive bayes classifier learnt with do_naive_bayes.m

%% The action of this routine depends on the directory in which it is
%% run: 
%% (a) If run from RUN_DIR, then it will evaluate the latest model in the
%% models subdirectory. i.e. if you have just run
%% do_plsa('config_file_2'), which saved to model_0011.mat and
%% config_file_0011.m in the models subdirectory in RUN_DIR, then doing
%% do_plsa_evaluation('config_file_2') will load up model_0011.mat and
%% evaluate it. 
%% (b) If run within in models subdirectory, then it
%% will evaluate the model corresponding to the configuration file passed
%% to it. i.e. do_plsa_evaluation('config_file_0002') will load
%% model_0002.mat and evaluate/plot figures for it. 
%%  
%% Mode (a) exists to allow a complete experiment to be run from start to
%% finish without having to manually go into the models subdirectory and
%% find the appropriate one to evaluate.
  
%% If this routine is called on a newly learnt model, it will run the pLSA code
%% in folding in mode and then plot lots of figures. If run a second time
%% on the same model, it will only plot the figures, since there is no need
%% to recompute the statistics on the testing images. If you want to force it
%% to re-run on the images, then remove the Pc_d_pos_test variable from the
%% model file. 
  
%% Note this only uses a pre-existing model to evaluate the test
%% images. Please use do_naive_bayes to actually learn the classifiers.  
%% Before running this, you must have run:
%%    do_random_indices - to generate random_indices.mat file.
%%    do_preprocessing - to get the images that the operator will run on.  
%%    do_interest_op  - to get extract interest points (x,y,scale) from each image.
%%    do_representation - to get appearance descriptors of the regions.  
%%    do_vq - vector quantize appearance of the regions in each image.
%%    do_naive_bayes - learn a Naive Bayes classifier.
  
%% R.Fergus (fergus@csail.mit.edu) 03/10/05.  

%% figure numbers to start at
FIGURE_BASE = 2000;
%% color ordering
cols = {'r' 'g' 'b' 'c' 'm' 'y' 'k'};

%% Evaluate global configuration file
eval(config_file);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% Model section
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% get filename of model to learn
%%% if in models subdirectory then just get index off config_file string
if (strcmp(pwd,[RUN_DIR,'/',Global.Model_Dir_Name]) | strcmp(pwd,[RUN_DIR,'\',Global.Model_Dir_Name]))
    ind = str2num(config_file(end-Global.Num_Zeros+1:end));
else
    %%% otherwise just take newest model in subdir.
    ind = length(dir([RUN_DIR,'/',Global.Model_Dir_Name,'/',Global.Model_File_Name,'*.mat']));    
end
%%% construct model file name
model_fname = [RUN_DIR,'/',Global.Model_Dir_Name,'/',Global.Model_File_Name,prefZeros(ind,Global.Num_Zeros),'.mat'];

%%% load up model
load(model_fname);

%% get +ve interest point file names
pos_ip_file_names = [];
pos_sets = find(Categories.Labels==1);
for a=1:length(pos_sets)
    pos_ip_file_names =  [pos_ip_file_names , genFileNames({Global.Interest_Dir_Name},Categories.Test_Frames{pos_sets(a)},RUN_DIR,Global.Interest_File_Name,'.mat',Global.Num_Zeros)];
end

%% get -ve interest point file names
neg_ip_file_names = [];
neg_sets = find(Categories.Labels==0);
for a=1:length(neg_sets)
    neg_ip_file_names =  [neg_ip_file_names , genFileNames({Global.Interest_Dir_Name},Categories.Test_Frames{neg_sets(a)},RUN_DIR,Global.Interest_File_Name,'.mat',Global.Num_Zeros)];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Test section - run model on testing images only if Pd_z_test does not exist
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if ~exist('Pc_d_pos_test') %%% only do this section the first time we look at the model
                       %%% saves time if we just want to look at the pretty
                       %%% figures

%% Create matrix to hold word histograms from +ve images
X_fg = zeros(VQ.Codebook_Size,length(pos_ip_file_names));

%% load up all interest_point files which should have the histogram
%% variable already computed (performed by do_vq routine).
for a=1:length(pos_ip_file_names)
    %% load file
    load(pos_ip_file_names{a});
    %% store histogram
    X_fg(:,a) = histogram';    
end 


%% Create matrix to hold word histograms from +ve images
X_bg = zeros(VQ.Codebook_Size,length(neg_ip_file_names));

%% load up all interest_point files which should have the histogram
%% variable already computed (performed by do_vq routine).
for a=1:length(neg_ip_file_names)
    %% load file
    load(neg_ip_file_names{a});
    %% store histogram
    X_bg(:,a) = histogram';    
end 

%% positive is index 1
%% negitive class is index 2

%%%% do everything in log-space for numerical reasons....

%%% positive model on positive training images
for a=1:length(pos_ip_file_names)
    Pc_d_pos_test(1,a) = log(class_priors(1)) + sum(X_fg(:,a) .* log(Pw_pos)); 
end

%%% negative model on positive training images
for a=1:length(pos_ip_file_names)
    Pc_d_pos_test(2,a) = log(class_priors(2)) + sum(X_fg(:,a) .* log(Pw_neg)); 
end

%%% would normalise Pc_d_pos if it wasn't for serious numerical issues is
%%% VQ.Codebook_Size is large, so just leave unnormalised.

%%% positive model on negative training images
for a=1:length(neg_ip_file_names)
    Pc_d_neg_test(1,a) = log(class_priors(1)) + sum(X_bg(:,a) .* log(Pw_pos)); 
end

%%% negative model on negitive training images
for a=1:length(neg_ip_file_names)
    Pc_d_neg_test(2,a) = log(class_priors(2)) + sum(X_bg(:,a) .* log(Pw_neg)); 
end

%%% would normalise Pc_d_pos if it wasn't for serious numerical issues is
%%% VQ.Codebook_Size is large, so just leave unnormalised.

%%% Compute ROC and RPC on training data
labels = [ones(1,length(pos_ip_file_names)) , zeros(1,length(neg_ip_file_names))];
%%% use ratio of probabilities to avoid numerical issues
values = [Pc_d_pos_test(1,:)-Pc_d_pos_test(2,:) , Pc_d_neg_test(1,:)-Pc_d_neg_test(2,:)];

%%% compute roc
[roc_curve_test,roc_op_test,roc_area_test,roc_threshold_test] = roc([values;labels]');
%%% compute rpc
[rpc_curve_test,rpc_ap_test,rpc_area_test,rpc_threshold_test] = recall_precision_curve([values;labels]',length(pos_ip_file_names));


%%% save variables to file
save(model_fname,'Pc_d_pos_test','Pc_d_neg_test','roc_curve_test','roc_op_test','roc_area_test','roc_threshold_test','rpc_curve_test','rpc_ap_test','rpc_area_test','rpc_threshold_test','-append');
    
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Plotting section - plot some figures to see what is going on...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% We will use figures from FIGURE_BASE to FIGURE_BASE + 4;
%% clear them ready for plotting action...
for a=FIGURE_BASE:FIGURE_BASE+4
    figure(a); clf;
end

%% Now lets look at the classification performance
figure(FIGURE_BASE); hold on;
plot(roc_curve_train(:,1),roc_curve_train(:,2),'r');
plot(roc_curve_test(:,1),roc_curve_test(:,2),'g');
axis([0 1 0 1]); axis square; grid on;
xlabel('P_{fa}'); ylabel('P_d'); title('ROC Curves');
legend('Train','Test');

%% Now lets look at the retrieval performance
figure(FIGURE_BASE+1); hold on;
plot(rpc_curve_train(:,1),rpc_curve_train(:,2),'r');
plot(rpc_curve_test(:,1),rpc_curve_test(:,2),'g');
axis([0 1 0 1]); axis square; grid on;
xlabel('Recall'); ylabel('Precision'); title('RPC Curves');
legend('Train','Test');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Now plot out example images
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
labels = [ones(1,length(pos_ip_file_names)) , zeros(1,length(neg_ip_file_names))];
%%% use ratio of probabilities to avoid numerical issues
values = [Pc_d_pos_test(1,:)-Pc_d_pos_test(2,:) , Pc_d_neg_test(1,:)-Pc_d_neg_test(2,:)];

%% first decide on plotting order
if strcmp(Plot.Example_Mode,'ordered')
    %%% just go in orginial order of images
    plot_order = sort(Categories.All_Test_Frames);
elseif strcmp(Plot.Example_Mode,'alternate')
    %%% using random order but alternating between images of different
    %%% classes...
    ind = ones(Categories.Number,max(cellfun('length',Categories.Test_Frames)));
    tmp = length(Categories.Test_Frames{1});
    ind(1,1:tmp)=[1:tmp];
    for a=2:Categories.Number
        tmp = length(Categories.Test_Frames{a});
        offset=sum(cellfun('length',Categories.Test_Frames(1:a-1)));
        ind(a,1:tmp) = [1:tmp]+offset;
   end
   plot_order = ind(:);
   
elseif strcmp(Plot.Example_Mode,'random')
    %%% using order given in random_indices.mat
    plot_order = Categories.All_Test_Frames;
elseif strcmp(Plot.Example_Mode,'best')
    %%% plot ordered by ratio of posteriors, worst first
    [tmp2,plot_order] = sort(-values);
elseif strcmp(Plot.Example_Mode,'worst')
    %%% plot ordered by ratio of posteriors, worst first
    [tmp2,plot_order] = sort(values);    
elseif strcmp(Plot.Example_Mode,'borderline')
    %%% images closest to threshold
    %%% ordering by how close they are to the ROC thresholds...
    [tmp2,plot_order] = sort(abs(values-roc_threshold_train));
else
    error('Unknown type of Plot.Example_Mode');
end 

%% Get image filenames and ip filenames
image_file_names =  genFileNames({Global.Image_Dir_Name},Categories.All_Test_Frames,RUN_DIR,Global.Image_File_Name,Global.Image_Extension,Global.Num_Zeros);
ip_file_names =  genFileNames({Global.Interest_Dir_Name},Categories.All_Test_Frames,RUN_DIR,Global.Interest_File_Name,'.mat',Global.Num_Zeros);
    
%% now setup figure and run loop plotting images
figure(FIGURE_BASE+2);
nImage_Per_Figure = prod(Plot.Number_Per_Figure);

for a=1:nImage_Per_Figure:length(Categories.All_Test_Frames)
    
    clf; %% clear figure
    
    for b=1:nImage_Per_Figure
        
        %%% actual index
        index = plot_order(a+b-1);
        
        %%% get correct subplot
        subplot(Plot.Number_Per_Figure(1),Plot.Number_Per_Figure(2),b);
        
        %%% load image
        im=imread(image_file_names{index});
        
        %%% show image
        imagesc(im); hold on;
        
        %%% if grayscale, then adjust colormap
        if (size(im,3)==1)
            colormap(gray);
        end 
        
        %%% load up interest_point file
        load(ip_file_names{index});
        
        %%% loop over all regions, plotting and coloring according to Pw_z
        for c=1:length(x)
            %%% which topic is favoured by the region?
            [tmp,preferred_class]=max([Pw_pos(descriptor_vq(c)) , Pw_neg(descriptor_vq(c))]);
            %%% plot center of region
            plot(x(c),y(c),'Marker','+','MarkerEdgeColor',cols{rem(preferred_class-1,7)+1});
            %%% and circle showing scale
            drawcircle(y(c),x(c),2*scale(c)+1,cols{rem(preferred_class-1,7)+1},1);
            hold on;    
        end
        
        %%% do we plot header information?
        if (Plot.Labels)
           
            %% Label according to correct/incorrect classification
            %% is image above ROC threshold?
            
            above_threshold = (values(index)>roc_threshold_train);
            
            if (above_threshold==labels(index)) %% Correct classification    
                %% show image number and Pz_d
                title(['Correct - Image: ',num2str(index)]);    
            else
                %% show image number and Pz_d
                title(['INCORRECT - Image: ',num2str(index)]);    
            end
            
            fprintf('Image: %d \t Score: %f \t Threshold: %f\n',index,values(index),roc_threshold_train);
        end
    end
    
    pause
    
end 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩欧美在线1卡| 91麻豆精东视频| 精品久久久久久久久久久久久久久久久| 亚洲国产一区在线观看| 日韩视频一区二区在线观看| 国产精品二三区| 欧美最新大片在线看| 日韩影院精彩在线| 精品美女被调教视频大全网站| 国产乱国产乱300精品| 中文字幕一区三区| 欧美性猛交xxxx乱大交退制版| 视频一区二区国产| 国产欧美日韩精品在线| 色哟哟一区二区在线观看| 日韩国产精品大片| 国产人成一区二区三区影院| 91在线国产福利| 无吗不卡中文字幕| 欧美激情艳妇裸体舞| 日本韩国精品一区二区在线观看| 午夜日韩在线电影| 国产三级精品在线| 欧美精品1区2区| 国产91精品精华液一区二区三区 | 中文字幕第一区二区| 波多野结衣亚洲| 亚洲成a人v欧美综合天堂下载| 精品久久久久久久人人人人传媒 | 91精品国产色综合久久不卡蜜臀| 狠狠色狠狠色综合日日91app| 中文字幕亚洲区| 日韩一区二区高清| 99免费精品视频| 久久99国产精品久久| 亚洲欧美另类久久久精品| 久久综合国产精品| 欧美中文字幕一区二区三区亚洲| 国产精品99久久久久久久女警| 亚洲第一激情av| 中文字幕中文字幕一区二区| 日韩一级高清毛片| 欧美午夜精品理论片a级按摩| 韩国成人福利片在线播放| 偷拍与自拍一区| 亚洲狼人国产精品| 国产精品久久久久久久岛一牛影视| 欧美日韩精品是欧美日韩精品| 成人av电影免费观看| 韩国在线一区二区| 琪琪一区二区三区| 午夜电影网亚洲视频| 国产精品成人一区二区艾草| 欧美不卡视频一区| 欧美浪妇xxxx高跟鞋交| 在线中文字幕不卡| 91麻豆精品在线观看| av日韩在线网站| 国产福利不卡视频| 国产伦理精品不卡| 精品一区精品二区高清| 午夜电影网亚洲视频| 亚洲成人免费视频| 亚洲男人电影天堂| 国产日韩欧美综合在线| 亚洲成人免费电影| 亚洲国产日韩精品| 一区二区三区欧美久久| 亚洲三级在线观看| 亚洲欧美中日韩| 国产精品二区一区二区aⅴ污介绍| 国产午夜精品在线观看| 国产欧美日韩在线观看| 久久网站热最新地址| 久久久久久久综合| 国产欧美日韩三级| 日本一区二区视频在线| 国产精品久久久久久久久晋中 | 国产精品国产三级国产a| 国产欧美一区二区精品性色| 国产三区在线成人av| 中文子幕无线码一区tr| 一区在线播放视频| 亚洲激情一二三区| 亚洲第一主播视频| 蜜臀久久久久久久| 国产一区二区三区免费播放| 大尺度一区二区| 色噜噜狠狠色综合欧洲selulu| 在线观看日韩av先锋影音电影院| 欧美日韩精品综合在线| 精品美女被调教视频大全网站| 久久婷婷久久一区二区三区| 国产精品色哟哟网站| 亚洲精品久久久蜜桃| 日韩电影免费在线观看网站| 麻豆91免费观看| 成人免费视频国产在线观看| 91色在线porny| 在线电影欧美成精品| 久久久久久久久岛国免费| 久久精品国内一区二区三区| 午夜精品影院在线观看| 国产女人18毛片水真多成人如厕| 日韩一区日韩二区| 香蕉影视欧美成人| 国产在线麻豆精品观看| 色婷婷亚洲精品| 日韩三级在线观看| 欧美激情在线免费观看| 亚洲一区二区五区| 国产一区二区91| 欧美在线一区二区三区| 欧美电影免费观看高清完整版在线| 国产肉丝袜一区二区| 亚洲一线二线三线视频| 九色porny丨国产精品| 91日韩精品一区| 久久免费国产精品| 亚洲成a人片综合在线| 国产成人免费9x9x人网站视频| 欧美三级欧美一级| 久久精品男人的天堂| 天堂一区二区在线| 91偷拍与自偷拍精品| 欧美一区二区三区在线视频 | 亚洲欧美激情在线| 激情av综合网| 欧美美女一区二区三区| 中文字幕一区不卡| 国产一区 二区| 欧美日韩国产a| 亚洲精品国久久99热| 国产精品乡下勾搭老头1| 欧美另类高清zo欧美| 亚洲精品综合在线| 成人性视频网站| 精品美女一区二区三区| 午夜欧美2019年伦理| 91麻豆国产福利精品| 国产亚洲一区二区三区四区| 日韩精品每日更新| 精品污污网站免费看| 亚洲黄色免费网站| av不卡免费在线观看| 国产亚洲欧美在线| 国产一区二区中文字幕| 制服丝袜亚洲网站| 亚洲一区二区影院| 欧美综合一区二区三区| 亚洲美女屁股眼交| 99精品视频中文字幕| 日本一区二区三区在线不卡| 精品一区二区三区在线观看 | 中文一区二区在线观看 | 国产不卡高清在线观看视频| 精品人在线二区三区| 久久国内精品自在自线400部| 欧美丰满一区二区免费视频| 亚洲国产wwwccc36天堂| 欧美三级视频在线| 爽好久久久欧美精品| 在线综合视频播放| 日韩黄色一级片| 日韩一区二区三区电影| 麻豆一区二区三区| 久久亚洲二区三区| 国产永久精品大片wwwapp| 久久久国产午夜精品| 成人一区二区三区视频在线观看| 中文字幕不卡在线播放| 99在线精品观看| 亚洲欧美日韩电影| 欧美欧美欧美欧美首页| 日韩 欧美一区二区三区| 日韩欧美资源站| 国产高清无密码一区二区三区| 久久久不卡网国产精品二区| 粉嫩蜜臀av国产精品网站| 国产精品久久久久久一区二区三区 | 26uuu欧美| 国产99精品在线观看| 一区二区三区中文字幕电影| 成人av电影在线网| 亚洲成人综合在线| 91精品在线麻豆| 激情综合五月婷婷| 欧美激情在线一区二区三区| 99vv1com这只有精品| 性欧美大战久久久久久久久| 日韩精品自拍偷拍| 国产suv精品一区二区三区| 国产精品国产精品国产专区不片| 91视频精品在这里| 亚洲在线成人精品| 91精品国产色综合久久ai换脸 | 麻豆精品在线播放| 国产精品久久毛片| 欧美精品三级日韩久久| 福利一区二区在线观看|