Mercurial > hg > smallbox
changeset 198:83af80baf959 luisf_dev
Reverted SMALL_two_step to the original version; adds path in the Init script.
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Tue, 20 Mar 2012 12:29:47 +0000 |
parents | d00e97b2f1cb |
children | 751fa3bddd30 |
files | DL/two-step DL/SMALL_two_step_DL.m SMALLboxInit.m config/SMALL_two_step_DL_config.m util/SMALL_learn.m |
diffstat | 4 files changed, 10 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/DL/two-step DL/SMALL_two_step_DL.m Tue Mar 20 10:40:59 2012 +0000 +++ b/DL/two-step DL/SMALL_two_step_DL.m Tue Mar 20 12:29:47 2012 +0000 @@ -30,8 +30,7 @@ % initialize the dictionary % -% todo: check second if statement -if (isfield(DL.param,'initdict')) && ~isempty(DL.param.initdict); +if (isfield(DL.param,'initdict')) if (any(size(DL.param.initdict)==1) && all(iswhole(DL.param.initdict(:)))) dico = sig(:,DL.param.initdict(1:dictsize)); else @@ -98,7 +97,6 @@ % want sparse representation of training set, and in Problem.b1 in this % version of software we store the signal that needs to be represented % (for example the whole image) -global SMALL_path tmpTraining = Problem.b1; Problem.b1 = sig; @@ -112,15 +110,11 @@ for i = 1:iternum Problem.A = dico; solver = SMALL_solve(Problem, solver); - - % configuration file - run([SMALL_path '/config/SMALL_two_step_DL_config.m']) - -% [dico, solver.solution] = dico_update(dico, sig, solver.solution, ... -% typeUpdate, flow, learningRate); -% if (decorrelate) -% dico = dico_decorr(dico, mu, solver.solution); -% end + [dico, solver.solution] = dico_update(dico, sig, solver.solution, ... + typeUpdate, flow, learningRate); + if (decorrelate) + dico = dico_decorr(dico, mu, solver.solution); + end if ((show_dictionary)&&(mod(i,show_iter)==0)) dictimg = SMALL_showdict(dico,[8 8],... @@ -145,4 +139,4 @@ Y(blockids) = sum(X(:,blockids).^2); end -end +end \ No newline at end of file
--- a/SMALLboxInit.m Tue Mar 20 10:40:59 2012 +0000 +++ b/SMALLboxInit.m Tue Mar 20 12:29:47 2012 +0000 @@ -1,5 +1,4 @@ global SMALL_path; -SMALL_path=[fileparts(mfilename('fullpath')) filesep]; +SMALL_path = fileparts(mfilename('fullpath')); -% SMALL_p = genpath(SMALL_path); -% addpath(SMALL_p); +addpath(genpath(SMALL_path));
--- a/config/SMALL_two_step_DL_config.m Tue Mar 20 10:40:59 2012 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ - - %DICTIONARY UPDATE STEP - if strcmpi(typeUpdate,'mocod') %if update is MOCOD create parameters structure - mocodParams = struct('zeta',DL.param.zeta,... %coherence regularization factor - 'eta',DL.param.eta,... %atoms norm regularization factor - 'Dprev',dico); %previous dictionary - % dico = dico_update(dico,sig,solver.solution,typeUpdate,flow,learningRate,mocodParams); - if ~isfield(DL.param,'decFcn'), DL.param.decFcn = 'none'; end - - dico = dico_update_mocod(dico,sig,solver.solution,typeUpdate,flow,learningRate,mocodParams); - - else - [dico, solver.solution] = dico_update(dico, sig, solver.solution, ... - typeUpdate, flow, learningRate); - dico = normcols(dico); - end - - switch lower(DL.param.decFcn) - case 'ink-svd' - dico = dico_decorr_symetric(dico,mu,solver.solution); - case 'grassmannian' - [n m] = size(dico); - dico = grassmannian(n,m,[],0.9,0.99,dico); - case 'shrinkgram' - dico = shrinkgram(dico,mu); - case 'iterproj' - dico = iterativeprojections(dico,mu,Problem.b1,solver.solution); - otherwise - end - \ No newline at end of file
--- a/util/SMALL_learn.m Tue Mar 20 10:40:59 2012 +0000 +++ b/util/SMALL_learn.m Tue Mar 20 12:29:47 2012 +0000 @@ -26,7 +26,7 @@ tStart=tic; % configuration file - run([SMALL_path 'config/SMALL_learn_config.m']); + run(fullfile(SMALL_path, 'config/SMALL_learn_config.m')); %% % Dictionary Learning time