API reference

IObjectDetectionTask Interface

Interface for object detection providers supporting both cloud (JSON) and on-device (binary) execution.

Methods

DetectAsync ( imageJpgOrPng , ct )
Performs object detection on an encoded image (JPEG/PNG).
Used by cloud providers (e.g., HuggingFace) that accept binary image uploads.
Signature
Task< string > DetectAsync(byte[] imageJpgOrPng, CancellationToken ct=default)
Parameters
imageJpgOrPng: byte[]  Encoded image bytes in JPEG or PNG format.
ct: CancellationToken  Cancellation token for aborting the operation.
Returns
Task< string >  JSON string containing detection results with boxes, scores, and labels.
DetectAsync ( src , ct )
Performs object detection directly on a GPU texture (fastest path).
Used by on-device providers (e.g., UnityInferenceEngine) to avoid CPU-GPU transfers.
Signature
Task< byte[]> DetectAsync(RenderTexture src, CancellationToken ct=default)
Parameters
src: RenderTexture  Source RenderTexture containing the image to analyze.
ct: CancellationToken  Cancellation token for aborting the operation.
Returns
Task< byte[]>  Binary-encoded detection results for efficient downstream processing.