v2026.10.0
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.

DeepLabSession

DeepLab inference session for semantic segmentation. Auto-detects model input dimensions and supports both NCHW and NHWC layouts. Returns per-class coverage percentages and polygon boundaries.

Example

labels := ["background", "person", "bicycle", "car"];
session := DeepLabSession->New("deeplabv3.onnx");
result := session->Inference(image_bytes, labels);
each(cls in result->GetClassifications()) {
  "{cls->GetName()}: {cls->GetConfidence()}%"->PrintLine();
};
session->Close();

Operations

Inference #

DeepLab image inference

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

Parameters

NameTypeDescription
imageBytewidth width
labelsStringclassification labels

Example

labels := ["background", "person", "car"];
session := DeepLabSession->New("deeplabv3.onnx");
image := FileReader->ReadBinaryFile("scene.jpg");
result := session->Inference(image, labels);
each(cls in result->GetClassifications()) {
  "{$cls->GetName()}: {$cls->GetConfidence()}%"->PrintLine();
};
session->Close();

IsOpen #

Whether the model loaded. A session that failed to open is not an error at construction -- the constructor returns an object either way, and the reason was written to stderr while it happened. Test this before inferring: a closed session returns Nil from every inference method, which is otherwise indistinguishable from a model that found nothing.

method : public : IsOpen() ~ Bool

Return

TypeDescription
Booltrue when the model is loaded and inference can run

New # constructor

Constructor.

New(model:String)

Parameters

NameTypeDescription
modelStringDeepLab model path

New # constructor

Constructor.

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

Parameters

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