开发者社区> 问答> 正文

模型image_body_reshaping,直接输入图像数组,有BUG!

代码:

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().)

展开
收起
游客ypzje25j7ot24 2022-12-04 20:05:41 211 0
0 条回答
写回答
取消 提交回答
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载