-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipelines.py
47 lines (37 loc) · 1.69 KB
/
pipelines.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""
End to end proccesses defined by a sequence of procedures of the same kind
"""
from pathlib import Path
from config import FEATURES_DATA_PATH, RAW_DATA_PATH
from features import DoubleHPSSFeatureExtractor, VoiceActivationFeatureExtractor, MeanSVDFeatureExtractor, \
SVDPonderatedVolumeFeatureExtractor, IntensitySplitterFeatureExtractor, \
SingingVoiceSeparationOpenUnmixFeatureExtractor
class FeatureExtractionPipeline:
def __init__(self, feature_path=FEATURES_DATA_PATH, raw_path=RAW_DATA_PATH):
self.feature_path = feature_path
self.raw_path = raw_path
self.pipeline = []
self.instanced_extractors = []
def execute(self):
if not self.pipeline:
raise NotImplementedError('self.pipeline is undefined: {}'.format(self.pipeline))
for step_proccess in self.pipeline:
print('info: initializing transform: {}'.format(step_proccess))
extractor = step_proccess.magic_init(self.feature_path, self.raw_path)
extractor.transform()
self.instanced_extractors.append(extractor)
print('info: transformed!')
class SVDPipeline(FeatureExtractionPipeline):
def __init__(self, feature_path, raw_path):
super().__init__(feature_path, raw_path)
self.pipeline = [
SingingVoiceSeparationOpenUnmixFeatureExtractor,
DoubleHPSSFeatureExtractor,
VoiceActivationFeatureExtractor,
MeanSVDFeatureExtractor,
SVDPonderatedVolumeFeatureExtractor,
IntensitySplitterFeatureExtractor
]
if __name__ == '__main__':
p = SVDPipeline(Path('E:/aidio_data/features'), Path('E:/parsed_singers.v2'))
p.execute()