Mercurial > hg > smallbox
changeset 25:cbf3521c25eb
(none)
author | idamnjanovic |
---|---|
date | Tue, 27 Apr 2010 13:33:13 +0000 |
parents | fc395272d53e |
children | 8a6f9399179b |
files | examples/Automatic Music Transcription/SMALL_AMT_DL_test.m examples/Automatic Music Transcription/SMALL_AMT_KSVD_Err_test.m examples/Automatic Music Transcription/SMALL_AMT_KSVD_Sparsity_test.m examples/Automatic Music Transcription/SMALL_AMT_SPAMS_test.m examples/Image Denoising/SMALL_ImgDenoise_DL_test_KSVDvsSPAMS.m examples/Image Denoising/SMALL_ImgDenoise_DL_test_SPAMS_lambda.m examples/Image Denoising/SMALL_ImgDenoise_DL_test_Training_size.m examples/Pierre Villars/Pierre_Villars_Example.m examples/SMALL_solver_test.m examples/SMALL_solver_test_Audio.m |
diffstat | 10 files changed, 189 insertions(+), 102 deletions(-) [+] |
line wrap: on
line diff
--- a/examples/Automatic Music Transcription/SMALL_AMT_DL_test.m Tue Apr 27 13:33:00 2010 +0000 +++ b/examples/Automatic Music Transcription/SMALL_AMT_DL_test.m Tue Apr 27 13:33:13 2010 +0000 @@ -1,4 +1,14 @@ %% DICTIONARY LEARNING FOR AUTOMATIC MUSIC TRANSCRIPTION EXAMPLE 1 +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2010 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % This file contains an example of how SMALLbox can be used to test diferent % dictionary learning techniques in Automatic Music Transcription problem. % It calls generateAMT_Learning_Problem that will let you to choose midi, @@ -9,7 +19,6 @@ % Problem.p notes spectrograms from training set Problem.b using % dictionary learning technique defined in DL structure. % -% Ivan Damnjanovic 2010 %% clear; @@ -40,7 +49,7 @@ % dictionary elements. Type help ksvd in MATLAB prompt for more options. SMALL.DL(1).param=struct(... - 'Tdata', 3,... + 'Tdata', 10,... 'dictsize', SMALL.Problem.p,... 'iternum', 100); @@ -68,18 +77,19 @@ % Defining the parameters needed for sparse representation -SMALL.solver(1).toolbox='SPAMS'; -SMALL.solver(1).name='mexLasso'; +SMALL.solver(1).toolbox='SMALL'; +SMALL.solver(1).name='SMALL_cgp'; % Here we use mexLasso mode=2, with lambda=2, lambda2=0 and positivity % constrain (type 'help mexLasso' for more information about modes): % % min_{alpha_i} (1/2)||x_i-Dalpha_i||_2^2 + lambda||alpha_i||_1 + (1/2)lambda2||alpha_i||_2^2 -SMALL.solver(1).param=struct(... - 'lambda', 2,... - 'pos', 1,... - 'mode', 2); +SMALL.solver(1).param='20, 1e-2'; +% struct(... +% 'lambda', 2,... +% 'pos', 1,... +% 'mode', 2); % Call SMALL_soolve to represent the signal in the given dictionary. % As a final command SMALL_solve will call above defined reconstruction @@ -99,82 +109,83 @@ %% -% Here we solve the same problem using non-negative sparse coding with -% SPAMS online dictionary learning (Julien Mairal 2009) -% -% Initialising Dictionary structure -% Setting Dictionary structure fields (toolbox, name, param, D and time) -% to zero values - -SMALL.DL(2)=SMALL_init_DL(); - - -% Defining fields needed for dictionary learning - -SMALL.DL(2).toolbox = 'SPAMS'; -SMALL.DL(2).name = 'mexTrainDL'; - -% Type 'help mexTrainDL in MATLAB prompt for explanation of parameters. - -SMALL.DL(2).param=struct(... - 'K', SMALL.Problem.p,... - 'lambda', 3,... - 'iter', 300,... - 'posAlpha', 1,... - 'posD', 1,... - 'whiten', 0,... - 'mode', 2); - -% Learn the dictionary - -SMALL.DL(2) = SMALL_learn(SMALL.Problem, SMALL.DL(2)); - -% Set SMALL.Problem.A dictionary and reconstruction function -% (backward compatiblity with SPARCO: solver structure communicate -% only with Problem structure, ie no direct communication between DL and -% solver structures) - -SMALL.Problem.A = SMALL.DL(2).D; -SMALL.Problem.reconstruct=@(x) SMALL_midiGenerate(x, SMALL.Problem); - -%% -% Initialising solver structure -% Setting solver structure fields (toolbox, name, param, solution, -% reconstructed and time) to zero values -% As an example, SPAMS (Julien Mairal 2009) implementation of LARS -% algorithm is used for representation of training set in the learned -% dictionary. - -SMALL.solver(2)=SMALL_init_solver; - -% Defining the parameters needed for sparse representation - -SMALL.solver(2).toolbox='SPAMS'; -SMALL.solver(2).name='mexLasso'; - -% Here we use mexLasso mode=2, with lambda=3, lambda2=0 and positivity -% constrain (type 'help mexLasso' for more information about modes): -% -% min_{alpha_i} (1/2)||x_i-Dalpha_i||_2^2 + lambda||alpha_i||_1 + (1/2)lambda2||alpha_i||_2^2 - -SMALL.solver(2).param=struct('lambda', 3, 'pos', 1, 'mode', 2); - -% Call SMALL_soolve to represent the signal in the given dictionary. -% As a final command SMALL_solve will call above defined reconstruction -% function to reconstruct the training set (Problem.b) in the learned -% dictionary (Problem.A) - -SMALL.solver(2)=SMALL_solve(SMALL.Problem, SMALL.solver(2)); - -%% -% Analysis of the result of automatic music transcription. If groundtruth -% exists, we can compare transcribed notes and original and get usual -% True Positives, False Positives and False Negatives measures. - -if ~isempty(SMALL.Problem.notesOriginal) - AMT_res(2) = AMT_analysis(SMALL.Problem, SMALL.solver(2)); -end +% % Here we solve the same problem using non-negative sparse coding with +% % SPAMS online dictionary learning (Julien Mairal 2009) +% % +% +% % Initialising Dictionary structure +% % Setting Dictionary structure fields (toolbox, name, param, D and time) +% % to zero values +% +% SMALL.DL(2)=SMALL_init_DL(); +% +% +% % Defining fields needed for dictionary learning +% +% SMALL.DL(2).toolbox = 'SPAMS'; +% SMALL.DL(2).name = 'mexTrainDL'; +% +% % Type 'help mexTrainDL in MATLAB prompt for explanation of parameters. +% +% SMALL.DL(2).param=struct(... +% 'K', SMALL.Problem.p,... +% 'lambda', 3,... +% 'iter', 300,... +% 'posAlpha', 1,... +% 'posD', 1,... +% 'whiten', 0,... +% 'mode', 2); +% +% % Learn the dictionary +% +% SMALL.DL(2) = SMALL_learn(SMALL.Problem, SMALL.DL(2)); +% +% % Set SMALL.Problem.A dictionary and reconstruction function +% % (backward compatiblity with SPARCO: solver structure communicate +% % only with Problem structure, ie no direct communication between DL and +% % solver structures) +% +% SMALL.Problem.A = SMALL.DL(2).D; +% SMALL.Problem.reconstruct=@(x) SMALL_midiGenerate(x, SMALL.Problem); +% +% %% +% % Initialising solver structure +% % Setting solver structure fields (toolbox, name, param, solution, +% % reconstructed and time) to zero values +% % As an example, SPAMS (Julien Mairal 2009) implementation of LARS +% % algorithm is used for representation of training set in the learned +% % dictionary. +% +% SMALL.solver(2)=SMALL_init_solver; +% +% % Defining the parameters needed for sparse representation +% +% SMALL.solver(2).toolbox='SPAMS'; +% SMALL.solver(2).name='mexLasso'; +% +% % Here we use mexLasso mode=2, with lambda=3, lambda2=0 and positivity +% % constrain (type 'help mexLasso' for more information about modes): +% % +% % min_{alpha_i} (1/2)||x_i-Dalpha_i||_2^2 + lambda||alpha_i||_1 + (1/2)lambda2||alpha_i||_2^2 +% +% SMALL.solver(2).param=struct('lambda', 3, 'pos', 1, 'mode', 2); +% +% % Call SMALL_soolve to represent the signal in the given dictionary. +% % As a final command SMALL_solve will call above defined reconstruction +% % function to reconstruct the training set (Problem.b) in the learned +% % dictionary (Problem.A) +% +% SMALL.solver(2)=SMALL_solve(SMALL.Problem, SMALL.solver(2)); +% +% %% +% % Analysis of the result of automatic music transcription. If groundtruth +% % exists, we can compare transcribed notes and original and get usual +% % True Positives, False Positives and False Negatives measures. +% +% if ~isempty(SMALL.Problem.notesOriginal) +% AMT_res(2) = AMT_analysis(SMALL.Problem, SMALL.solver(2)); +% end %% % Plot results and save midi files
--- a/examples/Automatic Music Transcription/SMALL_AMT_KSVD_Err_test.m Tue Apr 27 13:33:00 2010 +0000 +++ b/examples/Automatic Music Transcription/SMALL_AMT_KSVD_Err_test.m Tue Apr 27 13:33:13 2010 +0000 @@ -1,4 +1,14 @@ %% DICTIONARY LEARNING FOR AUTOMATIC MUSIC TRANSCRIPTION +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2010 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % This file contains an example of how SMALLbox can be used to test diferent % dictionary learning techniques in Automatic Music Transcription problem. % It calls generateAMT_Learning_Problem that will let you to choose midi, @@ -9,7 +19,7 @@ % Problem.p notes spectrograms from training set Problem.b using % dictionary learning technique defined in DL structure. % -% Ivan Damnjanovic 2010 + %% clear;
--- a/examples/Automatic Music Transcription/SMALL_AMT_KSVD_Sparsity_test.m Tue Apr 27 13:33:00 2010 +0000 +++ b/examples/Automatic Music Transcription/SMALL_AMT_KSVD_Sparsity_test.m Tue Apr 27 13:33:13 2010 +0000 @@ -1,4 +1,14 @@ %% DICTIONARY LEARNING FOR AUTOMATIC MUSIC TRANSCRIPTION EXAMPLE 1 +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2010 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % This file contains an example of how SMALLbox can be used to test diferent % dictionary learning techniques in Automatic Music Transcription problem. % It calls generateAMT_Learning_Problem that will let you to choose midi, @@ -9,7 +19,6 @@ % Problem.p notes spectrograms from training set Problem.b using % dictionary learning technique defined in DL structure. % -% Ivan Damnjanovic 2010 %% clear;
--- a/examples/Automatic Music Transcription/SMALL_AMT_SPAMS_test.m Tue Apr 27 13:33:00 2010 +0000 +++ b/examples/Automatic Music Transcription/SMALL_AMT_SPAMS_test.m Tue Apr 27 13:33:13 2010 +0000 @@ -1,4 +1,14 @@ %% DICTIONARY LEARNING FOR AUTOMATIC MUSIC TRANSCRIPTION EXAMPLE 1 +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2010 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % This file contains an example of how SMALLbox can be used to test diferent % dictionary learning techniques in Automatic Music Transcription problem. % It calls generateAMT_Learning_Problem that will let you to choose midi, @@ -9,7 +19,6 @@ % Problem.p notes spectrograms from training set Problem.b using % dictionary learning technique defined in DL structure. % -% Ivan Damnjanovic 2010 %% clear;
--- a/examples/Image Denoising/SMALL_ImgDenoise_DL_test_KSVDvsSPAMS.m Tue Apr 27 13:33:00 2010 +0000 +++ b/examples/Image Denoising/SMALL_ImgDenoise_DL_test_KSVDvsSPAMS.m Tue Apr 27 13:33:13 2010 +0000 @@ -1,4 +1,14 @@ %% DICTIONARY LEARNING FOR IMAGE DENOISING +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % This file contains an example of how SMALLbox can be used to test different % dictionary learning techniques in Image Denoising problem. % It calls generateImageDenoiseProblem that will let you to choose image, @@ -16,7 +26,6 @@ % Conference on Machine Learning,Montreal, Canada, 2009 % % -% Ivan Damnjanovic 2010 %% clear;
--- a/examples/Image Denoising/SMALL_ImgDenoise_DL_test_SPAMS_lambda.m Tue Apr 27 13:33:00 2010 +0000 +++ b/examples/Image Denoising/SMALL_ImgDenoise_DL_test_SPAMS_lambda.m Tue Apr 27 13:33:13 2010 +0000 @@ -1,4 +1,14 @@ %% DICTIONARY LEARNING FOR IMAGE DENOISING +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2010 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % This file contains an example of how SMALLbox can be used to test different % dictionary learning techniques in Image Denoising problem. % This example can be used to test SPAMS for different values of @@ -6,7 +16,6 @@ % denoising. It should only give an idea how SMALL structure can be used % for testing. % -% Ivan Damnjanovic 2010 %% clear all;
--- a/examples/Image Denoising/SMALL_ImgDenoise_DL_test_Training_size.m Tue Apr 27 13:33:00 2010 +0000 +++ b/examples/Image Denoising/SMALL_ImgDenoise_DL_test_Training_size.m Tue Apr 27 13:33:13 2010 +0000 @@ -1,4 +1,14 @@ %% DICTIONARY LEARNING FOR IMAGE DENOISING +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 20100 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % This file contains an example of how SMALLbox can be used to test different % dictionary learning techniques in Image Denoising problem. % It calls generateImageDenoiseProblem that will let you to choose image, @@ -17,7 +27,6 @@ % Conference on Machine Learning,Montreal, Canada, 2009 % % -% Ivan Damnjanovic 2010 %% clear all;
--- a/examples/Pierre Villars/Pierre_Villars_Example.m Tue Apr 27 13:33:00 2010 +0000 +++ b/examples/Pierre Villars/Pierre_Villars_Example.m Tue Apr 27 13:33:13 2010 +0000 @@ -1,4 +1,14 @@ %% Pierre Villars Example +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2010 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % This example is based on the experiment suggested by Professor Pierre % Vandergheynst on the SMALL meeting in Villars. % The idea behind is to use patches from source image as a dictonary in @@ -6,8 +16,6 @@ % Calling Pierre_Problem function to get src image to be used as dictionary % and target image to be represented using MP with 3 paches from source image % -% -% Ivan Damnjanovic 2010 %% clear all;
--- a/examples/SMALL_solver_test.m Tue Apr 27 13:33:00 2010 +0000 +++ b/examples/SMALL_solver_test.m Tue Apr 27 13:33:13 2010 +0000 @@ -2,6 +2,16 @@ % Example test of solvers from different toolboxes on Sparco compressed % sensing problems % +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % The main purpose of this example is to show how to use SMALL structure % to solve SPARCO compressed sensing problems (1-11) and compare results % from different solvers. @@ -40,11 +50,8 @@ % polynomial signal" from Sparco. % % -% Ivan Damnjanovic 2009% -% -% SPARCO Copyright 2008, Ewout van den Berg and Michael P. Friedlander -% http://www.cs.ubc.ca/labs/scl/sparco -% $Id: exGPSR.m 1040 2008-06-26 20:29:02Z ewout78 $ + + fprintf('\n\nExample test of SMALL solvers against their counterparts on Sparco problems.\n\n');
--- a/examples/SMALL_solver_test_Audio.m Tue Apr 27 13:33:00 2010 +0000 +++ b/examples/SMALL_solver_test_Audio.m Tue Apr 27 13:33:13 2010 +0000 @@ -1,5 +1,15 @@ function SMALL_solver_test_Audio -% Example test of solvers on Sparco audio source separation problems +%%% Example test of solvers on Sparco audio source separation problems +% +% Centre for Digital Music, Queen Mary, University of London. +% This file copyright 2009 Ivan Damnjanovic. +% +% This program is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2 of the +% License, or (at your option) any later version. See the file +% COPYING included with this distribution for more information. +% % % The main purpose of this example is to show how to use SMALL structure % to solve SPARCO audio source3 separation problems (401-402) and to @@ -36,11 +46,7 @@ % reconstructed signal as well as mixed signal. % % -% Ivan Damnjanovic 2009% -% -% SPARCO Copyright 2008, Ewout van den Berg and Michael P. Friedlander -% http://www.cs.ubc.ca/labs/scl/sparco -% $Id: exGPSR.m 1040 2008-06-26 20:29:02Z ewout78 $ +%% fprintf('\n\nExample test of solvers on Sparco Audio problems (401,402).\n\n');