Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

45 rindas
1.7 KiB

  1. """test_feature_extractors_functional.py -- functional tests for feature extractors
  2. This module contains functional tests for FEs using crafted and/or generated media files
  3. to verify that the FEs are working as expected:
  4. - laughter detection -- uses videos with laughs at known times
  5. - video activity -- uses videos with visual activity at known times
  6. - audio loudness -- uses videos with audio at known times
  7. etc.
  8. These tests are marked slow to avoid running them during normal test runs.
  9. """
  10. import unittest
  11. import pipeline.feature_extractors as extractors
  12. import test.mocks as mocks
  13. class TestVideoActivityFEFunctional(unittest.TestCase):
  14. """TestVisualActivityFEFunctional -- functional tests for visual activity feature extractor
  15. """
  16. def test_visual_activity_functional(self):
  17. """Test visual activity feature extractor
  18. use:
  19. - sample_videos/sample-manual-visualactivity.mp4 :: activity at 15-20s -- pass if activity detected anywhere in this range
  20. """
  21. SAMPLE_VIDEO = "/home/robert/code/softdev2023-24/summerproject/highlights/test/sample_videos/sample-manual-visualactivity.mp4"
  22. START_TIME = 15
  23. END_TIME = 20
  24. # create mock source with the video
  25. source = mocks.MockSource(path=SAMPLE_VIDEO)
  26. # create the feature extractor
  27. testfe = extractors.VideoActivityFeatureExtractor(input_files=[source])
  28. testfe.setup()
  29. testfe.run()
  30. testfe.teardown()
  31. # check if the feature was extracted:
  32. self.assertTrue(testfe.features)
  33. # check if the feature interval is within the expected range
  34. self.assertTrue(testfe.features[0].interval.start >= START_TIME)