Commit e63e159e authored by Marina Kreme's avatar Marina Kreme
Browse files

fix bugs

parent a05439ee
Pipeline #5963 passed with stage
in 5 minutes and 43 seconds
......@@ -3,7 +3,7 @@ clc; clear; close all;
% This script allows to reproduce the figures 4 and 5 of the paper [1]
% on a single dataset including engine sound and birdsong.
%
%
%
% [1] Time-frequency fading algorithms based on Gabor multipliers,
% A. Marina Kreme Valentin Emiya, Caroline Chaux, and Bruno Torresani
%%
......@@ -11,7 +11,7 @@ dbstack;
%%
loc_source='bird';
wideband_src='car';
setting = 7;
setting = 6;
if setting == 1
......@@ -22,98 +22,45 @@ if setting == 1
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 1.2
win_type = 'hann';
win_dur = 128/8000;
hop_ratio = 1/4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 1.3
win_type = 'hann';
win_dur = 128/8000;
hop_ratio = 1/4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 1.5
elseif setting == 2
win_type = 'hann';
win_dur = 128/8000;
hop_ratio = 1/4;
nbins_ratio = 4;
win_dur = 256/8000;
hop_ratio = 1/8;
nbins_ratio = 2;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 2
win_type = 'gauss';
win_dur = 128 / 8000;
hop_ratio = 1 / 4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 3
win_type = 'hann';
win_dur = 128 / 8000;
hop_ratio = 1 / 4;
win_dur = 512/8000;
hop_ratio = 1/4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 4
win_type = 'hann';
win_dur = 256 / 8000;
hop_ratio = 1 / 8;
nbins_ratio = 2;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 5
win_type = 'hann';
win_dur = 512 / 8000;
hop_ratio = 1 / 4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 6
win_type = 'hann';
win_dur = 512 / 8000;
hop_ratio = 1 / 8;
win_dur = 512/8000;
hop_ratio = 1/8;
nbins_ratio = 2;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 7
win_type = 'gauss';
win_dur = 256/8000;
hop_ratio = 1 / 4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 7.1
elseif setting == 5
win_type = 'gauss';
win_dur = 256 / 8000;
win_dur = 128 / 8000;
hop_ratio = 1 / 4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 8
elseif setting == 6
win_type = 'gauss';
win_dur = 256 / 8000;
......@@ -122,23 +69,15 @@ elseif setting == 8
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 9
elseif setting == 7
win_type = 'gauss';
win_dur = 256 / 8000;
hop_ratio = 1 / 4;
nbins_ratio = 4;
hop_ratio = 1 / 8;
nbins_ratio = 2;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
elseif setting == 10
win_type = 'gauss';
win_dur = 256 / 8000;
hop_ratio = 1 / 4;
nbins_ratio = 4;
tol_subregions = 0;
[alpha, seuil, radius] = set_smooth_mask_params(wideband_src, loc_source, win_type);
end
......@@ -147,7 +86,7 @@ end
nb_areas='1area';
pwd;
fig_dir =['fig_solve_', nb_areas,'_car_cuicui_', win_type];
fig_dir =['fig_solve_', nb_areas,'_car_bird_', win_type];
if ~exist(fig_dir,'dir')
mkdir(fig_dir);
end
......@@ -165,6 +104,7 @@ fprintf('win_len:%.f\n', length(dgt_params.win));
fprintf('hop:%.f\n', dgt_params.hop);
fprintf('n_bins:%.f\n', dgt_params.nbins);
%% create subregions
mask_bool = mask;
......@@ -278,7 +218,7 @@ plot(lambda_oracle,sdr_wideband(lambda_oracle),'gs','MarkerSize',12);
plot(lambda_est,sdr_wideband(lambda_est),'o','MarkerSize',12)
plot(lambda_true_energy,sdr_wideband(lambda_true_energy),'*','MarkerSize',12)
plot(1,sdr_wideband(1),'o','MarkerSize',12)
legend('SDR', 'TFF-O','TFF-1', 'TFF-E','Zero fill');
legend('SDR', 'TFF-O','TFF-1', 'TFF-P','Zero fill');
xlabel('$\lambda$','Interpreter','latex')
ylabel('SDR(dB)')
......@@ -306,7 +246,7 @@ xlabel('$\lambda$','Interpreter','latex')
ylabel('IS (dB)')
set(gca,'XScale','log');
grid()
legend('SDR','TFF-O','TFF-1','TFF-E','Zero fill')
legend('SDR','TFF-O','TFF-1','TFF-P','Zero fill')
axis tight;
saveas(gcf,fullfile(fig_dir, 'tuning_lambda_IS.pdf'));
......@@ -333,10 +273,8 @@ plot(lambda_oracle, is_wideband(lambda_oracle), 'go','LineWidth',3)
plot(1, is_wideband(1), 'mo','LineWidth',3)
axis tight;
legend('SDR','TFF-1','TFF-E','TFF-O','Zero fill','Location','northwest');
legend('SDR','TFF-1','TFF-P','TFF-P','Zero fill','Location','northwest');
xlabel('$\lambda$','Interpreter','latex')
ylabel('IS divergence')
set(gca, 'FontSize', 20, 'fontName','Times');
......@@ -346,7 +284,7 @@ saveas(gcf,fullfile(fig_dir, 'tuning_lambda_SDR_IS.pdf'));
%% Reconstructed signals
tf_mat_mix = compute_dgt(signals.mix, dgt );
x_oracle = x_rec(lambda_oracle);
wav_write('x_oracle.wav', x_oracle, signal_params.fs);
......@@ -358,16 +296,17 @@ x_true_energy = x_rec(lambda_true_energy);
wav_write('x_true_energy.wav', x_true_energy, signal_params.fs);
x_zero = solver_tfgm_zero(tf_mat_mix, mask, idgt);
x_zero = zero_fill_solver(x_mix, mask, dgt, idgt, dgt_params,...,
signal_params, fig_dir);
wav_write('x_zero_fill.wav', x_zero, signal_params.fs);
x_interp= solver_tfgm_interp(tf_mat_mix, mask, idgt);
x_interp= interpolation_solver(x_mix, mask, dgt, idgt, dgt_params,...,
signal_params, fig_dir);
wav_write('x_interp.wav', x_zero, signal_params.fs);
%% Sdr
sdr_oracle = sdr(x_wideband, x_oracle);
sdr_est = sdr(x_wideband, x_est);
sdr_true_energy = sdr(x_wideband, x_true_energy);
......@@ -386,8 +325,6 @@ is_interp= itakura_saito_dist_spectrum(x_wideband,x_interp);
%%
fprintf('Oracle lambda: %f\n', lambda_oracle);
fprintf('SDR for oracle lambda: %f dB\n',sdr_oracle);
......@@ -436,9 +373,6 @@ axis tight;
saveas(gcf,fullfile(fig_dir,'spectrogram_TFF-O.pdf'));
figure;
plot_spectrogram(x_est, dgt_params, signal_params, dgt)
......@@ -451,9 +385,9 @@ saveas(gcf,fullfile(fig_dir, 'spectrogram_TFF-1.pdf'));
figure;
plot_spectrogram(x_true_energy, dgt_params, signal_params,dgt)
title(['TFF-E SDR= ', num2str(sdr_true_energy,4),'dB ','IS=',num2str(is_true_energy) ])
title(['TFF-P SDR= ', num2str(sdr_true_energy,4),'dB ','IS=',num2str(is_true_energy) ])
set(gca, 'FontSize', 20, 'fontName','Times');
saveas(gcf,fullfile(fig_dir, 'spectrogram_TFF-E.pdf'));
saveas(gcf,fullfile(fig_dir, 'spectrogram_TFF-P.pdf'));
%%
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment