Data
Classes for data handling
Buffers
DataBuffer
dcase_util.data.DataBuffer
Data buffering class, which can be used to store data and meta data associated to the item. Item data is accessed through item key. When internal buffer is filled, oldest item is replaced.
|
Data buffer (First in, first out) |
|
Insert item to the buffer |
|
Get item based on key |
Empty the buffer |
|
Buffer usage |
|
Buffer full |
|
Check that key exists in the buffer |
Encoders
BinaryMatrixEncoder
dcase_util.data.BinaryMatrixEncoder
|
Binary matrix encoder base class |
|
Pad binary matrix along time axis |
|
Visualize binary matrix, and optionally synced data matrix. |
OneHotEncoder
dcase_util.data.OneHotEncoder
|
One hot encoder class |
|
Generate one hot binary matrix |
ManyHotEncoder
dcase_util.data.ManyHotEncoder
|
Many hot encoder class |
|
Generate one hot binary matrix |
EventRollEncoder
dcase_util.data.EventRollEncoder
|
Event list encoder class |
|
Generate event roll from MetaDataContainer |
LabelMatrixEncoder
dcase_util.data.LabelMatrixEncoder
|
Label matrix encoder base class |
OneHotLabelEncoder
dcase_util.data.OneHotLabelEncoder
|
One Hot label encoder class |
|
Generate one hot label matrix |
Data manipulators
Normalizer
dcase_util.data.Normalizer
|
Data normalizer to accumulate data statistics |
|
Log container content |
|
Print container content |
|
Load file |
|
Save file |
Mean vector |
|
Standard deviation vector |
|
Reset internal variables. |
|
|
Accumulate statistics |
Finalize statistics calculation |
|
|
Normalize data matrix with internal statistics of the class. |
RepositoryNormalizer
dcase_util.data.RepositoryNormalizer
|
Data repository normalizer |
|
Load normalizers from disk. |
|
Normalize data repository |
Aggregator
dcase_util.data.Aggregator
Data aggregator can be used to process data matrix in a processing windows. This processing stage can be used to collapse data within certain window lengths by calculating mean and std of them, or flatten the matrix into single vector.
Supported processing methods:
flatten
mean
std
cov
kurtosis
skew
The processing methods can combined.
Usage examples:
1data_aggregator = dcase_util.data.Aggregator(
2 recipe=['mean', 'std'],
3 win_length_frames=10,
4 hop_length_frames=1,
5)
6
7data_stacker = dcase_util.data.Stacker(recipe='mfcc')
8data_repository = dcase_util.utils.Example.feature_repository()
9data_matrix = data_stacker.stack(data_repository)
10data_matrix = data_aggregator.aggregate(data_matrix)
|
Data aggregator |
|
Log container content |
|
Print container content |
|
Load file |
|
Save file |
|
Aggregate data |
Sequencer
dcase_util.data.Sequencer
Sequencer class processes data matrices into sequences (images). Sequences can overlap, and sequencing grid can be altered between calls (shifted).
|
Data sequencer |
|
Log container content |
|
Print container content |
|
Load file |
|
Save file |
|
Convert 2D data matrix into sequence of specified length 2D matrices |
|
Increase temporal shifting |
Stacker
dcase_util.data.Stacker
Data stacking class. Class takes vector recipe and DataRepository, and creates appropriate data matrix.
Vector recipe
With a recipe one can either select full matrix, only part of with start and end index, or select individual rows from it.
Example recipe:
1[
2 {
3 'method': 'mfcc',
4 },
5 {
6 'method': 'mfcc_delta'
7 'vector-index: {
8 'channel': 0,
9 'start': 1,
10 'end': 17,
11 'full': False,
12 'selection': False,
13 }
14 },
15 {
16 'method': 'mfcc_acceleration',
17 'vector-index: {
18 'channel': 0,
19 'full': False,
20 'selection': True,
21 'vector': [2, 4, 6]
22 }
23 }
24]
See dcase_util.utils.VectorRecipeParser
how recipe string can be conveniently used to generate
above data structure.
|
Data stacker |
|
Log container content |
|
Print container content |
|
Load file |
|
Save file |
|
Vector creation based on recipe |
Selector
dcase_util.data.Selector
Data selecting class.
|
Data selector |
|
Log container content |
|
Print container content |
|
Load file |
|
Save file |
|
Selecting data repository with given events |
Masker
dcase_util.data.Masker
Data masking class.
|
Data masker |
|
Log container content |
|
Print container content |
|
Load file |
|
Save file |
|
Masking data repository with given events |
Probabilities
ProbabilityEncoder
dcase_util.data.ProbabilityEncoder
|
Constructor |
|
Log container content |
|
Print container content |
|
Load file |
|
Save file |
Collapse probabilities along time_axis |
|
Collapse probabilities with a sliding window. |
|
|
Binarization |
Decisions
DecisionEncoder
dcase_util.data.DecisionEncoder
|
Constructor |
|
Log container content |
|
Print container content |
|
Load file |
|
Save file |
|
Majority vote. |
|
Many hot |
Find contiguous regions from bool valued numpy.array. |
|
|
Process activity array (binary) |