pytorch pth2onnx
参考资料:https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html
参考资料:https://zhuanlan.zhihu.com/p/159379768
测试样例一:
resnet34 花卉分类模型,测试同样图片,推理速度快约3倍(0.87s->0.26s)
文件转换:pth2onxx.py
from PIL import Image
import torchvision.transforms as transforms
import torch
import torch.onnx
import onnx
import onnxruntime