linhaoqi027 / yolov5_openvino_sdk

an SDK about how to use openvino model transformed from yolov5
36 stars 11 forks source link

关于yolov5转换openvino的问题 #1

Closed feolcn closed 2 years ago

feolcn commented 4 years ago

您好,我现在也在做yolov5转换 openvino的工作,把yolov5转换城onnx 后,再用mo.py 转换ir模型碰到这个错误 Model Optimizer version:
[ ERROR ] Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.load.onnx.loader.ONNXLoader'>): Unexpected exception happened during extracting attributes for node Resize_361. Original exception message: ONNX Resize operation from opset 12 is not supported. 请问您有碰到过,或者能帮忙看看吗?谢谢

linhaoqi027 commented 4 years ago

when you convert yolov5 to onnx,you should set opser_version=10. https://github.com/ultralytics/yolov5/issues/891 mention this bug, You can find your problem in this page.

feolcn commented 4 years ago

感谢您的回复 我按照您的link进行设置后,执行下面命令报这个错误 (yolov5-kwk-python37) [feol@feol-ZW:yolov5]$ python models/export.py --weights yolov5s.pt --img 640 --batch 1 Namespace(batch_size=1, img_size=[640, 640], weights='yolov5s.pt') Traceback (most recent call last): File "models/export.py", line 31, in model = attempt_load(opt.weights, map_location=torch.device('cpu')) # load FP32 model File "/data/aitest/yolov5/models/experimental.py", line 137, in attempt_load model.append(torch.load(w, map_location=map_location)['model'].float().fuse().eval()) # load FP32 model File "/home/feol/miniconda3/envs/yolov5-kwk-python37/lib/python3.7/site-packages/torch/serialization.py", line 592, in load return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args) File "/home/feol/miniconda3/envs/yolov5-kwk-python37/lib/python3.7/site-packages/torch/serialization.py", line 852, in _load result = unpickler.load() AttributeError: Can't get attribute 'Hardswish' on <module 'torch.nn.modules.activation' from '/home/feol/miniconda3/envs/yolov5-kwk-python37/lib/python3.7/site-packages/torch/nn/modules/activation.py'>

linhaoqi027 commented 4 years ago

感谢您的回复 我按照您的链接进行设置后,执行以下命令报告这个错误 (yolov5-kwk-python37)[feol @ feol-ZW:yolov5] $ python models / export.py --weights yolov5s.pt- img 640-批次1 命名空间(batch_size = 1,img_size = [640,640],weights ='yolov5s.pt')追溯 (最近一次调用为最后): 文件“ models / export.py”, 模型中的第31行= try_load(opt.weights,map_location = torch.device('cpu'))#加载FP32模型 文件“ /data/aitest/yolov5/models/experimental.py”,行137,在try_load model.append(torch.load (w,map_location = map_location)['model']。float()。fuse()。eval())#加载FP32模型 文件“ / home / feol / miniconda3 / envs / yolov5-kwk-python37 / lib / python3。 7 / site-packages / torch / serialization.py“,第592行,已加载 返回_load(opened_zipfile,map_location,pickle_module,** pickle_load_args) 文件“ /home/feol/miniconda3/envs/yolov5-kwk-python37/lib/python3.7/site-packages/torch/serialization.py”,第852行,在_load 结果= unpickler.load()中 AttributeError:无法从'/ home / feol / miniconda3 / envs / yolov5-kwk-python37 / lib /获取<模块'torch.nn.modules.activation'上的属性'Hardswish' python3.7 / site-packages / torch / nn / modules / activation.py'>

This may be caused by torch version.

linhaoqi027 commented 4 years ago

谢谢您的回复,我升级了python版本后,问题解决,请问方便留个联系方式吗,我也一直再用openvino,希望有问题可以请教,我的电话13810203706 微信:feolcn 邮箱 feolcn@gmail.com

359684740 Q

feolcn commented 4 years ago

收到,谢谢,加您qq了

liu-h528 commented 3 years ago

请问下你们都是基于哪个模型的配置文件? 目前我用5x.yaml的训练后,转换openvino后,一张图片的推理+nms时间都在600ms左右 谢谢!

cmdjzs commented 3 years ago

谢谢您的回复,我升级了python版本后,问题解决,请问方便留个联系方式吗,我也一直再用openvino,希望有问题可以请教,我的电话13810203706 微信:feolcn 邮箱 feolcn@gmail.com

359684740 Q

您好,我也遇到了类似问题,请问可以加您qq吗?