[WIP] refactor filtering and scaling of spectrograms #405
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request
This PR refactors the filtering and scaling of spectrograms to be more memory efficient. Memory savings are mostly due to casting several objects to numpy arrays earlier than before and hence freeing memory by discarding references.
Additional options for
stft()
allow further memory savings, e.g. by computing only real-valued magnitude spectrograms (viacomplex=False
) or filtering the magnitude spectrogram by passing afilterbank
and perform this filtering in blocks (by passingblock_size
).The changes come with an API change of
FilterbankProcessor
(which was never used anywhere in our own code).This pull request fixes #248, and mitigates #404.
Remaining TODOs before this pull request can be merged
ScalingProcessor
complex
andcircular_shift
could/should be unifiedblock_size
is used already byStrideLayer
, but this layer does not accept additionalkwargs
, thus there is no direct naming conflict, still it is not optimal