How to use the asteroid.filterbanks function in asteroid

To help you get started, we’ve selected a few asteroid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mpariente / AsSteroid / egs / fuss / baseline / model.py View on Github external
def make_model_and_optimizer(conf):
    """ Function to define the model and optimizer for a config dictionary.
    Args:
        conf: Dictionary containing the output of hierachical argparse.
    Returns:
        model, optimizer.
    The main goal of this function is to make reloading for resuming
    and evaluation very simple.
    """
    # Define building blocks for local model
    # Filterbank can be either stftfb or freefb
    enc, dec = fb.make_enc_dec(**conf['filterbank'])
    mask_conf = dict(conf['masknet'])  # Make a copy
    improved = mask_conf.pop('improved')
    # We will take magnitude and concat with ReIm
    if improved:
        masker = TDCNpp(in_chan=3 * enc.filterbank.n_feats_out // 2,
                        out_chan=enc.filterbank.n_feats_out,
                        n_src=3,  # Hardcoded here because of FUSS
                        **mask_conf)
    else:
        masker = TDConvNet(in_chan=3 * enc.filterbank.n_feats_out // 2,
                           out_chan=enc.filterbank.n_feats_out,
                           n_src=3,  # Hardcoded here because of FUSS
                           **mask_conf)

    model = Model(enc, masker, dec, learnable_scaling=mask_conf["learnable_scaling"])
    # Define optimizer of this model
github mpariente / AsSteroid / egs / wsj0-mix / DeepClustering / model.py View on Github external
def make_model_and_optimizer(conf):
    """ Function to define the model and optimizer for a config dictionary.
    Args:
        conf: Dictionary containing the output of hierachical argparse.
    Returns:
        model, optimizer.
    The main goal of this function is to make reloading for resuming
    and evaluation very simple.
    """
    enc, dec = fb.make_enc_dec('stft', **conf['filterbank'])
    masker = Chimera(enc.n_feats_out // 2,
                     **conf['masknet'])
    model = Model(enc, masker, dec)
    optimizer = make_optimizer(model.parameters(), **conf['optim'])
    return model, optimizer
github mpariente / AsSteroid / egs / wham / ConvTasNet / model.py View on Github external
def make_model_and_optimizer(conf):
    """ Function to define the model and optimizer for a config dictionary.
    Args:
        conf: Dictionary containing the output of hierachical argparse.
    Returns:
        model, optimizer.
    The main goal of this function is to make reloading for resuming
    and evaluation very simple.
    """
    # Define building blocks for local model
    enc, dec = fb.make_enc_dec('free', **conf['filterbank'])
    masker = TDConvNet(in_chan=enc.filterbank.n_feats_out,
                       out_chan=enc.filterbank.n_feats_out,
                       **conf['masknet'])
    model = Model(enc, masker, dec)
    # Define optimizer of this model
    optimizer = make_optimizer(model.parameters(), **conf['optim'])
    return model, optimizer
github mpariente / AsSteroid / egs / wham / FilterbankDesign / model.py View on Github external
def make_model_and_optimizer(conf):
    """ Function to define the model and optimizer for a config dictionary.
    Args:
        conf: Dictionary containing the output of hierachical argparse.
    Returns:
        model, optimizer.
    The main goal of this function is to make reloading for resuming
    and evaluation very simple.
    """
    # Define building blocks for local model
    # The encoder and decoder can directly be made from the dictionary.
    encoder, decoder = fb.make_enc_dec(**conf['filterbank'])

    # The input post-processing changes the dimensions of input features to
    # the mask network. Different type of masks impose different output
    # dimensions to the mask network's output. We correct for these here.
    nn_in = int(encoder.n_feats_out * encoder.in_chan_mul)
    nn_out = int(encoder.n_feats_out * encoder.out_chan_mul)
    masker = TDConvNet(in_chan=nn_in, out_chan=nn_out,
                       **conf['masknet'])
    # Another possibility is to correct for these effects inside of Model,
    # but then instantiation of masker should also be done inside.
    model = Model(encoder, masker, decoder)

    # The model is defined in Container, which is passed to DataParallel.

    # Define optimizer : can be instantiate from dictonary as well.
    optimizer = make_optimizer(model.parameters(), **conf['optim'])
github mpariente / AsSteroid / egs / wham / DPRNN / model.py View on Github external
def make_model_and_optimizer(conf):
    """ Function to define the model and optimizer for a config dictionary.
    Args:
        conf: Dictionary containing the output of hierachical argparse.
    Returns:
        model, optimizer.
    The main goal of this function is to make reloading for resuming
    and evaluation very simple.
    """
    # Define building blocks for local model
    enc, dec = fb.make_enc_dec('free', **conf['filterbank'])
    masker = DPRNN(**conf['masknet'])
    model = Model(enc, masker, dec)
    # Define optimizer of this model
    optimizer = make_optimizer(model.parameters(), **conf['optim'])
    return model, optimizer
github mpariente / AsSteroid / egs / libri_2_mix / ConvTasNet / model.py View on Github external
def make_model_and_optimizer(conf):
    """ Function to define the model and optimizer for a config dictionary.
    Args:
        conf: Dictionary containing the output of hierachical argparse.
    Returns:
        model, optimizer.
    The main goal of this function is to make reloading for resuming
    and evaluation very simple.
    """
    # Define building blocks for local model
    enc, _ = fb.make_enc_dec(fb_name=conf['encoder']['enc_name'],
                             **conf['filterbank'])
    _, dec = fb.make_enc_dec(fb_name=conf['decoder']['dec_name'],
                             n_filters=enc.n_feats_out,
                             kernel_size=conf['filterbank']['kernel_size'],
                             stride=conf['filterbank']['stride'])
    masker = TDConvNet(in_chan=enc.filterbank.n_feats_out,
                       out_chan=enc.filterbank.n_feats_out,
                       **conf['masknet'])
    model = Model(enc, masker, dec)
    # Define optimizer of this model
    optimizer = make_optimizer(model.parameters(), **conf['optim'])
    return model, optimizer
github mpariente / AsSteroid / egs / libri_2_mix / ConvTasNet / model.py View on Github external
def make_model_and_optimizer(conf):
    """ Function to define the model and optimizer for a config dictionary.
    Args:
        conf: Dictionary containing the output of hierachical argparse.
    Returns:
        model, optimizer.
    The main goal of this function is to make reloading for resuming
    and evaluation very simple.
    """
    # Define building blocks for local model
    enc, _ = fb.make_enc_dec(fb_name=conf['encoder']['enc_name'],
                             **conf['filterbank'])
    _, dec = fb.make_enc_dec(fb_name=conf['decoder']['dec_name'],
                             n_filters=enc.n_feats_out,
                             kernel_size=conf['filterbank']['kernel_size'],
                             stride=conf['filterbank']['stride'])
    masker = TDConvNet(in_chan=enc.filterbank.n_feats_out,
                       out_chan=enc.filterbank.n_feats_out,
                       **conf['masknet'])
    model = Model(enc, masker, dec)
    # Define optimizer of this model
    optimizer = make_optimizer(model.parameters(), **conf['optim'])
    return model, optimizer