瀏覽代碼

test: add TestVideoActivityFEFunctional

Tests VAFE using a manually-created 30 seconds video with activity between
15 and 20 seconds.

Relatively quick!
main
Rob Hallam 2 月之前
父節點
當前提交
2e45486372
共有 1 個文件被更改,包括 44 次插入0 次删除
  1. +44
    -0
      test/test_feature_extractors_functional.py

+ 44
- 0
test/test_feature_extractors_functional.py 查看文件

@@ -0,0 +1,44 @@
"""test_feature_extractors_functional.py -- functional tests for feature extractors

This module contains functional tests for FEs using crafted and/or generated media files
to verify that the FEs are working as expected:

- laughter detection -- uses videos with laughs at known times
- video activity -- uses videos with visual activity at known times
- audio loudness -- uses videos with audio at known times

etc.

These tests are marked slow to avoid running them during normal test runs.
"""

import unittest
import pipeline.feature_extractors as extractors
import test.mocks as mocks
class TestVideoActivityFEFunctional(unittest.TestCase):
"""TestVisualActivityFEFunctional -- functional tests for visual activity feature extractor
"""

def test_visual_activity_functional(self):
"""Test visual activity feature extractor

use:
- sample_videos/sample-manual-visualactivity.mp4 :: activity at 15-20s -- pass if activity detected anywhere in this range
"""
SAMPLE_VIDEO = "/home/robert/code/softdev2023-24/summerproject/highlights/test/sample_videos/sample-manual-visualactivity.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.VideoActivityFeatureExtractor(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)

Loading…
取消
儲存