[to #42322933] add head&phone detection models

添加人头检测模型和手机检测模型

Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11519119

* add phone detection models

* add head detection model
This commit is contained in:
lee.lcy
2023-02-08 11:44:56 +00:00
committed by wenmeng.zwm
parent d5ae8ae43b
commit 8cbdf03722
2 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:10b494cbc1a29b228745bcb26897e2524569b467b88cc9839be38504d268ca30
size 55485

View File

@@ -153,6 +153,49 @@ class TinynasObjectDetectionTest(unittest.TestCase, DemoCompatibilityCheck):
OutputKeys.LABELS in result) and (OutputKeys.BOXES in result)
print('results: ', result)
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
def test_phone_detection_damoyolo(self):
tinynas_object_detection = pipeline(
Tasks.domain_specific_object_detection,
model='damo/cv_tinynas_object-detection_damoyolo_phone')
result = tinynas_object_detection('data/test/images/image_phone.jpg')
assert result and (OutputKeys.SCORES in result) and (
OutputKeys.LABELS in result) and (OutputKeys.BOXES in result)
print('results: ', result)
@unittest.skipUnless(test_level() >= 1, 'skip test in current test level')
def test_phone_detection_damoyolo_with_image(self):
tinynas_object_detection = pipeline(
Tasks.domain_specific_object_detection,
model='damo/cv_tinynas_object-detection_damoyolo_phone')
img = Image.open('data/test/images/image_phone.jpg')
result = tinynas_object_detection(img)
assert result and (OutputKeys.SCORES in result) and (
OutputKeys.LABELS in result) and (OutputKeys.BOXES in result)
print('results: ', result)
@unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
def test_head_detection_damoyolo(self):
tinynas_object_detection = pipeline(
Tasks.domain_specific_object_detection,
model='damo/cv_tinynas_head-detection_damoyolo')
result = tinynas_object_detection(
'data/test/images/image_detection.jpg')
assert result and (OutputKeys.SCORES in result) and (
OutputKeys.LABELS in result) and (OutputKeys.BOXES in result)
print('results: ', result)
@unittest.skipUnless(test_level() >= 1, 'skip test in current test level')
def test_head_detection_damoyolo_with_image(self):
tinynas_object_detection = pipeline(
Tasks.domain_specific_object_detection,
model='damo/cv_tinynas_head-detection_damoyolo')
img = Image.open('data/test/images/image_detection.jpg')
result = tinynas_object_detection(img)
assert result and (OutputKeys.SCORES in result) and (
OutputKeys.LABELS in result) and (OutputKeys.BOXES in result)
print('results: ', result)
if __name__ == '__main__':
unittest.main()