class_docstr: Class for sound class embedding training" 
class_docstr_tok: ["Class","for","sound","class","embedding","training","''"]
docstr: Interpration test with overlapped audio
docstr_tok: ["Interpration","test","with","overlapped","audio"]
code: def overlap_test(self, batch):
      """Interpration test with overlapped audio"""
      wavs, _ = batch.sig
      wavs = wavs.to(self.device)
  
      if wavs.shape[0] <= 1:
          return
  
      s1 = wavs[0]
      s1 = s1 / s1.max()
      s2 = wavs[1]
      s2 = s2 / s2.max()
  
      # create the mixture with s2 being the noise (lower gain)
      mix = (s1 * 0.8 + (s2 * 0.2)).unsqueeze(0)
      mix = mix / mix.max()
  
      # get the interpretation spectrogram, phase, and the predicted class
      (
          X_int,
          X_stft_phase,
          pred_cl,
          X_mix,
          mask,
      ) = self.interpret_computation_steps(mix)
      X_int = X_int[0, ...]
      X_stft_phase = X_stft_phase[0, : X_int.shape[0], ...].unsqueeze(0)
      pred_cl = pred_cl[0, ...]
      mask = mask[0, ...]
  
      temp = torch.expm1(X_int).unsqueeze(0).unsqueeze(-1)
      x_int_sb = self.invert_stft_with_phase(temp, X_stft_phase)
  
      # save reconstructed and original spectrograms
      current_class_ind = batch.class_string_encoded.data[0].item()
      current_class_name = self.hparams.label_encoder.ind2lab[
          current_class_ind
      ]
      predicted_class_name = self.hparams.label_encoder.ind2lab[
          pred_cl.item()
      ]
  
      noise_class_ind = batch.class_string_encoded.data[1].item()
      noise_class_name = self.hparams.label_encoder.ind2lab[
          noise_class_ind
      ]
  
      out_folder = os.path.join(
          self.hparams.output_folder,
          "overlap_test",
          f"tc_{current_class_name}_nc_{noise_class_name}_pc_{predicted_class_name}",
      )
      makedirs(
          out_folder,
          exist_ok=True,
      )
  
      torchaudio.save(
          os.path.join(out_folder, "mixture.wav"),
          mix.data.cpu(),
          self.hparams.sample_rate,
      )
  
      torchaudio.save(
          os.path.join(out_folder, "source.wav"),
          s1.unsqueeze(0).data.cpu(),
          self.hparams.sample_rate,
      )
  
      torchaudio.save(
          os.path.join(out_folder, "noise.wav"),
          s2.unsqueeze(0).data.cpu(),
          self.hparams.sample_rate,
      )
  
      torchaudio.save(
          os.path.join(out_folder, "interpretation.wav"),
          x_int_sb.data.cpu(),
          self.hparams.sample_rate,
      )
  
      plt.figure(figsize=(10, 5), dpi=100)
  
      plt.subplot(141)
      X_target = X_mix[0].permute(1, 0)[:, : X_int.shape[1]].cpu()
      plt.imshow(X_target)
      plt.colorbar()
  
      plt.subplot(142)
      plt.imshow(mask.data.cpu().permute(1, 0))
      plt.title("Estimated Mask")
      plt.colorbar()
  
      plt.subplot(143)
      plt.imshow(X_int.data.cpu().permute(1, 0).data.cpu())
      plt.colorbar()
      plt.title("masked")
      plt.savefig(os.path.join(out_folder, "specs.png"))
      plt.close()
  
imports: import os
  import sys
  import torch
  import torchaudio
  import speechbrain
  from hyperpyyaml import load_hyperpyyaml
  from speechbrain.utils.distributed import run_on_main
  from esc50_prepare import prepare_esc50
  from speechbrain.utils.metric_stats import MetricStats
  from os import makedirs
  import torch.nn.functional
  from speechbrain.processing.NMF import spectral_phase
  import matplotlib.pyplot
label_desc: Use image node_id 6 for calling the InterpreterESC50Brain obj's underlying member method code with example usage: obj.overlap_test(batch) without return types