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.
YoloSession
YOLO inference session for object detection (v8 and above). Supports YOLO11/YOLO12 with fused head, letterbox preprocessing, and automatic FP16/FP32 input handling. Example labels := ["person", "bicycle", "car"]; session := YoloSession->New("yolo11n.onnx"); result := session->Inference(image_bytes, 640, 640, 0.5, labels); each(cls in result->GetClassifications()) { "{cls->GetName()}: {cls->GetConfidence()}"->PrintLine(); }; session->Close();
Operations
Inference #
Yolo image inference, support for models v8 and above
method : public : Inference(image:Byte[], height:Int, conf_threshold:Float, labels:String[]) ~ API.Onnx.YoloResultParameters
| Name | Type | Description |
|---|---|---|
| image | Byte | image bytes |
| height | Int | image height |
| conf_threshold | Float | confidence threshold |
| labels | String | classification labels |
Example
labels := ["person", "car", "dog"];
session := YoloSession->New("yolo11n.onnx");
image := FileReader->ReadBinaryFile("photo.jpg");
result := session->Inference(image, 640, 640, 0.5, labels);
each(cls in result->GetClassifications()) {
"{$cls->GetName()}: {$cls->GetConfidence()}"->PrintLine();
};
session->Close();