Skip to main content
Version: 0.10.x [Latest Beta]

Segmentation

A segmentation pipeline returns a segmentation result per detected region on each InferenceResult. Each carries a class_label, a contour, a bounding_rect, and a confidence. See SimplifiedPipeline for the shared setup.

import denkflow

pipeline = denkflow.Pipeline.from_denkflow("path/to/model.denkflow", pat="YOUR-PAT")
simplified = denkflow.SimplifiedPipeline(pipeline)

results = simplified.run("path/to/image.jpg", confidence_threshold=0.5)

for image_result in results:
for r in image_result.results:
if r.segmentation:
seg = r.segmentation
print(f"{seg.class_label.name}: {seg.confidence:.2f}")