wx.createInferenceSession()接口加载onnx模型,创建session失败?
通过wx.createInferenceSession()接口加载onnx模型,创建session失败 从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
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()
})
})
}