FeaturesServer

class features_server.FeaturesServer(features_extractor=None, feature_filename_structure=None, sources=None, dataset_list=None, mask=None, feat_norm=None, global_cmvn=None, dct_pca=False, dct_pca_config=None, sdc=False, sdc_config=None, delta=None, double_delta=None, delta_filter=None, context=None, traps_dct_nb=None, rasta=None, keep_all_features=True)[source]

Management of features. FeaturesServer instances load datasets from a HDF5 files (that can be read from disk or produced by a FeaturesExtractor object) Datasets read from one or many files are concatenated and processed

get_context(feat, start=None, stop=None, label=None)[source]

Add a left and right context to each frame. First and last frames are duplicated to provide context at the begining and at the end

Parameters
  • feat – sequence of feature frames (one fame per line)

  • start – index of the first frame of the selected segment

  • stop – index of the last frame of the selected segment

  • label – vad label if available

Returns

a sequence of frames with their left and right context

get_features(show, channel=0, input_feature_filename=None, label=None, start=None, stop=None)[source]

Get the datasets from a single HDF5 file The HDF5 file is loaded from disk or processed on the fly via the FeaturesExtractor of the current FeaturesServer

Parameters
  • show – ID of the show

  • channel – index of the channel to read

  • input_feature_filename – name of the input file in case it does not include the ID of the show

  • label – vad labels

  • start – index of the first frame of the selected segment

  • stop – index of the last frame of the selected segment

Returns

acoustic parameters and their vad labels

get_tandem_features(show, channel=0, label=None, start=None, stop=None)[source]

Read acoustic parameters from multiple HDF5 files (from disk or extracted by FeaturesExtractor objects).

Parameters
  • show – Id of the show

  • channel – index of the channel

  • label – vad labels

  • start – index of the first frame of the selected segment

  • stop – index of the last frame of the selected segment

Returns

acoustic parameters and their vad labels

get_traps(feat, start=None, stop=None, label=None)[source]

Compute TRAP parameters. The input frames are concatenated to add their left and right context, a Hamming window is applied and a DCT reduces the dimensionality of the resulting vector.

Parameters
  • feat – input acoustic parameters to process

  • start – index of the first frame of the selected segment

  • stop – index of the last frame of the selected segment

  • label – vad label if available

Returns

a sequence of TRAP parameters

load(show, channel=0, input_feature_filename=None, label=None, start=None, stop=None)[source]

Depending of the setting of the FeaturesServer, can either:

  1. Get the datasets from a single HDF5 file

    The HDF5 file is loaded from disk or processed on the fly via the FeaturesExtractor of the current FeaturesServer

  2. Load datasets from multiple input HDF5 files. The datasets are post-processed separately, then concatenated

    and post-process

Parameters
  • show – ID of the show to load (should be the same for each HDF5 file to read from)

  • channel – audio channel index in case the parameters are extracted from an audio file

  • input_feature_filename – name of the input feature file in case it is independent from the ID of the show

  • label – vad labels

  • start – index of the first frame of the selected segment

  • stop – index of the last frame of the selected segment

Returns

acoustic parameters and their vad labels

mean_std(show, channel=0, start=None, stop=None)[source]

Compute the mean and standard deviation vectors for a segment of acoustic features

Parameters
  • show – the ID of the show

  • channel – the index of the channel

  • start – index of the first frame of the selected segment

  • stop – index of the last frame of the selected segment

Returns

the number of frames, the mean of the frames and their standard deviation

post_processing(feat, label, global_mean=None, global_std=None)[source]

After cepstral coefficients, filter banks or bottleneck parameters are computed or read from file post processing is applied.

Parameters
  • feat – the matrix of acoustic parameters to post-process

  • label – the VAD labels for the acoustic parameters

  • global_mean – vector or mean to use for normalization

  • global_std – vector of standard deviation to use for normalization

Returns

the matrix of acoustic parameters ingand their VAD labels after post-process

stack_features(show_list, channel_list=None, feature_filename_list=None, label_list=None, start_list=None, stop_list=None)[source]

Load acoustic features from a list of fils and return them stacked in a 2D-array one line per frame.

Parameters
  • show_list

  • channel_list

  • label_list

  • start_list

  • stop_list

Returns

stack_features_parallel(show_list, channel_list=None, feature_filename_list=None, label_list=None, start_list=None, stop_list=None, num_thread=1)[source]

Load a list of feature files and stack them in a unique ndarray. The list of files to load is splited in sublists processed in parallel

Parameters
  • fileList – a list of files to load

  • numThread – numbe of thead (optional, default is 1)