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

test: add TestLaughterFEFunctional

Uses a manually-crafted video with laughters between 15-20s.

Test takes LaughFE's internal Feature time adjustment into account (see related
commit).

Note: very slow test

@see: df3c559
main
Rob Hallam пре 1 месец
родитељ
комит
9af169f637
1 измењених фајлова са 35 додато и 0 уклоњено
  1. +35
    -0
      test/test_feature_extractors_functional.py

+ 35
- 0
test/test_feature_extractors_functional.py Прегледај датотеку

@@ -21,6 +21,41 @@ class FEFunctionalTest(unittest.TestCase):
"""
SAMPLE_DIR = "/home/robert/code/softdev2023-24/summerproject/highlights/test/sample_videos"


class TestLaughterFEFunctional(FEFunctionalTest):
"""TestLaughterFEFunctional -- functional tests for laughter detection feature extractor"""

def test_laughter_detection(self):
"""Test laughter detection feature extractor

Uses:
- sample_videos/sample-manual-audio-laughs-video-colours.mp4
:: laughters at 15-20s
-- pass iff laughter features extracted in this range, *but*
NOTE: LaughFE subtracts from start time to capture what preceded the laughter
so we need to subtract this time (and adds a little after too)
FE 'exposes' these as _PREPEND_TIME and _APPEND_TIME
"""
SAMPLE_VIDEO = f"{self.SAMPLE_DIR}/sample-manual-audio-laughs-video-colours.mp4"

START_TIME = 15
END_TIME = 20
# create mock source with the video
source = mocks.MockSource(path=SAMPLE_VIDEO)

# create the feature extractor
testfe = extractors.LaughterFeatureExtractor(input_files=[source])
testfe.setup()
testfe.run()
testfe.teardown()

# check if the feature was extracted:
self.assertTrue(testfe.features)
# check if the feature interval is within the expected range
self.assertTrue(testfe.features[0].interval.start >= (START_TIME - testfe._PREPEND_TIME))
self.assertTrue(testfe.features[0].interval.end <= (END_TIME + testfe._APPEND_TIME))


class TestVideoActivityFEFunctional(FEFunctionalTest):
"""TestVisualActivityFEFunctional -- functional tests for visual activity feature extractor
"""


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