Skip to content

Classification Label VisualizationΒΆ

Class: ClassificationLabelVisualizationBlockV1

Source: inference.core.workflows.core_steps.visualizations.classification_label.v1.ClassificationLabelVisualizationBlockV1

Visualizes classification predictions with customizable labels and positioning options. Perfect for creating clear, informative displays of model predictions!

How It WorksΒΆ

This visualization processes classification predictions by:

  1. 🎯 Analyzing predictions based on task type (single-label or multi-label)

  2. πŸ“Š Organizing results by confidence score

  3. 🎨 Rendering labels with customizable positioning and styling

ParametersΒΆ

  • task_type: Specifies how to handle predictions. Available options:

    • "single-label": Shows only the highest confidence prediction

    • "multi-label": Displays all predictions above threshold

  • text_position: Controls label placement with 9 options:

    • Top: LEFT, CENTER, RIGHT
    • Center: LEFT, CENTER, RIGHT
    • Bottom: LEFT, CENTER, RIGHT
  • text: Determines what information to display:

    • "Class": Only show class names
    • "Confidence": Only show confidence scores
    • "Class and Confidence": Show both
  • text_padding: Controls spacing between labels and from image edges

Why Use This Visualization?ΒΆ

This is especially useful for:

  • 🏷️ Creating clear, professional-looking prediction displays

  • πŸ“± Supporting different UI layouts with flexible positioning

  • 🎨 Customizing appearance for different use cases

  • πŸ“Š Showing prediction confidence in an intuitive way

Example UsageΒΆ

Use this visualization after any classification model to display predictions in a clean, organized format. Perfect for both single predictions and multiple class probabilities.

Type identifierΒΆ

Use the following identifier in step "type" field: roboflow_core/classification_label_visualization@v1to add the block as as step in your workflow.

PropertiesΒΆ

Name Type Description Refs
name str Enter a unique identifier for this step.. ❌
copy_image bool Enable this option to create a copy of the input image for visualization, preserving the original. Use this when stacking multiple visualizations.. βœ…
color_palette str Select a color palette for the visualised elements.. βœ…
palette_size int Specify the number of colors in the palette. This applies when using custom or Matplotlib palettes.. βœ…
custom_colors List[str] Define a list of custom colors for bounding boxes in HEX format.. βœ…
color_axis str Choose how bounding box colors are assigned.. βœ…
text str The type of text to display.. βœ…
text_position str The anchor position for placing the label.. βœ…
text_color str Color of the text.. βœ…
text_scale float Scale of the text.. βœ…
text_thickness int Thickness of the text characters.. βœ…
text_padding int Padding around the text in pixels.. βœ…
border_radius int Radius of the label in pixels.. βœ…

The Refs column marks possibility to parametrise the property with dynamic values available in workflow runtime. See Bindings for more info.

Available ConnectionsΒΆ

Compatible Blocks

Check what blocks you can connect to Classification Label Visualization in version v1.

Input and Output BindingsΒΆ

The available connections depend on its binding kinds. Check what binding kinds Classification Label Visualization in version v1 has.

Bindings
  • input

    • image (image): Select the input image to visualize on..
    • copy_image (boolean): Enable this option to create a copy of the input image for visualization, preserving the original. Use this when stacking multiple visualizations..
    • predictions (classification_prediction): Classification predictions..
    • color_palette (string): Select a color palette for the visualised elements..
    • palette_size (integer): Specify the number of colors in the palette. This applies when using custom or Matplotlib palettes..
    • custom_colors (list_of_values): Define a list of custom colors for bounding boxes in HEX format..
    • color_axis (string): Choose how bounding box colors are assigned..
    • text (string): The type of text to display..
    • text_position (string): The anchor position for placing the label..
    • text_color (string): Color of the text..
    • text_scale (float): Scale of the text..
    • text_thickness (integer): Thickness of the text characters..
    • text_padding (integer): Padding around the text in pixels..
    • border_radius (integer): Radius of the label in pixels..
  • output

    • image (image): Image in workflows.
Example JSON definition of step Classification Label Visualization in version v1
{
    "name": "<your_step_name_here>",
    "type": "roboflow_core/classification_label_visualization@v1",
    "image": "$inputs.image",
    "copy_image": true,
    "predictions": "$steps.classification_model.predictions",
    "color_palette": "DEFAULT",
    "palette_size": 10,
    "custom_colors": [
        "#FF0000",
        "#00FF00",
        "#0000FF"
    ],
    "color_axis": "CLASS",
    "text": "LABEL",
    "text_position": "CENTER",
    "text_color": "WHITE",
    "text_scale": 1.0,
    "text_thickness": 1,
    "text_padding": 10,
    "border_radius": 0
}