| 12345678910111213141516171819202122232425262728293031 |
- import * as ort from "onnxruntime-react-native";
- import { loadOnnxSession } from "./loadModel";
- /**
- * TinyYOLOv2 (common export) expects float32 input NCHW [1,3,416,416]
- * output is typically [1, 125, 13, 13] (5 boxes * (5 + 20 classes) = 125)
- */
- export async function runTinyYoloV2Dummy() {
- const session = await loadOnnxSession();
- const inputName = session.inputNames[0];
- const outputName = session.outputNames[0];
- // Standard Tiny YOLOv2 input size
- const W = 416, H = 416;
- const input = new Float32Array(1 * 3 * H * W).fill(0.5); // dummy data
- const feeds: Record<string, ort.Tensor> = {};
- feeds[inputName] = new ort.Tensor("float32", input, [1, 3, H, W]);
- const results = await session.run(feeds);
- const out = results[outputName];
- return {
- inputName,
- outputName,
- dims: out.dims, // expected [1,125,13,13]
- dataLen: out.data.length // should match product(dims)
- };
- }
|