BPT

BptImageObjectDetector

The BptImageObjectDetector component uses ONNX Runtime to detect objects in images with support for multiple model architectures (RF-DETR, RTMDet, YOLOv8, and Conditional DETR). It downloads the selected model on first use, runs inference in pure C#, and renders annotated bounding boxes on a canvas overlay. Features include adjustable confidence threshold, multiple model variants across architectures, auto-detect mode, image reload, and snapshot export.

Object Detection

This interactive demo showcases all features of the BptImageObjectDetector component. Select a model variant from the dropdown, adjust the confidence threshold, detect objects, reload with a new random image, clear results, or download the annotated snapshot. Detection results are received via the OnDetectionComplete callback and displayed in the table below. The component also supports HuggingFaceApiToken for authenticated downloads and CustomModelUri to override the default model URL.

Current Configuration
📋 [+]
<BptImageObjectDetector Src="@imageSrc"
                        ConfidenceThreshold="0.5"
                        MaxDetections="50"
                        ShowControls="true"
                        OnDetectionComplete="HandleDetection"
                        OnReloadImage="ReloadImage"
                        Width="100%" />

@code {
    private string imageSrc = "https://picsum.photos/seed/demo/800/600";
    private float threshold = 0.5f;
    private List<DetectionResult>? detections;

    private void HandleDetection(List<DetectionResult> results)
    {
        detections = results;
        StateHasChanged();
    }

    private void ReloadImage()
    {
        imageSrc = $"https://picsum.photos/seed/new/800/600";
    }
}
An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.