Skip to content

Example Workflows - Workflows with foundation models

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

Gaze Detection Workflow

This workflow uses L2CS-Net to detect faces and estimate their gaze direction. The output includes: - Face detections with facial landmarks - Gaze angles (yaw and pitch) in degrees - Visualization of facial landmarks

Workflow definition
{
    "version": "1.0",
    "inputs": [
        {
            "type": "WorkflowImage",
            "name": "image"
        },
        {
            "type": "WorkflowParameter",
            "name": "do_run_face_detection",
            "default_value": true
        }
    ],
    "steps": [
        {
            "type": "roboflow_core/gaze@v1",
            "name": "gaze",
            "images": "$inputs.image",
            "do_run_face_detection": "$inputs.do_run_face_detection"
        },
        {
            "type": "roboflow_core/keypoint_visualization@v1",
            "name": "visualization",
            "predictions": "$steps.gaze.face_predictions",
            "image": "$inputs.image",
            "annotator_type": "vertex",
            "color": "#A351FB",
            "text_color": "black",
            "text_scale": 0.5,
            "text_thickness": 1,
            "text_padding": 10,
            "thickness": 2,
            "radius": 10
        }
    ],
    "outputs": [
        {
            "type": "JsonField",
            "name": "face_predictions",
            "selector": "$steps.gaze.face_predictions"
        },
        {
            "type": "JsonField",
            "name": "yaw_degrees",
            "selector": "$steps.gaze.yaw_degrees"
        },
        {
            "type": "JsonField",
            "name": "pitch_degrees",
            "selector": "$steps.gaze.pitch_degrees"
        },
        {
            "type": "JsonField",
            "name": "visualization",
            "selector": "$steps.visualization.image"
        }
    ]
}

Workflow with Segment Anything 2 model

Meta AI introduced very capable segmentation model called SAM 2 which has capabilities of producing segmentation masks for instances of objects.

EXAMPLE REQUIRES DEDICATED DEPLOYMENT and will not run in preview!

Workflow definition
{
    "version": "1.0",
    "inputs": [
        {
            "type": "WorkflowImage",
            "name": "image"
        },
        {
            "type": "WorkflowParameter",
            "name": "mask_threshold",
            "default_value": 0.0
        },
        {
            "type": "WorkflowParameter",
            "name": "version",
            "default_value": "hiera_tiny"
        }
    ],
    "steps": [
        {
            "type": "roboflow_core/segment_anything@v1",
            "name": "segment_anything",
            "images": "$inputs.image",
            "threshold": "$inputs.mask_threshold",
            "version": "$inputs.version"
        }
    ],
    "outputs": [
        {
            "type": "JsonField",
            "name": "predictions",
            "selector": "$steps.segment_anything.predictions"
        }
    ]
}