⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sample_script_learn.m

📁 Standard model object recognition matlab code
💻 M
字号:
% sample_script_learn.m%% It is an example of how to run the model on multiple images (of% the same size).% Define file names to intermediate, learned features.global learn_file;learn_file{3} = './Data/f_S2b_my_learn';learn_file{5} = './Data/f_S2_my_learn';learn_file{7} = './Data/f_S3_my_learn';learn_file{9} = './Data/f_S4_my_learn';stim_dir = './Images/'; save_dir = './Model_Resp/';level = [1 1]; % Upto C2b, bypass route only, and save C2bs_lvl = [0 1];r_out = main_model_load_save(stim_dir,level,s_lvl,save_dir);stim_dir = './Model_Resp/Layer2/';% Case 1: Learn S2bf = learn_filters_load_save(stim_dir,learn_file{3},3); % Case 2: Learn S2f = learn_filters_load_save(stim_dir,learn_file{5},5);% Case 3: Learn S3 (based on learned S2 features)stim_dir = './Model_Resp/Layer2/';save_dir = './Model_Resp/';level = [0 0 0 0 1 1];s_lvl = [0 0 0 0 1 1];r_out = main_model_load_save(stim_dir,level,s_lvl,save_dir);save_dir = './Model_Resp/Layer6/';f = learn_filters_load_save(save_dir,learn_file{7},7);% Note that the learning from a small database of images will% create learn_file's with a small number of features, and there% will be some conflicts with init_filter_def.m.  Therefore,% consider augmenting the learned features with random values or% copies of itself.  For example,if 1  which_learn_file = 3;  load(learn_file{which_learn_file});  s_tag = '_s3';  new_num_feat = 2000;   old_num_feat = f.size_s3(4);  % Take the first 400 learned features and repeat them.  Note that  % this number may be smaller/larger depending on the size of  % learned images.  f1 = f.f1_s3(:,1:400);  f2 = f.f2_s3(:,1:400);  i1 = f.i1_s3(:,1:400);  i2 = f.i2_s3(:,1:400);  i3 = f.i3_s3(:,1:400);  siz = [f.size_s3(1:3) new_num_feat];  shift = f.shift_s3;  f1_new = repmat(f1, [1 5]);  f2_new = repmat(f2, [1 5]);  i1_new = repmat(i1, [1 5]);   i2_new = repmat(i2, [1 5]);   i3_new = repmat(i3, [1 5]);   f_old = f;  f_new = struct('f1_s3', f1_new, 'f2_s3', f2_new, ...      'i1_s3', i1_new, 'i2_s3', i2_new, 'i3_s3', i3_new, ...      'size_s3', siz, 'shift_s3', shift);  f = f_new;  save(learn_file{which_learn_file}, 'f');end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -