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

"txt" question #20

Open
Dorismz opened this issue Sep 5, 2018 · 3 comments
Open

"txt" question #20

Dorismz opened this issue Sep 5, 2018 · 3 comments

Comments

@Dorismz
Copy link

Dorismz commented Sep 5, 2018

please somebody tell me where can i get the images.txt ? Thanks a lot!

@Dorismz
Copy link
Author

Dorismz commented Sep 5, 2018

please somebody tell me where can i get the images.txt ? Thanks a lot! and , i can't make successful, it was error: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5.
so, how can i get the lib,"pthread_,"?

@Dorismz
Copy link
Author

Dorismz commented Jun 28, 2021

怎样把这个pth转成onnx?

@Dorismz
Copy link
Author

Dorismz commented Jun 28, 2021

---------求带。。。。
我转换的时候出现提示“copying a param with shape torch.Size([512,4608]) from checkpoint, the shape in current model is torch.Size([512,4620800]).”
---------下面是我的转换代码----------:
import torch, onnx, collections
from torchvision.models.utils import load_state_dict_from_url
from siamese import Siamese
from PIL import Image
import numpy as np
print('notice !!!! ----> use python3 run this script!!! \n')
INPUT_DICT = 'model_data/Omniglot_vgg.pth'#input path
OUT_ONNX = 'E:/data/att_faces/Siamese-pytorch-master/Siamese-pytorch-master/model_data/Omniglot_vgg.onnx'#output path
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model = Siamese()
model.load_state_dict(torch.load(self.model_path, map_location=device))
model.eval()
x = torch.randn(1, 3, 105, 105);
input_names = ["input"];
out_names = ["output"];
#xmodel= torch.load(INPUT_DICT, map_location=torch.device('cpu'))
#xmodel= torch.load_state_dict(torch.load(file_path))#(INPUT_DICT, map_location=torch.device('cpu'))
#xmodel.eval()
#xmodel = Siamese()
torch.onnx.export(model, x, OUT_ONNX, export_params=True, training=False, input_names=input_names, output_names=out_names)
#print('please run: python3 -m onnxsim test.onnx test_sim.onnx\n')#对转化后的模型,运行这个命令,简化符号
print('convert done!\n')

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