Browse Source

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 months ago
parent
commit
df3c559939
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      pipeline/feature_extractors.py

+ 5
- 5
pipeline/feature_extractors.py View File

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


See: https://github.com/jrgillick/laughter-detection for the laughter-detection library 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): def __init__(self, input_files=None, config=None):
"""It is expected that input_files is a SourceMedia object""" """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: config for length adjustments per design doc
TODO: play with numbers more to see what works best TODO: play with numbers more to see what works best
""" """
PREPEND = 7.0
APPEND = 3.0

for feature in self.features: for feature in self.features:
# do the pre & post adjustment # 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): def setup(self):
"""Setup the laughter feature extractor -- validate input files & config """Setup the laughter feature extractor -- validate input files & config


Loading…
Cancel
Save