代码:
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 <module>
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 <dictcomp>
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().)