登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
AI 队友
登录
注册
代码拉取完成,页面将自动刷新
仓库状态说明
开源项目
>
人工智能
>
AI-人工智能
&&
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
224
Star
1.3K
Fork
1.1K
Ascend
/
samples
暂停
代码
Issues
55
Pull Requests
100
Wiki
统计
流水线
服务
JavaDoc
PHPDoc
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
yolov5离线推理报错
REJECTED
#I9VLMV
Bug-Report
TangWuguo
创建于
2024-06-06 10:59
# 一、问题现象(附报错日志上下文): 使用离线推理脚本提示size not match,从onnx导出om模型时,有设置batch-sz=1, 为何在推理时输入的大小是2457600 (2\*3\*640\*640)? ``` [INFO] Created a temporary directory at /tmp/tmph9df77th [INFO] Writing /tmp/tmph9df77th/_remote_module_non_sriptable.py /usr/local/python3.7.5/lib/python3.7/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: libc10_cuda.so: cannot open shared object file: No such file or directory warn(f"Failed to load image Python extension: {e}") [INFO] acl init success [INFO] open device 0 success [INFO] load model nanji_bs1_aipp.om success [INFO] create model description success ./datasets/nanji-test Scanning 'datasets/nanji-test/valid/labels_yolov5_v6.cache' images and labels... 288 found, 0 missing, 1 empty, 0 corrupted: 100%|████████████████████████████████████| 288/288 [00:00<?, ?it/s] 0%| | 0/288 [00:00<?, ?it/s] [ERROR] Check i:0 name:images in size:2457600 needsize:4915200 not match [ERROR] Check InVector failed ret:-1 0%| | 0/288 [00:00<?, ?it/s] Traceback (most recent call last): File "om_val.py", line 78, in <module> main(opt, cfg) File "om_val.py", line 44, in main pred_results = forward_nms_script(model, dataloader, cfg) File "/home/tangwg/code/modelzoo-GPL/built-in/PyTorch/Official/cv/object_detection/Yolov5_for_PyTorch_v6.0/common/util/model.py", line 66, in forward_nms_script result = model.infer([img]) File "/usr/local/python3.7.5/lib/python3.7/site-packages/ais_bench/infer/interface.py", line 510, in infer return self.run(inputs, out_array) File "/usr/local/python3.7.5/lib/python3.7/site-packages/ais_bench/infer/interface.py", line 450, in run outputs = self.session.run(self.outputs_names, inputs) RuntimeError: [-1][ACL: general failure] [INFO] unload model success, model Id is 1 [INFO] end to reset device 0 [INFO] end to finalize acl ``` # 二、软件版本: -- CANN 版本 (e.g., CANN 8.0.RC1.alpha003 Ascend910B) --Pytorch 版本: 1.11.0 --Python 版本 (Python 3.7.5): --操作系统版本 (e.g., CentOS 7.6):  # 三、测试步骤: ## 1. 导出ONNX python3 export.py --data ./data/kitchen-web.yaml --weights ./runs/train/nanji/weights/last.pt ``` export: data=./data/kitchen-web.yaml, weights=./runs/train/nanji/weights/last.pt, imgsz=[640, 640], batch_size=1, device=cpu, half=False, inplace=False, train=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=13, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['onnx'] YOLOv5 🚀 2024-5-28 torch 1.11.0+cpu CPU Fusing layers... Model Summary: 290 layers, 20856975 parameters, 0 gradients /usr/local/python3.7.5/lib/python3.7/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2228.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] PyTorch: starting from runs/train/nanji/weights/last.pt (83.9 MB) ONNX: starting export with onnx 1.14.1... /home/tangwg/code/modelzoo-GPL/built-in/PyTorch/Official/cv/object_detection/Yolov5_for_PyTorch_v6.0/models/yolo.py:61: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if self.grid[i].shape[2:4] != x[i].shape[2:4] or self.onnx_dynamic: WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. ONNX: export success, saved as runs/train/nanji/weights/last.onnx (83.9 MB) ONNX: run --dynamic ONNX model inference with: 'python detect.py --weights runs/train/nanji/weights/last.onnx' Export complete (4.54s) ``` ## 2. 转换om atc --model=nanji.onnx --output=nanji_bs1_aipp --framework=5 --input_format=NCHW --soc_version=Ascend910B --input_shape="images:1,3,640,640" ## 3. 推理 python3 om_val.py --tag 6.0 --model=nanji_bs1_aipp.om --nms_mode nms_script --data_path ./datasets/nanji-test
# 一、问题现象(附报错日志上下文): 使用离线推理脚本提示size not match,从onnx导出om模型时,有设置batch-sz=1, 为何在推理时输入的大小是2457600 (2\*3\*640\*640)? ``` [INFO] Created a temporary directory at /tmp/tmph9df77th [INFO] Writing /tmp/tmph9df77th/_remote_module_non_sriptable.py /usr/local/python3.7.5/lib/python3.7/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: libc10_cuda.so: cannot open shared object file: No such file or directory warn(f"Failed to load image Python extension: {e}") [INFO] acl init success [INFO] open device 0 success [INFO] load model nanji_bs1_aipp.om success [INFO] create model description success ./datasets/nanji-test Scanning 'datasets/nanji-test/valid/labels_yolov5_v6.cache' images and labels... 288 found, 0 missing, 1 empty, 0 corrupted: 100%|████████████████████████████████████| 288/288 [00:00<?, ?it/s] 0%| | 0/288 [00:00<?, ?it/s] [ERROR] Check i:0 name:images in size:2457600 needsize:4915200 not match [ERROR] Check InVector failed ret:-1 0%| | 0/288 [00:00<?, ?it/s] Traceback (most recent call last): File "om_val.py", line 78, in <module> main(opt, cfg) File "om_val.py", line 44, in main pred_results = forward_nms_script(model, dataloader, cfg) File "/home/tangwg/code/modelzoo-GPL/built-in/PyTorch/Official/cv/object_detection/Yolov5_for_PyTorch_v6.0/common/util/model.py", line 66, in forward_nms_script result = model.infer([img]) File "/usr/local/python3.7.5/lib/python3.7/site-packages/ais_bench/infer/interface.py", line 510, in infer return self.run(inputs, out_array) File "/usr/local/python3.7.5/lib/python3.7/site-packages/ais_bench/infer/interface.py", line 450, in run outputs = self.session.run(self.outputs_names, inputs) RuntimeError: [-1][ACL: general failure] [INFO] unload model success, model Id is 1 [INFO] end to reset device 0 [INFO] end to finalize acl ``` # 二、软件版本: -- CANN 版本 (e.g., CANN 8.0.RC1.alpha003 Ascend910B) --Pytorch 版本: 1.11.0 --Python 版本 (Python 3.7.5): --操作系统版本 (e.g., CentOS 7.6):  # 三、测试步骤: ## 1. 导出ONNX python3 export.py --data ./data/kitchen-web.yaml --weights ./runs/train/nanji/weights/last.pt ``` export: data=./data/kitchen-web.yaml, weights=./runs/train/nanji/weights/last.pt, imgsz=[640, 640], batch_size=1, device=cpu, half=False, inplace=False, train=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=13, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['onnx'] YOLOv5 🚀 2024-5-28 torch 1.11.0+cpu CPU Fusing layers... Model Summary: 290 layers, 20856975 parameters, 0 gradients /usr/local/python3.7.5/lib/python3.7/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:2228.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] PyTorch: starting from runs/train/nanji/weights/last.pt (83.9 MB) ONNX: starting export with onnx 1.14.1... /home/tangwg/code/modelzoo-GPL/built-in/PyTorch/Official/cv/object_detection/Yolov5_for_PyTorch_v6.0/models/yolo.py:61: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs! if self.grid[i].shape[2:4] != x[i].shape[2:4] or self.onnx_dynamic: WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. WARNING: The shape inference of prim::Constant type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function. ONNX: export success, saved as runs/train/nanji/weights/last.onnx (83.9 MB) ONNX: run --dynamic ONNX model inference with: 'python detect.py --weights runs/train/nanji/weights/last.onnx' Export complete (4.54s) ``` ## 2. 转换om atc --model=nanji.onnx --output=nanji_bs1_aipp --framework=5 --input_format=NCHW --soc_version=Ascend910B --input_shape="images:1,3,640,640" ## 3. 推理 python3 om_val.py --tag 6.0 --model=nanji_bs1_aipp.om --nms_mode nms_script --data_path ./datasets/nanji-test
评论 (
1
)
登录
后才可以发表评论
状态
REJECTED
TODO
Analysing
ACCEPTED
WIP
Feedback
TEST
DONE
REJECTED
负责人
未设置
Liuboyu
liuboyuHappy
负责人
协作者
+负责人
+协作者
标签
未设置
项目
未立项任务
未立项任务
里程碑
未关联里程碑
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
分支 (20)
标签 (31)
master
r1.11
r1.10
r1.9
r1.8
r1.7
r1.5
r1.6
pr_2663
add_lut4_llama7b_quantization
r1.4
r1.3
r1.1
r1.2
r1.21.0
r0.2
r1.0
r0.3
8.0.RC3_bugfix
r.ss928.1
v1.11-8.5.0.alpha001
v1.9-8.3.RC1
v1.10-8.3.RC1.alpha003
v1.8-8.3.RC1.alpha002
v1.7-8.3.RC1.alpha001
v1.5-8.2.RC1
v1.6-8.2.RC1.alpha003
v1.4-8.2.RC1.alpha002
v1.3-8.2.RC1.alpha001
v1.1-8.1.RC1.beta1
v1.2-8.1.RC1.alpha002
v1.0-8.1.RC1.alpha001
v0.2-8.0.0.beta1
v0.3-8.0.0.alpha003
8.0.RC3
v0.1-8.0.0.alpha002
8.0.RC2.2
8.0.RC2
8.0.RC1
7.0.0
7.0.RC1
6.3.RC2
v0.9.0
v0.8.0
v0.7.0
v0.6.0
v0.1.0
v0.2.0
v0.3.0
v0.4.0
v0.5.0
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
预计工期
(小时)
参与者(1)
1
https://gitee.com/ascend/samples.git
git@gitee.com:ascend/samples.git
ascend
samples
samples
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册