Преглед изворни кода

refactor: fix path/source/feature_extractor

main
Rob Hallam пре 3 месеци
родитељ
комит
01369f760e
1 измењених фајлова са 9 додато и 2 уклоњено
  1. +9
    -2
      pipeline/feature_extractors.py

+ 9
- 2
pipeline/feature_extractors.py Прегледај датотеку

@@ -5,6 +5,8 @@ import random
import subprocess
from ast import literal_eval
from pipeline.utils import SourceMedia, Feature, Interval
from pipeline.utils import SourceMedia, Source, Feature, Interval

# for loudness detection
import soundfile
import pyloudnorm
@@ -114,7 +116,7 @@ class LaughterFeatureExtractor(FeatureExtractor):
for laugh in laughs:
start, end = laugh
self.features.append(Feature(interval=Interval(start=start, end=end),
source="laughter", path=file.path))
source=file, feature_extractor="laughter"))
# TODO: implement options eg minimum feature length

# adjust features
@@ -165,7 +167,12 @@ class RandomFeatureExtractor(FeatureExtractor):
duration = random.random() * self.MAX_DURATION
start = random.random() * file.duration() - duration
self.features.append(Feature(interval=Interval(start=start, duration=duration),
source="random", path=file.path))
source=file, feature_extractor="random"))

def teardown(self):
pass


class LoudAudioFeatureExtractor(FeatureExtractor):
"""Feature extractor for loud audio detection.



Loading…
Откажи
Сачувај