如何解决InferenceSession推理报错CheckAndProcessReshape的问题?
模型:retinaface_mnet025_v2 下载地址:https://drive.google.com/file/d/1hzgOejAfCAB8WyfF24UkfiHD2FJbaCPi/view?usp=sharing (来自https://github.com/SthPhoenix/InsightFace-REST) 报错:runInferenceSession:fail:run session fail(24:Failed in CheckAndProcessReshape() for Op[56]↵) 错误码:2004009 模型为float32,在onnxruntime-web上和python上都是可以正常运行的 const imageData = canvas.getImageData(0, 0, 640, 640)
const session = wx.createInferenceSession({
model: modelPath,
allowNPU: false,
allowQuantize: false,
precesionLevel: 4
})
await new Promise((resolve, reject) => {
session.onError(reject)
session.onLoad(resolve)
})
const data = new Float32Array(640 * 640 * 3)
// NCHW
const len = 640 * 640
for (let i = 0; i < len; i++) {
data[i] = imageData.data[i * 4]
data[i + len] = imageData.data[i * 4 + 1]
data[i + len * 2] = imageData.data[i * 4 + 2]
}
const results = await this.session.run({
data: {
type: 'float32',
shape: [1, 3, 640, 640],
data: data.buffer
}
})