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

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

?? do_plsa_evaluation.m

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

%% Test and plot graphs for a plsa model learnt with do_plsa.m

%% Runs the pLSA procedure, this time holding P(w|z) constant and
%% estimating P(d|z) using a "folding in" procedure. Calls code written
%% by Josef Sivic (josef@robots.ox.ac.uk), based on the paper:
%% 
%%  J. Sivic, B. C. Russell, A. Efros, A. Zisserman and W. T. Freeman,
%%  Discovering objects and their location in images, ICCV 2005.

%% 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 P(d|z) on the testing images. If you want to force it
%% to re-run on the images, then remove the Pd_z_test variable from the
%% model file. 
  
%% Note this only uses a pre-existing model to evaluate the test
%% images. Please use do_plsa to actually learn a pLSA model.  
  
%% 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_plsa - learn a pLSA model.
  
%% R.Fergus (fergus@csail.mit.edu) 03/10/05.  
 
  
%%% figure number to start plotting at  
FIGURE_BASE = 1000;
%%% color order
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);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Test section - run model on testing images only if Pd_z_test does not exist
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if ~exist('Pd_z_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
    
    %% get all file names of testing image interest point files.
    ip_file_names =  genFileNames({Global.Interest_Dir_Name},Categories.All_Test_Frames,RUN_DIR,Global.Interest_File_Name,'.mat',Global.Num_Zeros);

    %% Create matrix to hold word histograms from all images
    X = zeros(VQ.Codebook_Size,length(Categories.All_Test_Frames));

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

    %%% Call actual EM routine again in test mode
    [Pw_z,Pd_z_test,Pz_test,Li_test] = pLSA_EM(X,Pw_z,Learn.Num_Topics,Learn);

    %%% get labels for test frames
    labels = [];
    for a=1:Categories.Number
        labels = [labels , Categories.Labels(a)*ones(1,length(Categories.Test_Frames{a}))];
    end
   
    %%% compute classification performance for each topic
    for t=1:Learn.Num_Topics
        %%% get scores for each image
        values = Pd_z_test(:,t)';
        %%% compute roc
        [roc_curve{t},roc_op(t),roc_area(t),roc_threshold(t)] = roc([values;labels]');
        %%% compute rpc
        [rpc_curve{t},rpc_ap(t),rpc_area(t),rpc_threshold(t)] = recall_precision_curve([values;labels]',length(find(labels==1)));
    end 

    %%% store all test variables in the model
    save(model_fname,'Pd_z_test','Pz_test','Li_test','roc_curve','roc_op','roc_area','roc_threshold','rpc_curve','rpc_ap','rpc_area','rpc_threshold','-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

%% Plot Pw_z as an image - to get an idea of overall entropy
figure(FIGURE_BASE);
imagesc(Pw_z); colormap(gray); colorbar;
set(gca,'XTick',[1:Learn.Num_Topics]);
xlabel('Topic'); ylabel('Word'); title('Pw|z density');

%% Plot Pd_z as an image - to get an idea of overall entropy
figure(FIGURE_BASE+1);
imagesc(Pd_z); colormap(gray); colorbar;
set(gca,'XTick',[1:Learn.Num_Topics]);
xlabel('Topic'); ylabel('Image'); title('Pd|z density');

%% Now lets look at the classification performance
figure(FIGURE_BASE+2);
for t=1:Learn.Num_Topics
    plot(roc_curve{t}(:,1),roc_curve{t}(:,2),cols{rem(t-1,7)+1});
    hold on;
end 
axis([0 1 0 1]); axis square; grid on;
xlabel('P_{fa}'); ylabel('P_d'); title('ROC Curves');

%% Now lets look at the retrieval performance
figure(FIGURE_BASE+3);
for t=1:Learn.Num_Topics
    plot(rpc_curve{t}(:,1),rpc_curve{t}(:,2),cols{rem(t-1,7)+1});
    hold on;
end 
axis([0 1 0 1]); axis square; grid on;
xlabel('Recall'); ylabel('Precision'); title('RPC Curves');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Now plot out example images
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% what crietrion are we going to use to choose the best topic?
if strcmp(Recog.Best_Topic_Criterion,'roc_area')
    topic_scores = roc_area;
    topic_thresholds = roc_threshold;
elseif strcmp(Recog.Best_Topic_Criterion,'roc_op')
    topic_scores = roc_op;
    topic_thresholds = roc_threshold;   
elseif strcmp(Recog.Best_Topic_Criterion,'rpc_ap')
    topic_scores = rpc_ap;
    topic_thresholds = rpc_threshold;    
elseif strcmp(Recog.Best_Topic_Criterion,'rpc_area')
    topic_scores = rpc_area;
    topic_thresholds = rpc_threshold;
else
    error('Unknown criterion for picking the best topic');
end

%% 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 score on best topic
    [tmp,best_topic]  = max(topic_scores);
    [tmp2,plot_order] = sort(-Pd_z(:,best_topic));
elseif strcmp(Plot.Example_Mode,'worst')
    %%% plot ordered by score on worst topic
    [tmp,best_topic]  = max(topic_scores);
    [tmp2,plot_order] = sort(Pd_z(:,best_topic));    
elseif strcmp(Plot.Example_Mode,'borderline')
    %%% images closest to threshold
    [tmp,best_topic]  = max(topic_scores);
    %%% ordering by how close they are to the topic_thresholds...
    [tmp2,plot_order] = sort(abs(Pd_z(:,best_topic)-topic_thresholds(best_topic)));
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);

%%% get labels for test frames
labels = [];
for a=1:Categories.Number
    labels = [labels , Categories.Labels(a)*ones(1,length(Categories.Test_Frames{a}))];
end
    
%% now setup figure and run loop plotting images
figure(FIGURE_BASE+4);
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_topic]=max(Pw_z(descriptor_vq(c),:));
            %%% plot center of region
            plot(x(c),y(c),'Marker','+','MarkerEdgeColor',cols{rem(preferred_topic-1,7)+1});
            %%% and circle showing scale
            drawcircle(y(c),x(c),2*scale(c)+1,cols{rem(preferred_topic-1,7)+1},1);
            hold on;    
        end
        
        %%% do we plot header information?
        if (Plot.Labels)
           
            %% get Pz_d for image, from Pd_z
            %% now get joint
            Pdz_test = Pd_z_test(index,:) .* Pz_test;
            Pz_d_test = Pdz_test / sum(Pdz_test);
            
            %% Label according to correct/incorrect classification
            %% is image above threshold?
            
            [tmp,best_topic]  = max(topic_scores);
            above_threshold = (Pd_z(index,best_topic)>topic_thresholds(best_topic));
            
            if (above_threshold==labels(index)) %% Correct classification    
                %% show image number and Pz_d
                title(['Correct - Image: ',num2str(index),' P(z|d)=',num2str(Pz_d_test)]);    
            else
                %% show image number and Pz_d
                title(['INCORRECT - Image: ',num2str(index),' P(z|d)=',num2str(Pz_d_test)]);    
            end
            
            fprintf('Image: %d \t Score: %f \t Threshold: %f\n',index,Pd_z(index,best_topic),topic_thresholds(best_topic));
        end
    end
    
    pause
    
end 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日本一区二区三区四区| 国产精品成人免费| 国产精品素人视频| 亚洲国产精品久久一线不卡| 激情成人综合网| 91精彩视频在线观看| 久久久蜜臀国产一区二区| 一卡二卡欧美日韩| 国产在线一区二区综合免费视频| 91农村精品一区二区在线| 日韩一区二区三区四区 | 美日韩一级片在线观看| 99riav久久精品riav| 欧美一区二区三区四区久久| 中文字幕一区三区| 国产一区二区成人久久免费影院| 欧美自拍偷拍一区| 久久久99精品免费观看| 免费观看久久久4p| 欧美性猛片xxxx免费看久爱| 国产精品色哟哟| 国产一区二区精品久久| 日韩一级大片在线| 亚洲电影第三页| 色婷婷久久99综合精品jk白丝| 久久久久99精品国产片| 麻豆精品一二三| 欧美日韩视频在线一区二区| 亚洲色图都市小说| 不卡视频一二三| 国产日产欧美一区二区三区| 国产制服丝袜一区| 久久综合成人精品亚洲另类欧美 | 欧美中文一区二区三区| 国产精品丝袜一区| 国产麻豆午夜三级精品| 精品国精品国产| 奇米一区二区三区av| 91精品在线麻豆| 日本sm残虐另类| 欧美一区二区三区白人| 青青草国产成人99久久| 欧美一区二区三区视频免费播放| 亚洲成人动漫av| 在线播放91灌醉迷j高跟美女| 亚洲最大成人网4388xx| 欧洲av在线精品| 亚洲国产欧美日韩另类综合| 欧美麻豆精品久久久久久| 亚洲成人免费av| 欧美精品一级二级三级| 日韩成人午夜电影| 欧美xxxx老人做受| 国产成人日日夜夜| 国产精品视频一区二区三区不卡| 成人app下载| 一区二区三区美女视频| 欧美三级视频在线| 日韩精品一区第一页| 日韩手机在线导航| 紧缚捆绑精品一区二区| 久久久久亚洲综合| 91在线观看污| 午夜免费久久看| 精品久久久久一区| av亚洲精华国产精华精华| 一区二区三区欧美日韩| 91麻豆精品国产自产在线观看一区| 久久精品72免费观看| 久久久噜噜噜久久人人看 | 国产精品69毛片高清亚洲| 亚洲欧洲成人自拍| 欧美精品一卡两卡| 国产91在线|亚洲| 亚洲精品高清在线观看| 日韩一级精品视频在线观看| youjizz国产精品| 亚洲综合图片区| wwwwww.欧美系列| 在线观看日产精品| 久久国产夜色精品鲁鲁99| 中文字幕不卡在线播放| 欧美精品亚洲一区二区在线播放| 国产一区在线精品| 亚洲制服丝袜av| 欧美国产在线观看| 91精品国产综合久久香蕉的特点| 粉嫩av亚洲一区二区图片| 亚洲成人黄色影院| 欧美韩日一区二区三区| 欧美一区二区三区不卡| 色偷偷88欧美精品久久久| 精品午夜久久福利影院| 亚洲图片自拍偷拍| 国产精品久久久久aaaa| 精品精品欲导航| 欧美性大战久久久久久久| 丁香桃色午夜亚洲一区二区三区| 日日夜夜一区二区| 亚洲你懂的在线视频| 国产日韩欧美不卡在线| 日韩欧美成人一区二区| 欧美性生活久久| 91免费看片在线观看| 国产精品一二三区在线| 六月丁香综合在线视频| 午夜视频一区二区三区| 亚洲乱码日产精品bd| 国产精品色哟哟| 国产欧美日韩在线视频| 欧美xxxx老人做受| 日韩一区二区精品在线观看| 欧洲av一区二区嗯嗯嗯啊| 97国产精品videossex| 国产不卡一区视频| 精久久久久久久久久久| 日韩av不卡在线观看| 亚洲成人tv网| 午夜免费久久看| 亚洲午夜一区二区三区| 亚洲一区二区在线播放相泽| 亚洲久本草在线中文字幕| 亚洲欧美在线观看| 中文字幕日韩一区二区| 综合在线观看色| 亚洲人成在线播放网站岛国 | 久久久噜噜噜久噜久久综合| 欧美电影免费观看高清完整版在线观看| 欧洲精品一区二区| 欧美日本免费一区二区三区| 欧美喷潮久久久xxxxx| 欧美日韩亚洲国产综合| 欧美性大战久久久| 69精品人人人人| 精品国产一区a| 国产农村妇女精品| 亚洲色大成网站www久久九九| 国产精品久久久久久久久晋中| 日本一区二区视频在线| 亚洲欧洲无码一区二区三区| 亚洲卡通动漫在线| 日韩国产欧美在线播放| 欧美96一区二区免费视频| 国内精品伊人久久久久av一坑| 高清成人在线观看| 欧美中文字幕一区二区三区亚洲| 欧美日韩高清一区二区| 欧美一级国产精品| 国产色91在线| 亚洲乱码国产乱码精品精98午夜| 亚洲国产裸拍裸体视频在线观看乱了| 亚洲不卡在线观看| 国产精品1区2区3区在线观看| 97精品久久久午夜一区二区三区| 欧美色图天堂网| www精品美女久久久tv| 亚洲欧美日韩精品久久久久| 视频一区二区中文字幕| 国产成人激情av| 日本福利一区二区| 欧美电影免费观看高清完整版在 | 免费国产亚洲视频| 成+人+亚洲+综合天堂| 欧美日韩高清一区| 欧美激情综合网| 亚洲电影在线播放| 国产精品99久久久久久久vr | 欧美日韩1234| 国产女同互慰高潮91漫画| 亚洲一区在线观看视频| 久草热8精品视频在线观看| 91美女视频网站| 久久久久免费观看| 亚洲成人激情av| 91香蕉视频黄| 国产午夜精品一区二区三区视频 | 美女任你摸久久| 91美女精品福利| 久久这里只有精品视频网| 亚洲国产日产av| 成人白浆超碰人人人人| 日韩午夜激情免费电影| 一区二区三区欧美久久| 成人综合婷婷国产精品久久免费| 正在播放一区二区| 亚洲综合色网站| 成人h动漫精品| 久久久久久久综合日本| 蜜乳av一区二区三区| 欧美日韩一区久久| 亚洲女人的天堂| 成人黄色片在线观看| 精品99一区二区三区| 五月天视频一区| 日本精品视频一区二区三区| 亚洲国产精品av| 国产综合久久久久影院| 日韩一区二区精品| 人人狠狠综合久久亚洲| 欧美日韩免费观看一区三区|