Mercurial > hg > scatter_reeval
comparison reeval/features/extract_features.m @ 2:b1cd83874633
Major structural revision. Modular organization of functionalities
author | Francisco Rodriguez Algarra <f.rodriguezalgarra@qmul.ac.uk> |
---|---|
date | Wed, 28 Oct 2015 16:15:47 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:9a37f107f089 | 2:b1cd83874633 |
---|---|
1 function [features] = extract_features(experiment, N, options) | |
2 | |
3 switch(experiment) | |
4 | |
5 case 'mfcc_740ms' | |
6 | |
7 filters = filter_bank(N, options.filt1_opt); | |
8 features = {@(x)(feval(@(x)(... | |
9 [x;... | |
10 circshift(x, [0 +1]); ... | |
11 circshift(x, [0 -1])]),... | |
12 format_scat(log_scat(... | |
13 spec_freq_average(x, filters, options.sc1_opt)))))}; | |
14 | |
15 case {'time_scat_l1', 'time_scat_l2', 'time_scat_l3'} | |
16 | |
17 Wop = wavelet_factory_1d(N, options.filt1_opt, options.sc1_opt); | |
18 features = {@(x)(format_scat(log_scat(... | |
19 renorm_scat(scat(x, Wop)))))}; | |
20 | |
21 case {'time_freq_scat_l2', 'time_freq_scat_l2_adap_q1'} | |
22 | |
23 Wop1 = wavelet_factory_1d(N, options.filt1_opt, options.sc1_opt); | |
24 fWop1 = wavelet_factory_1d(... | |
25 128, options.ffilt1_opt, options.fsc1_opt); | |
26 | |
27 scatt_fun1 = @(x)(log_scat(renorm_scat(scat(x, Wop1)))); | |
28 fscatt_fun1 = @(x)(func_output(@scat_freq, 2, scatt_fun1(x), fWop1)); | |
29 feature_fun1 = @(x)(format_scat(fscatt_fun1(x))); | |
30 | |
31 switch(experiment) | |
32 | |
33 case 'time_freq_scat_l2' | |
34 | |
35 features = {feature_fun1} | |
36 | |
37 case 'time_freq_scat_l2_adap_q1' | |
38 | |
39 Wop2 = wavelet_factory_1d(N, options.filt2_opt, options.sc2_opt); | |
40 fWop2 = wavelet_factory_1d(... | |
41 32, options.ffilt2_opt, options.fsc2_opt); | |
42 | |
43 scatt_fun2 = @(x)(log_scat(renorm_scat(scat(x, Wop2)))); | |
44 fscatt_fun2 = @(x)(func_output(@scat_freq, 2, scatt_fun2(x), fWop2)); | |
45 feature_fun2 = @(x)(format_scat(fscatt_fun2(x))); | |
46 | |
47 features = {feature_fun1, feature_fun2}; | |
48 | |
49 end | |
50 | |
51 for k = 1:length(features) | |
52 fprintf('testing feature #%d...', k); | |
53 tic; | |
54 sz = size(features{k}(randn(N, 1))); | |
55 aa = toc; | |
56 fprintf('Ok (%.2fs) (size [%d, %d])\n', aa, sz(1), sz(2)); | |
57 end | |
58 | |
59 otherwise | |
60 error(['Unknown experiment ', experiment, '. Aborting']); | |
61 end | |
62 | |
63 end |