Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tff2020
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
skmad-suite
tff2020
Commits
292cc56b
Commit
292cc56b
authored
5 years ago
by
Marina Kreme
Browse files
Options
Downloads
Patches
Plain Diff
delete
parent
bd022f0f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/tfgm/scripts/solve_Narea_cuicui.m
+0
-192
0 additions, 192 deletions
matlab/tfgm/scripts/solve_Narea_cuicui.m
with
0 additions
and
192 deletions
matlab/tfgm/scripts/solve_Narea_cuicui.m
deleted
100644 → 0
+
0
−
192
View file @
bd022f0f
clc
;
clear
;
close
all
;
%Algo 2
%%
pwd
;
pathname
=
'solve_N_areas_cuicui'
;
if
~
exist
(
'solve_N_areas_cuicui'
,
'dir'
)
mkdir
(
'solve_N_areas_cuicui'
);
end
addpath
(
'solve_N_areas_cuicui'
)
%
%%
ind_loc
=
5
;
% bird
ind_wd
=
3
;
%car
deb_ind_loc
=
0
;
% start for birdong
deb_ind_wd
=
0
;
% start for car
resampling_fs
=
8000
;
% sampling frequency
sig_len
=
16384
;
% siglen
%% DGT params - signals - mask
param_gauss
=
get_win_gauss_param
();
% Gauss
win_len
=
param_gauss
.
win_len
;
win_type
=
param_gauss
.
win_type
;
alpha
=
param_gauss
.
alpha
;
seuil
=
param_gauss
.
seuil
;
radius
=
param_gauss
.
radius
;
[
signals
,
dgt_params
,
signal_params
,
mask
,
dgt
,
idgt
]
=
get_mix
(
ind_loc
,
...
,
ind_wd
,
deb_ind_loc
,
deb_ind_wd
,
resampling_fs
,
sig_len
,
...
,
win_len
,
win_type
,
alpha
,
seuil
,
radius
);
[
mask_area
,
mask_area_ratio
]
=
get_mask_area
(
mask
);
fprintf
(
"We work with %s window of length %.f\n"
,
win_type
,
win_len
);
fprintf
(
"Gabor transform parameters are: \n"
)
fprintf
(
'hop :%2.f\n'
,
dgt_params
.
hop
);
fprintf
(
'n_bins: %2.f\n'
,
dgt_params
.
nbins
);
fprintf
(
"The parameters for smoothing the mask are: \n"
)
fprintf
(
"alpha = %f\n"
,
alpha
);
fprintf
(
"seuil = %f\n"
,
seuil
);
fprintf
(
"radius = %f\n"
,
radius
);
figure
;
% window plot
plot_win
(
dgt_params
.
win
,
signal_params
.
fs
,
signal_params
.
sig_len
,
win_type
)
title
([
num2str
(
win_type
),
' - window'
]);
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
saveas
(
gcf
,
fullfile
(
pathname
,
[
num2str
(
win_type
),
'_window.png'
]));
% mask plot
figure
(
'name'
,
'mask'
);
plot_spectrogram
(
mask
,
dgt_params
,
signal_params
,
dgt
);
title
([
'mask : mask-area = '
,
num2str
(
mask_area
)]);
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
saveas
(
gcf
,
fullfile
(
pathname
,
'gauss_mask.png'
));
%% compute EVD decomposition
[
mask_labels
,
mask_area_list
]
=
make_subregions
(
mask
,
dgt_params
,
signal_params
);
%%
[
gabmul_list
,
mask_list
]
=
get_P_gabmul
(
mask_labels
,
dgt
,
idgt
);
%Halko params
tolerance_arrf
=
1e-6
;
proba_arrf
=
1
-
1e-4
;
x_mix
=
signals
.
mix
;
% mix
masks
=
mask_list
;
% compute EVD usisng Halko
[
t_arrf
,
t_evdn
,
t_ut_x
,
rank_q
,
s_vec_list
,
u_mat_list
,
ut_x_list
,
...
,
r
]
=
compute_decomposition
(
x_mix
,
masks
,
gabmul_list
,
tolerance_arrf
,
proba_arrf
);
%% Plot eigenvalues
figure
;
for
k
=
1
:
length
(
s_vec_list
)
txt
=
[
'Mask ='
num2str
(
k
)];
plot
(
s_vec_list
{
k
},
'LineWidth'
,
3
,
'DisplayName'
,
txt
);
hold
on
;
end
xlabel
(
'$k$'
,
'Interpreter'
,
'latex'
);
ylabel
(
'$\sigma[k]$'
,
'Interpreter'
,
'latex'
);
set
(
gca
,
'YScale'
,
'log'
);
grid
;
legend
show
;
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
saveas
(
gcf
,
fullfile
(
pathname
,
'gabmul_eigenvalues.png'
))
%%
x_engine
=
signals
.
target
;
x_rec
=@
(
lambda_vec
)
compute_estimate
(
lambda_vec
,
x_mix
,
s_vec_list
,
u_mat_list
,
ut_x_list
);
obj_fun
=
@
(
lambda_vec
)
norm
(
x_engine
-
x_rec
(
lambda_vec
));
sdr_engine
=
@
(
lambda_vec
)
sdr
(
x_engine
,
x_rec
(
lambda_vec
));
%%
n_areas
=
length
(
s_vec_list
);
tic
;
lambda_vec_opt
=
fmincon
(
obj_fun
,
zeros
(
n_areas
,
1
));
t1
=
toc
;
%%
fprintf
(
'Running time to tune lambda: %f \n '
,
t1
)
%% Results
tf_mat_mix
=
compute_dgt
(
signals
.
mix
,
dgt
);
x_est
=
x_rec
(
lambda_vec_opt
);
wav_write
(
'x_opt.wav'
,
x_est
,
signal_params
.
fs
);
x_zero
=
x_rec
(
ones
(
n_areas
,
1
));
x_interp
=
solver_tfgm_interp
(
tf_mat_mix
,
mask
,
idgt
);
%% Compute SDR
sdr_opt
=
sdr
(
x_engine
,
x_est
);
sdr_zero
=
sdr
(
x_engine
,
x_zero
);
sdr_mix
=
sdr
(
x_engine
,
x_mix
);
sdr_interp
=
sdr
(
x_engine
,
x_interp
);
fprintf
(
'Optimal SDR: %.f dB\n'
,
sdr_opt
);
fprintf
(
'Zero filling SDR :%.f dB\n'
,
sdr_zero
)
fprintf
(
'Mix SDR: %.1f dB\n'
,
sdr_mix
)
%%
fprintf
(
'Optimal lambda: \n'
);
disp
(
lambda_vec_opt
)
fprintf
(
'Optimal SDR: :%.2e dB\n'
,
sdr_opt
);
fprintf
(
'Zero filling SDR: %.2e dB\n'
,
sdr_zero
);
fprintf
(
'Mix SDR: %.2e dB\n'
,
sdr_mix
);
fprintf
(
'Interp + random phases filling SDR: %e dB\n'
,
sdr_interp
);
%%
figure
;
plot
(
lambda_vec_opt
,
'LineWidth'
,
2
)
ylabel
(
'\lambda^*_k'
)
xlabel
(
'k'
)
set
(
gca
,
'YScale'
,
'log'
);
grid
;
title
([
'Mix SDR= '
,
num2str
(
sdr_mix
),
'dB'
]);
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
saveas
(
gcf
,
fullfile
(
pathname
,
'lambda_opt.pdf'
))
%%
figure
;
set
(
gcf
,
'position'
,[
1
,
1
550
950
]);
subplot
(
321
)
plot_spectrogram
(
signals
.
mix
,
dgt_params
,
signal_params
,
dgt
);
title
([
'Mix SDR= '
,
num2str
(
sdr_mix
),
'dB'
]);
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
axis
square
;
subplot
(
322
)
plot_spectrogram
(
signals
.
target
,
dgt_params
,
signal_params
,
dgt
);
title
(
'True source'
)
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
axis
square
;
subplot
(
323
)
plot_spectrogram
(
signals
.
noise
,
dgt_params
,
signal_params
,
dgt
);
title
(
'Perturbation'
)
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
axis
square
;
subplot
(
324
)
plot_spectrogram
(
x_zero
,
dgt_params
,
signal_params
,
dgt
);
title
([
'Zero fill SDR='
,
num2str
(
sdr_zero
),
'dB'
])
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
axis
square
;
subplot
(
325
)
plot_spectrogram
(
x_interp
,
dgt_params
,
signal_params
,
dgt
);
title
([
'Interp SDR='
,
num2str
(
sdr_interp
),
'dB'
])
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
axis
square
;
subplot
(
326
)
plot_spectrogram
(
x_est
,
dgt_params
,
signal_params
,
dgt
);
title
([
'\lambda^* SDR= '
,
num2str
(
sdr_opt
),
'dB'
])
set
(
gca
,
'FontSize'
,
20
,
'fontName'
,
'Times'
);
axis
square
;
saveas
(
gcf
,
fullfile
(
pathname
,
'spectro_reconstruction.pdf'
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment