ssspy.bss.proxbss#

Algorithms#

class ssspy.bss.proxbss.ProxBSSBase(penalty_fn=None, prox_penalty=None, callbacks=None, scale_restoration=True, record_loss=True, reference_id=0)#

Base class of blind source separation via proximal gradient method.

Parameters:
  • penalty_fn (callable) – Penalty function that determines source model.

  • prox_penalty (callable) – Proximal operator of penalty function. Default: None.

  • callbacks (callable or list[callable], optional) – Callback functions. Each function is called before separation and at each iteration. Default: None.

  • scale_restoration (bool or str) – Technique to restore scale ambiguity. If scale_restoration=True, the projection back technique is applied to estimated spectrograms. You can also specify projection_back explicitly. Default: True.

  • record_loss (bool) – Record the loss at each iteration of the update algorithm if record_loss=True. Default: True.

  • reference_id (int) – Reference channel for projection back. Default: 0.

__call__(*args, n_iter=100, initial_call=True, **kwargs)#

Iteratively call update_once.

Parameters:
  • n_iter (int) – The number of iterations of demixing filter updates. Default: 100.

  • initial_call (bool) – If True, perform callbacks (and computation of loss if necessary) before iterations.

Return type:

ndarray

apply_minimal_distortion_principle()#

Apply minimal distortion principle to estimated spectrograms.

Return type:

None

apply_projection_back()#

Apply projection back technique to estimated spectrograms.

Return type:

None

compute_logdet(demix_filter)#

Compute log-determinant of demixing filter

Parameters:

demix_filter (numpy.ndarray) – Demixing filters with shape of (n_bins, n_sources, n_channels).

Return type:

ndarray

Returns:

numpy.ndarray of computed log-determinant values.

compute_loss()#

Compute loss \(\mathcal{L}\).

Return type:

float

Returns:

Computed loss.

normalize_by_spectral_norm(input, n_penalties=None)#

Spectral normalization.

Parameters:
  • input (numpy.ndarray) – Input spectrogram with shape of (n_channels, n_bins, n_frames).

  • n_penalties (int) – Number of penalty functions, which determines coefficient of normalization.

Return type:

ndarray

Returns:

numpy.ndarray of normalized spectrogram with shape of (n_channels, n_bins, n_frames).

restore_scale()#

Restore scale ambiguity.

If self.scale_restoration=projection_back, we use projection back technique.

Return type:

None

separate(input, demix_filter)#

Separate input using demixing_filter.

\[\boldsymbol{y}_{ij} = \boldsymbol{W}_{i}\boldsymbol{x}_{ij}\]
Parameters:
  • input (numpy.ndarray) – The mixture signal in frequency-domain. The shape is (n_channels, n_bins, n_frames).

  • demix_filter (numpy.ndarray) – The demixing filters to separate input. The shape is (n_bins, n_sources, n_channels).

Return type:

ndarray

Returns:

numpy.ndarray of the separated signal in frequency-domain. The shape is (n_sources, n_bins, n_frames).