From 0efc8921963c27896bcb7c1fac9698e9277b5cea Mon Sep 17 00:00:00 2001 From: "qize.yqz" Date: Thu, 9 Mar 2023 01:25:06 +0800 Subject: [PATCH] add smoke and fire detection model using damoyolo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增垂域目标检测模型-基于DAMO_YOLO的烟火检测模型 Link: https://code.alibaba-inc.com/Ali-MaaS/MaaS-lib/codereview/11880693 --- .../test/images/image_smokefire_detection.jpg | 3 +++ tests/pipelines/test_tinynas_detection.py | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 data/test/images/image_smokefire_detection.jpg diff --git a/data/test/images/image_smokefire_detection.jpg b/data/test/images/image_smokefire_detection.jpg new file mode 100644 index 00000000..733e1429 --- /dev/null +++ b/data/test/images/image_smokefire_detection.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:713082e6967760d5a0d1ae07af62ecc58f9b8b0ab418394556dc5c6c31c27056 +size 63761 diff --git a/tests/pipelines/test_tinynas_detection.py b/tests/pipelines/test_tinynas_detection.py index 4c3735dc..f7c513ff 100644 --- a/tests/pipelines/test_tinynas_detection.py +++ b/tests/pipelines/test_tinynas_detection.py @@ -196,6 +196,28 @@ 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_smokefire_detection_damoyolo(self): + tinynas_object_detection = pipeline( + Tasks.domain_specific_object_detection, + model='damo/cv_tinynas_object-detection_damoyolo_smokefire') + result = tinynas_object_detection( + 'data/test/images/image_smokefire_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_smokefire_detection_damoyolo_with_image(self): + tinynas_object_detection = pipeline( + Tasks.domain_specific_object_detection, + model='damo/cv_tinynas_object-detection_damoyolo_smokefire') + img = Image.open('data/test/images/image_smokefire_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()