mirror of
https://github.com/modelscope/modelscope.git
synced 2025-12-18 09:17:43 +01:00
明确受影响的模型(damo): ONE-PEACE-4B ModuleNotFoundError: MyCustomPipeline: MyCustomModel: No module named 'one_peace',缺少依赖。 cv_resnet50_face-reconstruction 不兼容tf2 nlp_automatic_post_editing_for_translation_en2de tf2.0兼容性问题,tf1.x需要 cv_resnet18_ocr-detection-word-level_damo tf2.x兼容性问题 cv_resnet18_ocr-detection-line-level_damo tf兼容性问题 cv_resnet101_detection_fewshot-defrcn 模型限制必须detection0.3+torch1.11.0" speech_dfsmn_ans_psm_48k_causal "librosa, numpy兼容性问题 cv_mdm_motion-generation "依赖numpy版本兼容性问题: File ""/opt/conda/lib/python3.8/site-packages/smplx/body_models.py"", cv_resnet50_ocr-detection-vlpt numpy兼容性问题 cv_clip-it_video-summarization_language-guided_en tf兼容性问题 Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/13744636 * numpy and pandas no version * modify compatible issue * fix numpy compatible issue * modify ci * fix lint issue * replace Image.ANTIALIAS to Image.Resampling.LANCZOS pillow compatible * skip uncompatible cases * fix numpy compatible issue, skip cases that can not compatbile numpy or tensorflow2.x * skip compatible cases * fix clip model issue * fix body 3d keypoints compatible issue
59 lines
2.5 KiB
Python
59 lines
2.5 KiB
Python
# Copyright (c) Alibaba, Inc. and its affiliates.
|
|
import unittest
|
|
|
|
from modelscope.pipelines import pipeline
|
|
from modelscope.pipelines.base import Pipeline
|
|
from modelscope.utils.constant import Tasks
|
|
from modelscope.utils.test_utils import test_level
|
|
|
|
|
|
@unittest.skip('For tensorflow 2.x compatible')
|
|
class OCRDetectionTest(unittest.TestCase):
|
|
|
|
def setUp(self) -> None:
|
|
self.model_id = 'damo/cv_resnet18_ocr-detection-line-level_damo'
|
|
self.model_id_vlpt = 'damo/cv_resnet50_ocr-detection-vlpt'
|
|
self.model_id_db = 'damo/cv_resnet18_ocr-detection-db-line-level_damo'
|
|
self.model_id_db_nas = 'damo/cv_proxylessnas_ocr-detection-db-line-level_damo'
|
|
self.test_image = 'data/test/images/ocr_detection.jpg'
|
|
self.test_image_vlpt = 'data/test/images/ocr_detection_vlpt.jpg'
|
|
self.task = Tasks.ocr_detection
|
|
|
|
def pipeline_inference(self, pipeline: Pipeline, input_location: str):
|
|
result = pipeline(input_location)
|
|
print('ocr detection results: ')
|
|
print(result)
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
|
|
def test_run_with_model_from_modelhub(self):
|
|
ocr_detection = pipeline(Tasks.ocr_detection, model=self.model_id)
|
|
self.pipeline_inference(ocr_detection, self.test_image)
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
|
|
def test_run_with_vlpt_with_model_from_modelhub(self):
|
|
ocr_detection = pipeline(Tasks.ocr_detection, model=self.model_id_vlpt)
|
|
self.pipeline_inference(ocr_detection, self.test_image_vlpt)
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
|
|
def test_run_with_db_with_model_from_modelhub(self):
|
|
ocr_detection = pipeline(Tasks.ocr_detection, model=self.model_id_db)
|
|
self.pipeline_inference(ocr_detection, self.test_image)
|
|
|
|
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
|
|
def test_run_with_dbnas_with_model_from_modelhub(self):
|
|
ocr_detection = pipeline(
|
|
Tasks.ocr_detection,
|
|
model=self.model_id_db_nas,
|
|
model_revision='v1.0.0',
|
|
)
|
|
self.pipeline_inference(ocr_detection, self.test_image)
|
|
|
|
@unittest.skipUnless(test_level() >= 2, 'skip test in current test level')
|
|
def test_run_modelhub_default_model(self):
|
|
ocr_detection = pipeline(Tasks.ocr_detection)
|
|
self.pipeline_inference(ocr_detection, self.test_image)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|