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
Inference #
ResNet image inference
method : public : Inference(image:Byte[], height:Int, labels:String[]) ~ API.Onnx.ResNetResultParameters
| Name | Type | Description |
|---|---|---|
| image | Byte | JPEG image bytes |
| height | Int | image height |
| labels | String | classification 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();