for beamformer in beamformers: mkdir_p(os.path.join(args.output_dir, beamformer,'{}05_{}_{}'.format( stage, env, scenario ))) t_io = 0 t_net = 0 t_beamform = 0 # Beamform loop for cur_line in tqdm(flist): with Timer() as t: if scenario == 'simu': audio_data = get_audio_data(cur_line) context_samples = 0 elif scenario == 'real': audio_data, context_samples = get_audio_data_with_context( cur_line[0], cur_line[1], cur_line[2]) t_io += t.msecs Y = stft(audio_data, time_dim=1).transpose((1, 0, 2)) Y_var = Variable(np.abs(Y).astype(np.float32)) if args.gpu >= 0: Y_var.to_gpu(args.gpu) with Timer() as t: N_masks, X_masks = model.calc_masks(Y_var) N_masks.to_cpu() X_masks.to_cpu() t_net += t.msecs with Timer() as t: N_mask = np.median(N_masks.data, axis=1) X_mask = np.median(X_masks.data, axis=1) Y_hat_dicts = bf_wrapper_on_masks(Y, N_mask, X_mask, beamformers=beamformers)
for env in ['caf', 'bus', 'str', 'ped']: mkdir_p(os.path.join(args.output_dir, '{}05_{}_{}'.format( stage, env, scenario ))) t_io = 0 t_net = 0 t_beamform = 0 # Beamform loop for cur_line in tqdm(flist): with Timer() as t: if scenario == 'simu': audio_data = get_audio_data(cur_line) context_samples = 0 elif scenario == 'real': audio_data, context_samples = get_audio_data_with_context( cur_line[0], cur_line[1], cur_line[2]) t_io += t.msecs Y = stft(audio_data, time_dim=1).transpose((1, 0, 2)) Y_var = Variable(np.abs(Y).astype(np.float32), True) if args.gpu >= 0: Y_var.to_gpu(args.gpu) with Timer() as t: N_masks, X_masks = model.calc_masks(Y_var) N_masks.to_cpu() X_masks.to_cpu() t_net += t.msecs with Timer() as t: N_mask = np.median(N_masks.data, axis=1) X_mask = np.median(X_masks.data, axis=1) Y_hat = gev_wrapper_on_masks(Y, N_mask, X_mask)