2022-09-20 17:49:31 +08:00
|
|
|
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
|
|
|
|
2022-06-28 14:04:40 +08:00
|
|
|
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 GeneralRecognitionTest(unittest.TestCase):
|
2022-09-08 14:08:51 +08:00
|
|
|
|
|
|
|
|
def setUp(self) -> None:
|
|
|
|
|
self.task = Tasks.general_recognition
|
|
|
|
|
self.model_id = 'damo/cv_resnest101_general_recognition'
|
2022-06-28 14:04:40 +08:00
|
|
|
|
2022-08-06 12:22:17 +08:00
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
|
2022-06-28 14:04:40 +08:00
|
|
|
def test_run(self):
|
2022-08-05 17:28:48 +08:00
|
|
|
general_recognition = pipeline(
|
|
|
|
|
Tasks.general_recognition,
|
|
|
|
|
model='damo/cv_resnest101_general_recognition')
|
|
|
|
|
result = general_recognition('data/test/images/dogs.jpg')
|
2022-06-28 14:04:40 +08:00
|
|
|
print(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
unittest.main()
|