luis@199: %% Configuration file used in SMALL_learn luis@199: % luis@228: % Please DO NOT use this file to change the dictionary learning algorithms in SMALLBox luis@228: % If you want to change the dictionary learning algorithms luis@228: % create a copy of this file named 'SMALL_learn_config_local.m' luis@228: % luis@228: % Please refer to the documentation for further information luis@190: luis@199: % Centre for Digital Music, Queen Mary, University of London. luis@199: % This file copyright 2009 Ivan Damnjanovic. luis@199: % luis@199: % This program is free software; you can redistribute it and/or luis@199: % modify it under the terms of the GNU General Public License as luis@199: % published by the Free Software Foundation; either version 2 of the luis@199: % License, or (at your option) any later version. See the file luis@199: % COPYING included with this distribution for more information. luis@199: % luis@199: %% luis@190: luis@199: if strcmpi(DL.toolbox,'KSVD') luis@199: param=DL.param; luis@190: param.data=Problem.b; luis@199: luis@190: D = eval([DL.name,'(param)']);%, ''t'', 5);']); luis@199: elseif strcmpi(DL.toolbox,'KSVDS') luis@199: param=DL.param; luis@190: param.data=Problem.b; luis@190: luis@190: D = eval([DL.name,'(param, ''t'', 5);']); luis@199: elseif strcmpi(DL.toolbox,'SPAMS') luis@190: luis@199: X = Problem.b; luis@190: param=DL.param; luis@190: luis@190: D = eval([DL.name,'(X, param);']); luis@190: % As some versions of SPAMS does not produce unit norm column luis@190: % dictionaries, we need to make sure that columns are normalised to luis@190: % unit lenght. luis@190: luis@190: for i = 1: size(D,2) luis@190: D(:,i)=D(:,i)/norm(D(:,i)); luis@190: end luis@199: elseif strcmpi(DL.toolbox,'SMALL') luis@190: luis@199: X = Problem.b; luis@190: param=DL.param; luis@190: luis@190: D = eval([DL.name,'(X, param);']); luis@190: % we need to make sure that columns are normalised to luis@190: % unit lenght. luis@190: luis@190: for i = 1: size(D,2) luis@190: D(:,i)=D(:,i)/norm(D(:,i)); luis@190: end luis@190: luis@199: elseif strcmpi(DL.toolbox,'TwoStepDL') luis@199: luis@190: DL=SMALL_two_step_DL(Problem, DL); luis@190: luis@190: % we need to make sure that columns are normalised to luis@190: % unit lenght. luis@190: luis@190: for i = 1: size(DL.D,2) luis@190: DL.D(:,i)=DL.D(:,i)/norm(DL.D(:,i)); luis@190: end luis@190: D = DL.D; luis@190: luis@190: elseif strcmpi(DL.toolbox,'MMbox') luis@199: luis@190: DL = wrapper_mm_DL(Problem, DL); luis@190: luis@190: % we need to make sure that columns are normalised to luis@190: % unit lenght. luis@190: luis@190: for i = 1: size(DL.D,2) luis@190: DL.D(:,i)=DL.D(:,i)/norm(DL.D(:,i)); luis@190: end luis@199: D = DL.D; luis@228: luis@228: %% luis@228: % Please do not make any changes to the 'SMALL_learn_config.m' file luis@228: % All the changes should be done to your local configuration file luis@228: % named 'SMALL_learn_config_local.m' luis@228: % luis@190: % To introduce new dictionary learning technique put the files in luis@199: % your Matlab path. Next, unique name for your toolbox needs luis@190: % to be defined and also prefferd API for toolbox functions luis@199: % luis@190: % elseif strcmpi(DL.toolbox,'') luis@190: % % This is an example of API that can be used: luis@190: % % - get training set from Problem part of structure luis@190: % % - assign parameters defined in the main program luis@190: % luis@199: % X = Problem.b; luis@190: % param=DL.param; luis@190: % luis@190: % % - Evaluate the function (DL.name - defined in the main) with luis@190: % % parameters given above luis@190: % luis@190: % D = eval([DL.name,'();']); luis@190: luis@199: else luis@190: printf('\nToolbox has not been registered. Please change SMALL_learn file.\n'); luis@190: return luis@199: end