Skip to content

Commit

Permalink
name change
Browse files Browse the repository at this point in the history
  • Loading branch information
shaing10 committed Jul 7, 2024
1 parent 2f351c5 commit 576df82
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions soundbay/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def upload_artifacts(self, audio: torch.Tensor, label: torch.Tensor, raw_wav: to

artifact_wav = torch.squeeze(raw_wav).detach().cpu().numpy()
artifact_wav = artifact_wav / np.expand_dims(np.abs(artifact_wav).max(axis=1) + 1e-8, 1) * 0.5 # gain -6dB
list_of_wavs_objects = [wandb.Audio(data_or_path=wav, caption=f'label_{lab}_{ind}_{round(b_t/sample_rate,3)}sec_{f_n}_train', sample_rate=sample_rate) for wav, ind, lab, b_t, f_n in zip(artifact_wav,idx, label, meta['begin_time'], meta['org_file'])]
list_of_wavs_objects = [wandb.Audio(data_or_path=wav, caption=f'label{lab}_i{ind}_{round(b_t/sample_rate,3)}sec_{f_n}_train', sample_rate=sample_rate) for wav, ind, lab, b_t, f_n in zip(artifact_wav,idx, label, meta['begin_time'], meta['org_file'])]

# Spectrograms batch
artifact_spec = torch.squeeze(audio).detach().cpu().numpy()
Expand All @@ -181,7 +181,7 @@ def upload_artifacts(self, audio: torch.Tensor, label: torch.Tensor, raw_wav: to
specs.append(librosa.display.specshow(artifact_spec[artifact_id,...], ax=ax[1]))
plt.close('all')
del ax
list_of_specs_objects = [wandb.Image(data_or_path=spec, caption=f'label_{lab}_{ind}_{round(b_t/sample_rate,2)}sec_{f_n}train') for spec, ind, lab, b_t, f_n in zip(specs,idx, label, meta['begin_time'], meta['org_file'])]
list_of_specs_objects = [wandb.Image(data_or_path=spec, caption=f'label{lab}_i{ind}_{round(b_t/sample_rate,2)}sec_{f_n}train') for spec, ind, lab, b_t, f_n in zip(specs,idx, label, meta['begin_time'], meta['org_file'])]
log_wavs = {f'First batch {flag} original wavs': list_of_wavs_objects}
log_specs = {f'First batch {flag} augmented spectrogram\'s': list_of_specs_objects}

Expand Down

0 comments on commit 576df82

Please sign in to comment.