Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问怎么将model zoo内模型导出为onnx/导出为onnx报错怎么解决。 #584

Open
timeuser4 opened this issue Sep 25, 2024 · 1 comment

Comments

@timeuser4
Copy link

当我使用以下代码导出时报错:
`import torchreid
from torch.autograd import Variable
import torch
import onnx

input_name = ['input']
output_name = ['output']
model = torch.load('osnet_x1_0_msmt17_256x128_amsgrad_ep150_stp60_lr0.0015_b64_fb10_softmax_labelsmooth_flip.pth')
model.eval()
input = Variable(torch.randn(1, 3, 256, 128))
torch.onnx.export(model, input, 'osnet_ain_x1_0.onnx', input_names=input_name,output_names=output_name, verbose=True, export_params=True)

错误信息为:C:\Users\28455\AppData\Roaming\Python\Python310\site-packages\torchreid\reid\metrics\rank.py:11: UserWarning: Cython evaluation (very fast so highly recommended) is unavailable, now use python evaluation.
warnings.warn(
Traceback (most recent call last):
File "C:\Users\28455\gitclone\yolov5\pth2onnx.py", line 12, in
model.eval()
AttributeError: 'collections.OrderedDict' object has no attribute 'eval'`
请问这是为什么

@timeuser4
Copy link
Author

如有回答,不胜感激

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant