Object Detection API

The Object Detection API provides interfaces for both consuming and providing object detection results in the Auterion ecosystem. It consists of two main components:

  1. Object Detection Client: Used by applications that want to receive object detection results

  2. Object Detection Provider: Used by applications that perform object detection and want to publish their results

Object Detection Client

The Object Detection Client allows applications to subscribe to object detections and control the object detection service. This is useful for applications that need to react to detected objects or visualize detection results. Controlling the object detection service is particularly useful for resource management in cases where the detection result is used by another resource heavy application for which the resources of the object detection service should be freed.

Subscribing to Object Detections

To receive object detection results, instantiate an ObjectDetectionClient and subscribe to detections:

auterion::ObjectDetectionClient object_detection_client{sdk};

// Subscribe to detection updates with a callback
object_detection_client.subscribeDetections2D([](const auterion::ImageDetections2D& detections) {
    std::cout << "Received " << detections.detections.size() << " detections" << std::endl;
    
    // Process each detection
    for (const auto& detection : detections.detections) {
        // Access detection properties
        const auto& bbox = detection.bbox;
        std::cout << "Detection at position (" << bbox.center.x() << ", " << bbox.center.y() 
                  << ") with size " << bbox.size_x << "x" << bbox.size_y << std::endl;
        
        // Access object hypotheses (class labels and confidence scores)
        for (const auto& hypothesis : detection.object_hypotheses) {
            std::cout << "  Class: " << hypothesis.class_id 
                      << ", Score: " << hypothesis.score << std::endl;
        }
    }
});

Querying Latest Detections

You can also query the latest detection results without using callbacks:

Controlling the Object Detection Service

The client can enable or disable the object detection service:

Object Detection Provider

The Object Detection Provider is used by applications that perform object detection and want to publish their results to other applications in the system. This is typically used by computer vision applications that process camera images and detect objects.

Publishing Object Detections

To publish object detection results, instantiate an ObjectDetectionProvider and publish detections:

Controlling Provider Operation Based on Service State

The provider must respond to the object detection service's enabled/disabled state by starting or stopping its computational work. This prevents unnecessary processing when the service is disabled and ensures the provider is ready when enabled.

Important: Providers should implement proper enable/disable logic to:

  • Stop heavy computational work (image processing, inference) when enable = false

  • Resume processing and publishing detections when enable = true

  • Avoid wasting system resources when the service is not needed

You can also check the service state programmatically, but the immediate action via callback is encouraged:

Data Structures

The structure below is intentionally similar to ROS vision messages, but kept simpler.

ImageDetections2D

The ImageDetections2D structure contains a timestamp and a list of detections:

The timestamp's purpose is to be able to match detections to the images were the originated when both are used in other applications.

Detection2D

Each Detection2D contains a bounding box and a list of object hypotheses:

BoundingBox2D

The BoundingBox2D structure defines a 2D bounding box using a center point and size:

ObjectHypothesis

Each ObjectHypothesis contains a class name and confidence score:

The lower three of these structs can be found separately in <auterion_sdk/object_detection/object_detection_client.hpp> to also be available idependenly from any ROS headers.

Last updated