Neural-network inference
Execute a trained model by passing tensors through its computation graph.
The sample drawing makes the data representation visible; it is not an actual model input/output pair.
Prepare input tensors with the model’s exact layout, size and normalization.
Successive learned operations transform activations. Actual layers and tensor shapes come from the loaded model.
These illustrative class scores show one possible output contract. Detection, segmentation and other networks require different interpretation.
Run forward inference and interpret the named outputs.
Illustrative example. The stages explain the method; they are not a live OpenCV execution.
Try it on an image
Experiment at pixel level
Run a user-supplied ONNX network with an NCHW colour blob and inspect one output plane. The built-in model is only a ReLU demonstration, not a trained vision network.
The engine loads on your first run. Your images stay in this browser.
Scroll over either image to zoom at the pointer. Use the scrollbars to pan both views over the same relative area. Zoom is relative to the input; pixel coordinates belong to each image. Warps can change scene correspondence.
Pixel inspector RGBA · native values · matched scale · 9 × 9 output pixels
Select a pixel
Select a pixel
When to use it
Run classifiers, detectors, segmenters or other supported models in a browser or Node worker.
How it works
- 01Load the model bytes into the instance’s virtual filesystem.
- 02Prepare input tensors with the model’s exact layout, size and normalization.
- 03Run forward inference and interpret the named outputs.
preprocess → learned layers → model-specific outputs
What to tune
Match model input names, RGB/BGR order, scale, mean and layout. Postprocessing is model-specific.
Where it breaks down
Compilation of DNN does not imply every operator or model is supported. This build runs on CPU WASM and does not enable WebGPU.
TypeScript API
Open an entry for its exact overloads, parameter descriptions, result ownership and pinned upstream source.
All of these calls execute on the CPU. Native objects need explicit disposal. See matrices and ownership and build compatibility.