v2026.5.3
All Bundles
Bundle ONNX Runtime inference library for running pre-trained models. Supports object detection (YOLO), image classification (ResNet), segmentation (DeepLab), pose estimation (OpenPose), face recognition, and Phi-3 text generation. Compile with -lib onnx.

ResNetSession

ResNet inference session for image classification. Performs ImageNet-style classification with softmax probability normalization. Example labels := ["tabby cat", "golden retriever", "sports car"]; session := ResNetSession->New("resnet50.onnx"); result := session->Inference(image_bytes, 224, 224, labels); "Top: {result->GetName()} ({result->GetConfidence()})"->PrintLine(); session->Close();

Operations

Close #

Closes the session

method : public : Close() ~ Nil

Inference #

ResNet image inference

method : public : Inference(image:Byte[], height:Int, labels:String[]) ~ API.Onnx.ResNetResult

Parameters

NameTypeDescription
imageByteJPEG image bytes
heightIntimage height
labelsStringclassification labels

Example

labels := ["cat", "dog", "bird"];
session := ResNetSession->New("resnet50.onnx");
image := FileReader->ReadBinaryFile("animal.jpg");
result := session->Inference(image, 224, 224, labels);
"Top class: {$result->GetName()} ({$result->GetConfidence()})"->PrintLine();
session->Close();

New # constructor

Constructor.

New(model:String)

Parameters

NameTypeDescription
modelStringResNet model path

New # constructor

Constructor.

New(model:String, config:Map<String,String>)

Parameters

NameTypeDescription
modelStringResNet model path
configMap<String,String>session configuration parameters