Skip to content
imaged
Docs / Tasks / Object detection

Object detection

Find every object in a frame, label it, return the bounding box in pixel coordinates.

Object detection takes one image, runs a YOLO-family model, and returns a list of detections. Each detection has a class label, a confidence score, and a Rect in the original image's pixel space. The yolo family auto-detects which task to run from the ONNX output shape: detect, segment, pose, OBB, or 1000-class classify.

The default detect path uses YOLO26x trained on COCO 80. Swap in YOLOv8 or YOLOv11 by pointing yolo.model at a different ONNX file. The same calls work on every binding; the only difference is how you load the source image.

Code

Use YoloFamily directly for type-safe std::variant results, or ai.getFamily("yolo") to match the C/Python registry pattern.

cpp
#include "imaged/sdk.hpp"
#include "imaged/families/yolo/yolo_family.hpp"

int main() {
    imaged::SDK::AI ai;
    auto& config = ai.getOptions();
    config.set("license.token", "your-license-token");
    config.set("license.audience", "cameras.acme.com");
    config.checkLicense();

    config.set("yolo.model", "yolo26x.onnx");
    config.set("yolo.confidenceThreshold", 0.35);

    imaged::SDK::YoloFamily family;
    family.load(config);

    imaged::SDK::Image image;
    image.load("bus.jpg");

    auto result = family.run({&image});
    for (const auto& d : std::get<imaged::SDK::DetectionResult>(result).detections) {
        std::cout << d.label << " " << d.score << "\n";
    }
}