应该是上采样
tensor_proto.raw_data().empty() || !tensor_proto.float_data().empty() || !tensor_proto.double_data().empty() || !tensor_proto.int64_data().empty()
报错代码:
# -*- coding: utf-8 -*-
import onnx
import os
import time
import cv2
import numpy as np
net = cv2.dnn.readNetFromONNX(r'onnx_model/0.onnx')
print("net load")
解决方法1:升级opencv版本,升级到4.5.3以上可能就可以。
pip install opencv-python -U
解决方法2:
session = onnxruntime.InferenceSession(onnx_path)
生成代码:
import argparse
import os
import numpy as np
import onnx
import torch
import torch.nn as nn
class TinyModel(nn.Module):
def __init__(self, upsample_mode):
super().__init__()
self.expander = nn.Conv2d(3, 192, 1, 1)
upsamples = [nn.Upsample((256, 256), mode='nearest')]
# upsamples