> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ovalbee.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ovalbee.com/_mcp/server.

# Filter predictions

> Selects a subset of a dataset from the confidence of its prediction annotations. For classification, keeps the assets whose predicted confidence falls inside a [Conf min, Conf max] band and samples a budget across the predicted classes, e.g. a mid-confidence band of 'hard' images for active learning. For object detection, scores every asset from its box confidences and keeps the highest-scoring ones inside a [Min score, Max score] band, e.g. to select frames for pseudo-label training, or the uncertain ones for review.

## Overview

Selects a subset of a dataset from the confidence carried by its prediction annotations, and adds the selected assets to a destination dataset or to the node's own output dataset.

Task decides how assets are scored and picked. Classification reads the image-level tag as the predicted class and the `confidence` tag beside it as the confidence (older predictions carry it as the class tag's own value), keeps what falls inside the confidence band, and spreads a fixed budget across the predicted classes. Object detection aggregates the box confidences of each asset into one score, drops everything under Min score or over Max score, and keeps the highest-scoring assets. Without a destination, rerunning the node writes a new version of the dataset it created the first time, instead of creating another one.

## How it works

Takes the destination dataset, or the node's own output dataset — created on the first run, a new empty version of it on a rerun.

Loads the source dataset's images together with their prediction annotations.

Scores every asset the way Task demands: one image-level confidence for classification, or the box confidences aggregated by max, mean or min for object detection.

Keeps the classification predictions inside the confidence band and samples up to Count of them across classes, or keeps the detections between Min score and Max score up to Top K.

Adds the selected images and their annotations to the output dataset, refreshes its statistics and inherits the source ontology.

## FAQ

#### Why is my object detection score range rejected?

Min score and Max score must be between 0 and 1, with Min score less than or equal to Max score. An invalid range stops the run before the output dataset is created or changed.

#### Why doesn't a second run create another output dataset?

The node remembers the dataset it produced, named `Confidence Sample` for classification or `Top-K Filtered` for object detection, and writes a new version of it on every rerun. A flow that reruns does not leave a trail of near-identical datasets behind, and earlier results stay in that dataset's version history. A destination you select is never versioned: each run adds its selection to it.

#### What happens when fewer assets match than Count asks for?

Classification fills each class up to its quota, then tops the remaining budget up from the assets left over in other classes. When the band matches fewer assets than Count in total, everything that matched is kept.

#### Is the random selection reproducible?

Yes. Random ordering inside a class uses a fixed seed, so the same dataset and the same settings select the same assets.

#### How is an asset scored when its annotation cannot be read?

Object detection scores it zero, which puts it under any Min score above zero. Classification skips it, because no predicted class can be read from it. The same holds for an asset with no annotation at all.

#### What does this node not support?

Task offers only classification and object detection. Classification reads one predicted class per image, so multi-label predictions are not supported. With Min score set to 0, object detection also selects assets that carry no box confidences, because they score zero.

## Inputs

**`Source dataset`** `dataset` — required

Dataset containing assets with prediction annotations. Key: `SRC_DATASET`.

---

**`Destination dataset`** `dataset`

Where the selected assets go. Leave empty to reuse the dataset an earlier run of this node created, or to start a new one. Key: `DST_DATASET`.

---

**`Task`** `select` — required, default: classification

Kind of prediction the source annotations carry, which decides how assets are scored and picked. Key: `TASK_TYPE`.

Options:

* Classification (`classification`)
* Object detection (`object_detection`)

---

**`Conf min`** `number` — required, default: 0.5

Lowest confidence a prediction may have and still be kept. Minimum: `0.0`. Maximum: `1.0`. Step: `0.05`. Visible when `TASK_TYPE` is `classification`. Key: `CONF_MIN`.

---

**`Conf max`** `number` — required, default: 0.8

Highest confidence a prediction may have and still be kept. Set it to 1.0 to take everything above Conf min. Minimum: `0.0`. Maximum: `1.0`. Step: `0.05`. Visible when `TASK_TYPE` is `classification`. Key: `CONF_MAX`.

---

**`Count`** `integer` — required, default: 2000

How many assets to keep at most. Minimum: `1`. Step: `1`. Visible when `TASK_TYPE` is `classification`. Key: `COUNT`.

---

**`Within range`** `select` — required, default: random

Which assets to take when more of them fall inside the band than Count allows. Visible when `TASK_TYPE` is `classification`. Key: `WITHIN_RANGE`.

Options:

* Random (`random`)
* Highest confidence (`highest`)
* Lowest confidence (`lowest`)

---

**`Balance`** `select` — required, default: equal

How to split the Count budget across predicted classes. Visible when `TASK_TYPE` is `classification`. Key: `BALANCE_MODE`.

Options:

* Equal per class (`equal`)
* Proportional to candidates (`proportional`)
* None (global) (`none`)

---

**`Score aggregation`** `select` — required, default: max

How the confidences of an asset's predicted boxes are reduced to the one score it is ranked by. Visible when `TASK_TYPE` is `object_detection`. Key: `SCORE_AGGREGATION`.

Options:

* Max (highest box confidence) (`max`)
* Mean (average of all boxes) (`mean`)
* Min (all boxes must be confident) (`min`)

---

**`Min score`** `number` — required, default: 0.5

Assets scoring below this are dropped even when Top K still has room. Minimum: `0.0`. Maximum: `1.0`. Step: `0.05`. Visible when `TASK_TYPE` is `object_detection`. Key: `MIN_SCORE`.

---

**`Max score`** `number` — required, default: 1.0

Assets scoring above this are dropped. Leave it at 1.0 to keep everything above Min score, or lower it to keep only the assets the model is unsure of, e.g. 0.8 with Min score 0.5. Minimum: `0.0`. Maximum: `1.0`. Step: `0.05`. Visible when `TASK_TYPE` is `object_detection`. Key: `MAX_SCORE`.

---

**`Top K`** `integer` — required, default: 5000

Maximum number of assets to keep (highest-scoring first). Minimum: `1`. Step: `1`. Visible when `TASK_TYPE` is `object_detection`. Key: `TOP_K`.

---

## Outputs

**`Filtered Dataset`** `dataset`

Dataset containing the selected assets. Shown as an artifact. Key: `FILTERED_DATASET`.

---

**`Filtered Count`** `string`

Number of assets the last run selected. Shown on the node as a badge. Selecting the badge opens `FILTERED_DATASET`. Key: `FILTERED_COUNT`.

---

## JSON config

Machine-readable node interface for automation and advanced usage.

#### Show JSON

```json
{
  "name": "Filter predictions",
  "description": "Selects a subset of a dataset from the confidence of its prediction annotations. For classification, keeps the assets whose predicted confidence falls inside a [Conf min, Conf max] band and samples a budget across the predicted classes, e.g. a mid-confidence band of 'hard' images for active learning. For object detection, scores every asset from its box confidences and keeps the highest-scoring ones inside a [Min score, Max score] band, e.g. to select frames for pseudo-label training, or the uncertain ones for review.",
  "category": "Filter",
  "namespace": "ovalbee",
  "templateKey": "filter/filter_predictions",
  "version": "v1",
  "inputs": [
    {
      "key": "SRC_DATASET",
      "label": "Source dataset",
      "type": "dataset",
      "description": "Dataset containing assets with prediction annotations.",
      "required": true,
      "default": null,
      "visibleWhen": null,
      "options": {
        "creatable": false
      }
    },
    {
      "key": "DST_DATASET",
      "label": "Destination dataset",
      "type": "dataset",
      "description": "Where the selected assets go. Leave empty to reuse the dataset an earlier run of this node created, or to start a new one.",
      "required": false,
      "default": null,
      "visibleWhen": null
    },
    {
      "key": "TASK_TYPE",
      "label": "Task",
      "type": "select",
      "description": "Kind of prediction the source annotations carry, which decides how assets are scored and picked.",
      "required": true,
      "default": "classification",
      "visibleWhen": null,
      "options": {
        "options": [
          {
            "label": "Classification",
            "value": "classification"
          },
          {
            "label": "Object detection",
            "value": "object_detection"
          }
        ]
      }
    },
    {
      "key": "CONF_MIN",
      "label": "Conf min",
      "type": "number",
      "description": "Lowest confidence a prediction may have and still be kept.",
      "required": true,
      "default": 0.5,
      "visibleWhen": {
        "key": "TASK_TYPE",
        "operator": "equals",
        "value": "classification"
      },
      "options": {
        "min": 0.0,
        "max": 1.0,
        "step": 0.05
      }
    },
    {
      "key": "CONF_MAX",
      "label": "Conf max",
      "type": "number",
      "description": "Highest confidence a prediction may have and still be kept. Set it to 1.0 to take everything above Conf min.",
      "required": true,
      "default": 0.8,
      "visibleWhen": {
        "key": "TASK_TYPE",
        "operator": "equals",
        "value": "classification"
      },
      "options": {
        "min": 0.0,
        "max": 1.0,
        "step": 0.05
      }
    },
    {
      "key": "COUNT",
      "label": "Count",
      "type": "number",
      "description": "How many assets to keep at most.",
      "required": true,
      "default": 2000,
      "visibleWhen": {
        "key": "TASK_TYPE",
        "operator": "equals",
        "value": "classification"
      },
      "options": {
        "type": "integer",
        "min": 1,
        "step": 1
      }
    },
    {
      "key": "WITHIN_RANGE",
      "label": "Within range",
      "type": "select",
      "description": "Which assets to take when more of them fall inside the band than Count allows.",
      "required": true,
      "default": "random",
      "visibleWhen": {
        "key": "TASK_TYPE",
        "operator": "equals",
        "value": "classification"
      },
      "options": {
        "options": [
          {
            "label": "Random",
            "value": "random"
          },
          {
            "label": "Highest confidence",
            "value": "highest"
          },
          {
            "label": "Lowest confidence",
            "value": "lowest"
          }
        ]
      }
    },
    {
      "key": "BALANCE_MODE",
      "label": "Balance",
      "type": "select",
      "description": "How to split the Count budget across predicted classes.",
      "required": true,
      "default": "equal",
      "visibleWhen": {
        "key": "TASK_TYPE",
        "operator": "equals",
        "value": "classification"
      },
      "options": {
        "options": [
          {
            "label": "Equal per class",
            "value": "equal"
          },
          {
            "label": "Proportional to candidates",
            "value": "proportional"
          },
          {
            "label": "None (global)",
            "value": "none"
          }
        ]
      }
    },
    {
      "key": "SCORE_AGGREGATION",
      "label": "Score aggregation",
      "type": "select",
      "description": "How the confidences of an asset's predicted boxes are reduced to the one score it is ranked by.",
      "required": true,
      "default": "max",
      "visibleWhen": {
        "key": "TASK_TYPE",
        "operator": "equals",
        "value": "object_detection"
      },
      "options": {
        "options": [
          {
            "label": "Max (highest box confidence)",
            "value": "max"
          },
          {
            "label": "Mean (average of all boxes)",
            "value": "mean"
          },
          {
            "label": "Min (all boxes must be confident)",
            "value": "min"
          }
        ]
      }
    },
    {
      "key": "MIN_SCORE",
      "label": "Min score",
      "type": "number",
      "description": "Assets scoring below this are dropped even when Top K still has room.",
      "required": true,
      "default": 0.5,
      "visibleWhen": {
        "key": "TASK_TYPE",
        "operator": "equals",
        "value": "object_detection"
      },
      "options": {
        "min": 0.0,
        "max": 1.0,
        "step": 0.05
      }
    },
    {
      "key": "MAX_SCORE",
      "label": "Max score",
      "type": "number",
      "description": "Assets scoring above this are dropped. Leave it at 1.0 to keep everything above Min score, or lower it to keep only the assets the model is unsure of, e.g. 0.8 with Min score 0.5.",
      "required": true,
      "default": 1.0,
      "visibleWhen": {
        "key": "TASK_TYPE",
        "operator": "equals",
        "value": "object_detection"
      },
      "options": {
        "min": 0.0,
        "max": 1.0,
        "step": 0.05
      }
    },
    {
      "key": "TOP_K",
      "label": "Top K",
      "type": "number",
      "description": "Maximum number of assets to keep (highest-scoring first).",
      "required": true,
      "default": 5000,
      "visibleWhen": {
        "key": "TASK_TYPE",
        "operator": "equals",
        "value": "object_detection"
      },
      "options": {
        "type": "integer",
        "min": 1,
        "step": 1
      }
    }
  ],
  "outputs": [
    {
      "key": "FILTERED_DATASET",
      "label": "Filtered Dataset",
      "type": "dataset",
      "description": "Dataset containing the selected assets.",
      "artifact": true,
      "badge": false,
      "badgeOpens": null,
      "hidden": false
    },
    {
      "key": "FILTERED_COUNT",
      "label": "Filtered Count",
      "type": "string",
      "description": "Number of assets the last run selected.",
      "artifact": false,
      "badge": true,
      "badgeOpens": "FILTERED_DATASET",
      "hidden": false
    }
  ]
}
```