代码:
import cv2,os
import numpy as np
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
os.environ['TORCH_HOME'] = './torch_model'
img = cv2.imread('./input/tmp.jpg')
image_body_reshaping = pipeline(Tasks.image_body_reshaping, model='damo/cv_flow-based-body-reshaping_damo')
result = image_body_reshaping(img)[OutputKeys.OUTPUT_IMG]
cv2.imshow("Temp", result)
cv2.waitKey(0)
发现错误,本人无法解决. File "D:\PYTHON\ModelScope\AI_Repire_函数测试.py", line 26, in result = image_body_reshaping(img1)[OutputKeys.OUTPUT_IMG] File "D:\PYTHON\ModelScope\venv\lib\site-packages\modelscope\pipelines\base.py", line 183, in call output = self._process_single(input, *args, **kwargs) File "D:\PYTHON\ModelScope\venv\lib\site-packages\modelscope\pipelines\base.py", line 217, in _process_single out = self._collate_fn(out) File "D:\PYTHON\ModelScope\venv\lib\site-packages\modelscope\pipelines\base.py", line 204, in _collate_fn return collate_fn(data, self.device) File "D:\PYTHON\ModelScope\venv\lib\site-packages\modelscope\pipelines\base.py", line 487, in collate_fn return type(data)({ File "D:\PYTHON\ModelScope\venv\lib\site-packages\modelscope\pipelines\base.py", line 488, in k: collate_fn(v, device) if k != 'img_metas' else v File "D:\PYTHON\ModelScope\venv\lib\site-packages\modelscope\pipelines\base.py", line 502, in collate_fn return collate_fn(torch.from_numpy(data), device) ValueError: At least one stride in the given numpy array is negative, and tensors with negative strides are not currently supported. (You can probably work around this by making a copy of your array with array.copy().)
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。