You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_movie_scene_segmentation.py 1.7 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Copyright (c) Alibaba, Inc. and its affiliates.
  2. import unittest
  3. from modelscope.pipelines import pipeline
  4. from modelscope.utils.constant import Tasks
  5. from modelscope.utils.demo_utils import DemoCompatibilityCheck
  6. from modelscope.utils.test_utils import test_level
  7. class MovieSceneSegmentationTest(unittest.TestCase, DemoCompatibilityCheck):
  8. def setUp(self) -> None:
  9. self.task = Tasks.movie_scene_segmentation
  10. self.model_id = 'damo/cv_resnet50-bert_video-scene-segmentation_movienet'
  11. @unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
  12. def test_movie_scene_segmentation(self):
  13. input_location = 'data/test/videos/movie_scene_segmentation_test_video.mp4'
  14. movie_scene_segmentation_pipeline = pipeline(
  15. Tasks.movie_scene_segmentation, model=self.model_id)
  16. result = movie_scene_segmentation_pipeline(input_location)
  17. if result:
  18. print(result)
  19. else:
  20. raise ValueError('process error')
  21. @unittest.skipUnless(test_level() >= 2, 'skip test in current test level')
  22. def test_movie_scene_segmentation_with_default_task(self):
  23. input_location = 'data/test/videos/movie_scene_segmentation_test_video.mp4'
  24. movie_scene_segmentation_pipeline = pipeline(
  25. Tasks.movie_scene_segmentation)
  26. result = movie_scene_segmentation_pipeline(input_location)
  27. if result:
  28. print(result)
  29. else:
  30. raise ValueError('process error')
  31. @unittest.skip('demo compatibility test is only enabled on a needed-basis')
  32. def test_demo_compatibility(self):
  33. self.compatibility_check()
  34. if __name__ == '__main__':
  35. unittest.main()