dcase_framework.keras_utils.FeatureGenerator

class dcase_framework.keras_utils.FeatureGenerator(*args, **kwargs)[source]

Feature data generator

Constructor

Parameters:

files : list of str

List of active item identifies, usually filenames

data_filenames : dict of dicts

Data structure keyed with item identifiers (defined with files parameter), data dict feature extractor labels as keys and values the filename on disk.

annotations : dict of MetaDataContainers or MetaDataItems

Annotations for all items keyed with item identifiers

class_labels : list of str

Class labels in a list

hop_length_seconds : float

Analysis frame hop length in seconds Default value 0.2

shuffle : bool

Shuffle data before each epoch Default value True

batch_size : int

Batch size to generate Default value 64

buffer_size : int

Internal item buffer size, set large enough for smaller dataset to avoid loading Default value 256

data_processor : class

Data processor class used to process load features

data_refresh_on_each_epoch : bool

Internal data buffer reset at the start of each epoch Default value False

label_mode : str (‘event’, ‘scene’)

Activity matrix forming mode. Default value “event”

__init__(*args, **kwargs)[source]

Constructor

Parameters:

files : list of str

List of active item identifies, usually filenames

data_filenames : dict of dicts

Data structure keyed with item identifiers (defined with files parameter), data dict feature extractor labels as keys and values the filename on disk.

annotations : dict of MetaDataContainers or MetaDataItems

Annotations for all items keyed with item identifiers

class_labels : list of str

Class labels in a list

hop_length_seconds : float

Analysis frame hop length in seconds Default value 0.2

shuffle : bool

Shuffle data before each epoch Default value True

batch_size : int

Batch size to generate Default value 64

buffer_size : int

Internal item buffer size, set large enough for smaller dataset to avoid loading Default value 256

data_processor : class

Data processor class used to process load features

data_refresh_on_each_epoch : bool

Internal data buffer reset at the start of each epoch Default value False

label_mode : str (‘event’, ‘scene’)

Activity matrix forming mode. Default value “event”

Methods

__init__(\*args, \*\*kwargs) Constructor
generator() Generator method
get_activity_matrix(annotation, data_length) Convert annotation into activity matrix and run it through data processor.
info() Information logging
on_epoch_end()
on_epoch_start()
process_item(item)

Attributes

data_size Total data amount
input_size Length of input feature vector
steps_count Number of batches in one epoch