Skip to main content
Version: 0.7.x [Latest Alpha]

Basic Object Detection

This example loads a complete object detection pipeline file (*.denkflow) exported from the Hub.

import denkflow

pat = "YOUR-PAT"

denkflow_path = "path/to/model/file.denkflow"
image_path = "path/to/an/image.jpg"

input_topic = "camera/image"
output_topic = "bounding_box_filter_node/filtered_bounding_boxes"

confidence_threshold = 0.5

pipeline = denkflow.Pipeline.from_denkflow(
denkflow_path,
pat=pat,
)

pipeline.initialize()

receiver = pipeline.subscribe(output_topic)

image_tensor = denkflow.ImageTensor.from_file(image_path)

pipeline.publish_image_tensor(input_topic, image_tensor)

pipeline.run()

tensor = receiver.receive_bounding_box_tensor()

results = tensor.to_objects(confidence_threshold)

print("Object Detection Results:")
for bounding_box in results:
print(f"{bounding_box.class_label.name}: {bounding_box.confidence:.2f}")