Skip to content

Expression

Version v1

Creates specific output based on defined input variables and configured rules - which is useful while creating business logic in workflows.

Based on configuration, block takes input data, optionally performs operation on data, save it as variables and evaluate switch-case like statements to get the final result.

Type identifier

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

Properties

Name Type Description Refs
name str The unique name of this step..
data_operations Dict[str, List[Union[ClassificationPropertyExtract, DetectionsFilter, DetectionsOffset, DetectionsPropertyExtract, DetectionsSelection, DetectionsShift, Divide, ExtractDetectionProperty, ExtractImageProperty, LookupTable, Multiply, NumberRound, NumericSequenceAggregate, RandomNumber, SequenceAggregate, SequenceApply, SequenceLength, SequenceMap, SortDetections, StringMatches, StringSubSequence, StringToLowerCase, StringToUpperCase, ToBoolean, ToNumber, ToString]]] UQL definitions of operations to be performed on defined data before switch-case instruction.
switch CasesDefinition Definition of switch-case statement.

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

Available Connections

Check what blocks you can connect to Expression in version v1.

The available connections depend on its binding kinds. Check what binding kinds Expression in version v1 has.

Bindings
  • input

    • data (Union[image, *]): References data to be used to construct results.
  • output

    • output (*): Equivalent of any element.
Example JSON definition of step Expression in version v1
{
    "name": "<your_step_name_here>",
    "type": "roboflow_core/expression@v1",
    "data": {
        "predictions": "$steps.model.predictions",
        "reference": "$inputs.reference_class_names"
    },
    "data_operations": {
        "predictions": [
            {
                "property_name": "class_name",
                "type": "DetectionsPropertyExtract"
            }
        ]
    },
    "switch": {
        "cases": [
            {
                "condition": {
                    "statements": [
                        {
                            "comparator": {
                                "type": "=="
                            },
                            "left_operand": {
                                "operand_name": "class_name",
                                "type": "DynamicOperand"
                            },
                            "right_operand": {
                                "operand_name": "reference",
                                "type": "DynamicOperand"
                            },
                            "type": "BinaryStatement"
                        }
                    ],
                    "type": "StatementGroup"
                },
                "result": {
                    "type": "StaticCaseResult",
                    "value": "PASS"
                },
                "type": "CaseDefinition"
            }
        ],
        "default": {
            "type": "StaticCaseResult",
            "value": "FAIL"
        },
        "type": "CasesDefinition"
    }
}