Skip to content

Example Workflows - Advanced inference techniques

Below you can find example workflows you can use as inspiration to build your apps.

SAHI in workflows - object detection

This example illustrates usage of SAHI technique in workflows.

Workflows implementation requires three blocks:

  • Image Slicer - which runs a sliding window over image and for each image prepares batch of crops

  • detection model block (in our scenario Roboflow Object Detection model) - which is responsible for making predictions on each crop

  • Detections stitch - which combines partial predictions for each slice of the image into a single prediction

Workflow definition
{
    "version": "1.0.0",
    "inputs": [
        {
            "type": "WorkflowImage",
            "name": "image"
        },
        {
            "type": "WorkflowParameter",
            "name": "overlap_filtering_strategy"
        }
    ],
    "steps": [
        {
            "type": "roboflow_core/image_slicer@v1",
            "name": "image_slicer",
            "image": "$inputs.image"
        },
        {
            "type": "roboflow_core/roboflow_object_detection_model@v2",
            "name": "detection",
            "image": "$steps.image_slicer.slices",
            "model_id": "yolov8n-640"
        },
        {
            "type": "roboflow_core/detections_stitch@v1",
            "name": "stitch",
            "reference_image": "$inputs.image",
            "predictions": "$steps.detection.predictions",
            "overlap_filtering_strategy": "$inputs.overlap_filtering_strategy"
        },
        {
            "type": "roboflow_core/bounding_box_visualization@v1",
            "name": "bbox_visualiser",
            "predictions": "$steps.stitch.predictions",
            "image": "$inputs.image"
        }
    ],
    "outputs": [
        {
            "type": "JsonField",
            "name": "predictions",
            "selector": "$steps.stitch.predictions",
            "coordinates_system": "own"
        },
        {
            "type": "JsonField",
            "name": "visualisation",
            "selector": "$steps.bbox_visualiser.image"
        }
    ]
}

SAHI in workflows - instance segmentation

This example illustrates usage of SAHI technique in workflows.

Workflows implementation requires three blocks:

  • Image Slicer - which runs a sliding window over image and for each image prepares batch of crops

  • detection model block (in our scenario Roboflow Instance Segmentation model) - which is responsible for making predictions on each crop

  • Detections stitch - which combines partial predictions for each slice of the image into a single prediction

Workflow definition
{
    "version": "1.0.0",
    "inputs": [
        {
            "type": "WorkflowImage",
            "name": "image"
        },
        {
            "type": "WorkflowParameter",
            "name": "overlap_filtering_strategy"
        }
    ],
    "steps": [
        {
            "type": "roboflow_core/image_slicer@v1",
            "name": "image_slicer",
            "image": "$inputs.image"
        },
        {
            "type": "roboflow_core/roboflow_object_detection_model@v2",
            "name": "detection",
            "image": "$steps.image_slicer.slices",
            "model_id": "yolov8n-640"
        },
        {
            "type": "roboflow_core/detections_stitch@v1",
            "name": "stitch",
            "reference_image": "$inputs.image",
            "predictions": "$steps.detection.predictions",
            "overlap_filtering_strategy": "$inputs.overlap_filtering_strategy"
        },
        {
            "type": "roboflow_core/bounding_box_visualization@v1",
            "name": "bbox_visualiser",
            "predictions": "$steps.stitch.predictions",
            "image": "$inputs.image"
        }
    ],
    "outputs": [
        {
            "type": "JsonField",
            "name": "predictions",
            "selector": "$steps.stitch.predictions",
            "coordinates_system": "own"
        },
        {
            "type": "JsonField",
            "name": "visualisation",
            "selector": "$steps.bbox_visualiser.image"
        }
    ]
}