nucleus.evaluation_v2_exclusions

Exclusion rules for Evaluation V2 creation.

These rules drop items/annotations from an evaluation before metrics are computed.

Each rule is validated when the evaluation is created; anything rejected is reported back with the reason, so a malformed rule fails loudly rather than silently excluding nothing.

Pass instances (or equivalent plain dicts) to nucleus.NucleusClient.create_benchmark_evaluation_v2() via exclusion_rules:

client.create_benchmark_evaluation_v2(
    benchmark_id,
    model_run_id,
    exclusion_rules=[
        BoxAreaExclusionRule(scope="annotation", target="groundTruth", min=1024),
        LabelExclusionRule(scope="item", target="prediction", labels=["ignore"]),
        MetadataExclusionRule(key="is_dark", op="EQ", value=True),
    ],
)

BoxAreaExclusionRule

Exclude boxes whose pixel area falls outside [min, max] (at least one bound required).

LabelExclusionRule

Exclude annotations/predictions (or whole items) carrying any of labels.

MetadataExclusionRule

Exclude whole items whose item-metadata key matches value under op.

class nucleus.evaluation_v2_exclusions.BoxAreaExclusionRule

Exclude boxes whose pixel area falls outside [min, max] (at least one bound required).

Parameters:
  • scope"item" or "annotation".

  • target"groundTruth" or "prediction".

  • min – Minimum pixel area (inclusive lower bound), or None.

  • max – Maximum pixel area (inclusive upper bound), or None.

class nucleus.evaluation_v2_exclusions.LabelExclusionRule

Exclude annotations/predictions (or whole items) carrying any of labels.

Parameters:
  • scope"item" (drop the whole item if any annotation matches) or "annotation" (drop only matching annotations).

  • target"groundTruth" or "prediction" — which side to filter.

  • labels – Labels to exclude.

class nucleus.evaluation_v2_exclusions.MetadataExclusionRule

Exclude whole items whose item-metadata key matches value under op.

scope is always "item" for metadata rules.