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_action_detection.py 1.0 kB

1234567891011121314151617181920212223242526272829
  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 ActionDetectionTest(unittest.TestCase, DemoCompatibilityCheck):
  8. def setUp(self) -> None:
  9. self.task = Tasks.action_detection
  10. self.model_id = 'damo/cv_ResNetC3D_action-detection_detection2d'
  11. @unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
  12. def test_run(self):
  13. action_detection_pipline = pipeline(self.task, model=self.model_id)
  14. result = action_detection_pipline(
  15. 'data/test/videos/action_detection_test_video.mp4')
  16. print('action detection results:', result)
  17. @unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
  18. def test_demo_compatibility(self):
  19. self.compatibility_check()
  20. if __name__ == '__main__':
  21. unittest.main()