2022-09-01 18:14:37 +08:00
|
|
|
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
from modelscope.pipelines import pipeline
|
2022-09-08 14:08:51 +08:00
|
|
|
from modelscope.utils.constant import Tasks
|
2022-09-01 18:14:37 +08:00
|
|
|
from modelscope.utils.test_utils import test_level
|
|
|
|
|
|
|
|
|
|
|
2023-05-22 10:53:18 +08:00
|
|
|
class ActionDetectionTest(unittest.TestCase):
|
2022-09-08 14:08:51 +08:00
|
|
|
|
|
|
|
|
def setUp(self) -> None:
|
|
|
|
|
self.task = Tasks.action_detection
|
|
|
|
|
self.model_id = 'damo/cv_ResNetC3D_action-detection_detection2d'
|
2022-09-01 18:14:37 +08:00
|
|
|
|
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
|
|
|
|
|
def test_run(self):
|
2022-09-08 14:08:51 +08:00
|
|
|
action_detection_pipline = pipeline(self.task, model=self.model_id)
|
2022-09-01 18:14:37 +08:00
|
|
|
result = action_detection_pipline(
|
|
|
|
|
'data/test/videos/action_detection_test_video.mp4')
|
|
|
|
|
print('action detection results:', result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
unittest.main()
|