瀏覽代碼

refactor: expose prepend and append tmies in LaughFE

To help functional testing, LaughFE's internal adjustment times are exposed.

Recap: when a laugh is detected by LaughFE, the time of the laugh itself it not
used directly; instead, the resulting Feature has some time prepended to try to
capture the thing that caused the laugh.

When functional testing the FEs we set up specially-crafted videos with features
at known points, so to make sure the LaughterFE is tested correctly we adjust
the tests by the amount of time the FE adjusts by so that it properly tests the
intended behaviour.

@see:
 - feature_extractors.py::LaughterFeatureExtractor
main
Rob Hallam 2 月之前
父節點
當前提交
df3c559939
共有 1 個檔案被更改,包括 5 行新增5 行删除
  1. +5
    -5
      pipeline/feature_extractors.py

+ 5
- 5
pipeline/feature_extractors.py 查看文件

@@ -47,6 +47,9 @@ class LaughterFeatureExtractor(FeatureExtractor):

See: https://github.com/jrgillick/laughter-detection for the laughter-detection library
"""
_PREPEND_TIME = 7.0 # seconds before the laugh
_APPEND_TIME = 3.0 # seconds after the laugh


def __init__(self, input_files=None, config=None):
"""It is expected that input_files is a SourceMedia object"""
@@ -94,13 +97,10 @@ class LaughterFeatureExtractor(FeatureExtractor):
TODO: config for length adjustments per design doc
TODO: play with numbers more to see what works best
"""
PREPEND = 7.0
APPEND = 3.0

for feature in self.features:
# do the pre & post adjustment
feature.interval.move_start(-PREPEND, relative=True)
feature.interval.move_end(APPEND, relative=True)
feature.interval.move_start(-self._PREPEND_TIME, relative=True)
feature.interval.move_end(self._APPEND_TIME, relative=True)

def setup(self):
"""Setup the laughter feature extractor -- validate input files & config


Loading…
取消
儲存