收藏
回答

createInferenceSession failed 转换ONNX模型失败?

createInferenceSession:fail create session fail : xnet error:6: Failed to convert ONNX model to XNet modelFailed to convet onnx to xnet


背景:

  • 测试用的模型来自于torchvision ssdlite通过torch.onnx.export导出
  • 该模型在onnxruntime上可以成功运行

如何获得模型转换失败的更详细原因?

什么是XNet模型?


回答关注问题邀请回答
收藏

4 个回答

  • ration
    ration
    2023-03-23

    是否所有算子都在 ONNX 规范定义中?

    2023-03-23
    有用
    回复
  • Taylor
    Taylor
    2023-07-12

    问题原因是微信支持的ONNX算子有限,可以通过https://github.com/daquexian/onnx-simplifier工具优化并查看最终模型所用的算子是否在微信支持的算子列表中

    2023-07-12
    有用
    回复 1
    • 石米
      石米
      2023-09-04
      大佬帮忙看看,这是用onnxsim后的模型,还是报一样的错误,不知道那个是不支持的
      2023-09-04
      回复
  • 熊熊
    熊熊
    2023-05-09

    所以,解决了吗?同遇到这个问题

    2023-05-09
    有用
    回复
  • tienchiu
    tienchiu
    2023-03-21

    同问这个问题。

    从tensorflow.js的movenet转换到onnx的模型,加载时提示错误。

    {"errMsg":"createInferenceSession:fail create session fail : xnet error:6: Failed to convert ONNX model to XNet modelFailed to convet onnx to xnet\n","errno":2004001}
    


    初始化代码如下:

      _loadModel(modelPath) {
    
    
        if (!modelPath) {
          console.error('model path is null!')
        }
    
    
        let modelFile = modelPath
    
    
        console.log('...wxwxwx...modelFile', modelFile)
    
    
        return new Promise((resolve, reject) => {
          this.wxInferenceSession = wx.createInferenceSession({
            model: modelFile ,
            // precisionLevel: 4,
            // allowNPU: true,
            // allowQuantize: false,
            typicalShape: {input:[1,256,256,3]}
          })
    
    
          // 监听error事件
          this.wxInferenceSession.onError((error) => {
            console.error(error)
            reject(error)
          })
          this.wxInferenceSession.onLoad(() => {
            this.ready = true
            resolve()
          })
        })
      }
    
    2023-03-21
    有用
    回复
登录 后发表内容