You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

test_shop_segmentation.py 876 B

123456789101112131415161718192021222324
  1. # Copyright (c) Alibaba, Inc. and its affiliates.
  2. import unittest
  3. from modelscope.outputs import OutputKeys
  4. from modelscope.pipelines import pipeline
  5. from modelscope.utils.constant import Tasks
  6. from modelscope.utils.test_utils import test_level
  7. class ShopSegmentationTest(unittest.TestCase):
  8. @unittest.skipUnless(test_level() >= 0, 'skip test in current test level')
  9. def test_shop_segmentation(self):
  10. input_location = 'data/test/images/shop_segmentation.jpg'
  11. model_id = 'damo/cv_vitb16_segmentation_shop-seg'
  12. shop_seg = pipeline(Tasks.shop_segmentation, model=model_id)
  13. result = shop_seg(input_location)
  14. import cv2
  15. # result[OutputKeys.MASKS] is segment map result,other keys are not used
  16. cv2.imwrite(input_location + '_shopseg.jpg', result[OutputKeys.MASKS])
  17. if __name__ == '__main__':
  18. unittest.main()