Skip to navigation

Condition

Overview

Checks one value and lets the flow continue only when the check holds. The check can compare text, a number, or a yes/no, so you can branch on a name like a winning framework as easily as on a score or a count.

Every edge leaving it shows a branch chip. The first edge you add is Yes and runs when the check holds; the next one is No and runs when it fails. Click a chip to switch an edge’s branch. One Condition then works as an if/else. The node shows its check on the canvas, such as If winner = yolo, and after each run the value it read as a badge, such as Value: yolo.

For one yes/no check like this a Condition is enough. When there are more outcomes, use a Router.

Evaluate object detection Condition Export YOLO checkpoint

How it works

1

Reads Item to check as text, a number, or a yes/no, as set in Check.

2

Compares it with the selected operator and value.

3

Continues downstream when the check holds. When it fails, runs only its No edges, or stops this path if there are none.

FAQ

Nodes on its No edges run; every other node connected after it does not. Without a No edge the flow stops at this node. Work already finished upstream is kept.

The same ones as the Router. Text: Equal to, Not equal to, One of (a list), Contains, Starts with, Is empty; upper and lower case and spaces around the text don’t matter. Number: =, ≠, >, <, ≥, ≤, and Between, with both ends included; a count badge like 1,250 images is read by its leading number. Yes / No: Is true, Is false; values like yes/no, true/false, and 1/0 work too.

The check fails, unless it is Is empty. The same goes for a value that can’t be read as the chosen type, such as abc compared as a number.

From any upstream output wired into Item to check, number outputs included: a metric, a count, or a name such as the winning framework.

Yes. Wire a dataset into Item to check, then pick what to count: Assets, Objects, Classes, or Objects of class with one class, such as car. Then compare the count as a number, for example Objects of car > 100. The node counts the dataset as it is when the flow reaches it, so objects labeled by hand in the labeling tool count too. The badge shows the count, such as Objects of car: 120.

Inputs

Item to check
stringRequired

Value being tested, usually wired from an earlier node’s output such as a score, a count or a name. A count badge like 1,250 images is read as a number by its leading number. A wired dataset is checked by a count - its assets, objects or classes. Key: ITEM_TO_CHECK.

Check
branch_rulesDefaults to {'type': 'number', 'rules': [{'id': 'rule_1', 'operator': 'greater_than', 'value': None}]}Required

How the item is read - as text, a number or a yes/no - and what it is compared with. Flow continues while the check holds, and stops when it does not. Flow variables aren’t accepted. Values come from ITEM_TO_CHECK. Key: RULE.

Outputs

Value
string

What the check read from the item - its number, or the raw text. Written on every run, whether the check passes or fails. Shown on the node as a badge. Key: VALUE.

JSON config

Machine-readable node interface for automation and advanced usage.

{
"name": "Condition",
"description": "Check a value - a text, a number or a yes/no - and proceed based on the result. If the check fails, the flow stops here, or takes the edges marked to run when the check fails.",
"category": "Flow control",
"namespace": null,
"templateKey": "flow_control/condition",
"version": "v2",
"inputs": [
{
"key": "ITEM_TO_CHECK",
"label": "Item to check",
"type": "string",
"description": "Value being tested, usually wired from an earlier node's output such as a score, a count or a name. A count badge like 1,250 images is read as a number by its leading number. A wired dataset is checked by a count - its assets, objects or classes.",
"required": true,
"default": null,
"visibleWhen": null,
"options": {
"anyType": true
}
},
{
"key": "RULE",
"label": "Check",
"type": "branch_rules",
"description": "How the item is read - as text, a number or a yes/no - and what it is compared with. Flow continues while the check holds, and stops when it does not.",
"required": true,
"default": {
"type": "number",
"rules": [
{
"id": "rule_1",
"operator": "greater_than",
"value": null
}
]
},
"visibleWhen": null,
"options": {
"ref": "ITEM_TO_CHECK",
"maxItems": 1,
"allowVariables": false
}
}
],
"outputs": [
{
"key": "VALUE",
"label": "Value",
"type": "string",
"description": "What the check read from the item - its number, or the raw text. Written on every run, whether the check passes or fails.",
"artifact": false,
"badge": true,
"badgeOpens": null,
"hidden": false
}
],
"widgets": {
"widget": {
"id": "variable",
"settings": {
"template": {
"type": "input",
"value": "If {ITEM_TO_CHECK} {RULE}"
}
}
}
}
}