2022-12-16 13:24:02 +08:00
|
|
|
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
from modelscope.pipelines import pipeline
|
|
|
|
|
from modelscope.utils.constant import Tasks
|
|
|
|
|
from modelscope.utils.test_utils import test_level
|
|
|
|
|
|
|
|
|
|
|
2023-05-22 10:53:18 +08:00
|
|
|
class ObjectDetectionTest(unittest.TestCase):
|
2022-12-16 13:24:02 +08:00
|
|
|
|
|
|
|
|
def setUp(self) -> None:
|
2023-01-02 12:14:49 +08:00
|
|
|
self.task = Tasks.domain_specific_object_detection
|
2022-12-16 13:24:02 +08:00
|
|
|
self.model_id = 'damo/cv_yolox-pai_hand-detection'
|
|
|
|
|
|
2023-05-22 10:53:18 +08:00
|
|
|
@unittest.skip('skip test in current test level: no pipeline implemented')
|
2022-12-16 13:24:02 +08:00
|
|
|
def test_hand_detection_pipeline(self):
|
|
|
|
|
test_image = 'data/test/images/hand_detection.jpg'
|
|
|
|
|
|
|
|
|
|
hand_detection = pipeline(self.task, model=self.model_id)
|
|
|
|
|
|
|
|
|
|
result = hand_detection(test_image)
|
|
|
|
|
hand_detection.show_result(test_image, result,
|
|
|
|
|
'hand_detection_ret.jpg')
|
|
|
|
|
|
|
|
|
|
print(f'hand detection result={result}')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
unittest.main()
|