das.models#

Defines the network architectures.

das.models.stft_res_dense(nb_freq: int, nb_classes: int, nb_hist: int = 1, sample_weight_mode: Optional[str] = None, learning_rate: float = 0.0005, compile: bool = True, stft_compute: bool = False, resnet_compute: bool = False, resnet_train: bool = False, label_smoothing: float = 0, **kwignored)[source]#

Create TCN network with optional trainable STFT layer as pre-processing and downsampling frontend.

Parameters
  • nb_freq (int) – [description]

  • nb_classes (int) – [description]

  • nb_hist (int, optional) – [description]. Defaults to 1.

  • loss (str, optional) – [description]. Defaults to “categorical_crossentropy”.

  • nb_pre_conv (int, optional) – If >0 adds a single STFT layer with a hop size of 2**nb_pre_conv before the TCN. Useful for speeding up training by reducing the sample rate early in the network. Defaults to 0 (no downsampling)

  • pre_nb_dft (int, optional) – Duration of filters (in samples) for the STFT frontend. Number of filters is pre_nb_dft // 2 + 1. Defaults to 64.

  • learning_rate (float, optional) –

  • stft_compute (bool, optional) – Defaults to False.

  • resnet_compute (bool, optional) – Defaults to False.

  • resnet_train (bool, optional) – Fine tune resnet weights. Defaults to False.

  • kwignored (Dict, optional) – additional kw args in the param dict used for calling m(**params) to be ingonred

Returns

Compiled network model.

Return type

[keras.models.Model]

das.models.tcn(*args, **kwargs)[source]#

Synonym for tcn_stft.

das.models.tcn_stft(nb_freq: int, nb_classes: int, nb_hist: int = 1, nb_filters: int = 16, kernel_size: int = 3, nb_conv: int = 1, loss: str = 'categorical_crossentropy', dilations: Optional[List[int]] = None, activation: str = 'norm_relu', use_skip_connections: bool = True, return_sequences: bool = True, dropout_rate: float = 0.0, padding: str = 'same', sample_weight_mode: Optional[str] = None, nb_pre_conv: int = 0, pre_nb_dft: int = 64, nb_lstm_units: int = 0, morph_nb_kernels: int = 1, morph_kernel_duration: int = 32, learning_rate: float = 0.0005, upsample: bool = True, use_separable: bool = False, use_resnet: bool = False, compile: bool = True, **kwignored)[source]#

Create TCN network with optional trainable STFT layer as pre-processing and downsampling frontend.

Parameters
  • nb_freq (int) – [description]

  • nb_classes (int) – [description]

  • nb_hist (int, optional) – [description]. Defaults to 1.

  • nb_filters (int, optional) – [description]. Defaults to 16.

  • kernel_size (int, optional) – [description]. Defaults to 3.

  • nb_conv (int, optional) – [description]. Defaults to 1.

  • loss (str, optional) – [description]. Defaults to “categorical_crossentropy”.

  • dilations (List[int], optional) – [description]. Defaults to [1, 2, 4, 8, 16].

  • activation (str, optional) – [description]. Defaults to ‘norm_relu’.

  • use_skip_connections (bool, optional) – [description]. Defaults to True.

  • return_sequences (bool, optional) – [description]. Defaults to True.

  • dropout_rate (float, optional) – [description]. Defaults to 0.00.

  • padding (str, optional) – [description]. Defaults to ‘same’.

  • nb_pre_conv (int, optional) – If >0 adds a single STFT layer with a hop size of 2**nb_pre_conv before the TCN. Useful for speeding up training by reducing the sample rate early in the network. Defaults to 0 (no downsampling)

  • pre_nb_dft (int, optional) – Duration of filters (in samples) for the STFT frontend. Number of filters is pre_nb_dft // 2 + 1. Defaults to 64.

  • learning_rate (float, optional) –

  • nb_lstm_units (int, optional) – Defaults to 0.

  • morph_nb_kernels (int) – Defaults to 0 (no morphological kernels).

  • morph_kernel_duration (int) – Defaults to 32.

  • upsample (bool, optional) – whether or not to restore the model output to the input samplerate. Should generally be True during training and evaluation but may speed up inference. Defaults to True.

  • use_separable (bool, optional) – use separable convs in residual block. Defaults to False.

  • use_resnet (bool, optional) – Defaults to False.

  • kwignored (Dict, optional) – additional kw args in the param dict used for calling m(**params) to be ingonred

Returns

Compiled TCN network model.

Return type

[keras.models.Model]

das.models.tcn_stft_morph(nb_freq: int, nb_classes: int, nb_hist: int = 1, nb_filters: int = 16, kernel_size: int = 3, nb_conv: int = 1, loss: str = 'categorical_crossentropy', dilations: Optional[List[int]] = None, activation: str = 'norm_relu', use_skip_connections: bool = True, return_sequences: bool = True, dropout_rate: float = 0.0, padding: str = 'same', sample_weight_mode: Optional[str] = None, nb_pre_conv: int = 0, pre_nb_dft: int = 64, nb_lstm_units: int = 0, morph_nb_kernels: int = 1, morph_kernel_duration: int = 33, learning_rate: float = 0.0005, upsample: bool = True, use_separable: bool = False, use_resnet: bool = False, compile: bool = True, **kwignored)[source]#

Create TCN network with optional trainable STFT layer as pre-processing and downsampling frontend.

Parameters
  • nb_freq (int) – [description]

  • nb_classes (int) – [description]

  • nb_hist (int, optional) – [description]. Defaults to 1.

  • nb_filters (int, optional) – [description]. Defaults to 16.

  • kernel_size (int, optional) – [description]. Defaults to 3.

  • nb_conv (int, optional) – [description]. Defaults to 1.

  • loss (str, optional) – [description]. Defaults to “categorical_crossentropy”.

  • dilations (List[int], optional) – [description]. Defaults to [1, 2, 4, 8, 16].

  • activation (str, optional) – [description]. Defaults to ‘norm_relu’.

  • use_skip_connections (bool, optional) – [description]. Defaults to True.

  • return_sequences (bool, optional) – [description]. Defaults to True.

  • dropout_rate (float, optional) – [description]. Defaults to 0.00.

  • padding (str, optional) – [description]. Defaults to ‘same’.

  • nb_pre_conv (int, optional) – If >0 adds a single STFT layer with a hop size of 2**nb_pre_conv before the TCN. Useful for speeding up training by reducing the sample rate early in the network. Defaults to 0 (no downsampling)

  • pre_nb_dft (int, optional) – Duration of filters (in samples) for the STFT frontend. Number of filters is pre_nb_dft // 2 + 1. Defaults to 64.

  • learning_rate (float, optional) –

  • nb_lstm_units (int, optional) – Defaults to 0 (no lstm units).

  • morph_nb_kernels (int) – Defaults to 1 (no morphological kernels).

  • morph_kernel_duration (int) – Defaults to 33.

  • upsample (bool, optional) – whether or not to restore the model output to the input samplerate. Should generally be True during training and evaluation but may speed up inference. Defaults to True.

  • use_separable (bool, optional) – use separable convs in residual block. Defaults to False.

  • use_resnet (bool, optional) – Defaults to False.

  • kwignored (Dict, optional) – additional kw args in the param dict used for calling m(**params) to be ingonred

Returns

Compiled TCN network model.

Return type

[keras.models.Model]