Open
Description
Describe the issue
Trying to run Yolov8.onnx file with WebGl backend in javascript fails.
Uncaught (in promise) Error: resize (packed) does not support mode: 'nearest'
at Tb (resize-packed.ts:81:15)
at Object.get (resize-packed.ts:28:24)
at Qn.executeProgram (inference-handler.ts:64:100)
at Qn.run (inference-handler.ts:82:36)
at Object.zi [as impl] (resize-packed.ts:24:39)
at execution-plan.ts:99:61
at zn.event (instrument.ts:337:17)
at execution-plan.ts:98:48
This is basically the code I am running to test:
const modelName = "yolov8n.onnx";
const modelInputShape = [1, 3, 640, 640];
model = await ort.InferenceSession.create(modelName, { executionProviders: ['webgl'] });
const tensor = new ort.Tensor("float32",new Float32Array(modelInputShape.reduce((a, b) => a * b)),modelInputShape);
await model.run({ images: tensor });
- The Yolov8n.onnx inference works fine when running in Python with Ultralytics library.
- Used opset is 12, higher version give will not load. Return error:
TypeError: cannot resolve operator 'Split' with opsets: ai.onnx v17 - Model loads and runs fine on cpu or wasm backend.
Thank you for your help.
To reproduce
-
Download Yolov8n onnx model here MODEL
-
Run this HTML page in a webserver (LiveServer in Visual Studio Code fi):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
<title>Yolov8 test</title>
<!-- ONNX RUNTIME -->
<script src="https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/ort.min.js"></script>
</head>
<body>
<script>
const modelName = "yolov8n.onnx";
const modelInputShape = [1, 3, 640, 640];
async function testModel() {
let model = await ort.InferenceSession.create(modelName, { executionProviders: ['webgl'] });
const tensor = new ort.Tensor("float32",new Float32Array(modelInputShape.reduce((a, b) => a * b)),modelInputShape);
await model.run({ images: tensor });
}
testModel();
</script>
</body>
</html>
Urgency
No response
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.17.1
Execution Provider
'webgl' (WebGL)