mirror of
https://github.com/modelscope/modelscope.git
synced 2026-09-01 19:49:03 +02:00
[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:
3
data/test/images/image_phone.jpg
Normal file
3
data/test/images/image_phone.jpg
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:10b494cbc1a29b228745bcb26897e2524569b467b88cc9839be38504d268ca30
|
||||
size 55485
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user