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

Classification

A classification pipeline returns a scalar result per class on each InferenceResult. See SimplifiedPipeline for the shared setup and Interpreting results for the result model.

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")

for image_result in results:
for r in image_result.results:
if r.scalar:
print(f"{r.scalar.class_label.name}: {r.scalar.value:.2f}")

Draw classification scores​

When annotation labels are enabled, classification scores are sorted from highest to lowest and drawn as separate class-colored chips in the top-left corner. top_classifications / TopClassifications controls how many scores are shown; 0 omits them. Keep the source image tensor so it can render the inference results, and set annotation_label_font_size / LabelFontSize to a positive value. See Drawing results for Python, C#, and C examples.