Filter annotations
Overview
Removes the labels that match your conditions, or keeps only those, and writes every source image to a destination dataset with its filtered annotations.
The source dataset is never changed, so comparing it with the destination shows exactly what was cut. The badge counts the labels removed in the last run and opens the result.
How it works
FAQ
How are several conditions combined?
The Operator input decides. With And, the default, a label matches only when it satisfies every condition you set. With Or, one is enough. Conditions left empty do not take part, and a single condition means the same thing either way. Setting no condition at all is a validation error rather than a match-everything run.
A range counts as one condition whether you fill one side of it or both. Split into two inputs they would read as “smaller than the minimum or larger than the maximum” under Or, which is every label there is.
What do the operator and the action do together?
Take Has classes = person and Object area bounded above at 0.05 on a dataset of people and helmets:
Keep with narrow conditions is the destructive corner: everything that does not match goes, including untouched labels of other classes.
How do the range conditions work?
Fill both sides to bound a range from both ends, fill one side for “at least” or “at most”, and leave both empty to switch the condition off.
Does this change the source dataset?
No. The destination holds the same images by reference, with new annotations, and the source keeps its own.
What if I don't select a destination dataset?
The node writes into its own output dataset, named Filter annotations - created on the first run, a new empty version of it on a rerun. A selected destination must differ from the source, otherwise the run fails.
What happens to images whose labels do not match?
Every image reaches the destination. With Remove, an image without a matching label keeps all of its labels. With Keep, it arrives with an empty annotation. Images that have no annotation in the source are added too, without one.
What happens when I run the node twice?
Without a selected destination, each rerun writes a new version of the node’s own output dataset. With a destination you selected, the annotations it already holds for the source images are replaced by the ones this run produces, and missing images are added. Either way the result depends only on the source dataset and the conditions.
How is the object area measured?
As the share of the image the label covers, the same way the Annotation quality report measures it: the geometry’s own area where it has one, and its bounding box otherwise. A label whose annotation carries no image size cannot be measured and never matches an area condition.
When should I use Filter images instead?
Use Filter images to move whole images that have a matching object. Use this node to clean up individual labels while every image stays in place.
Inputs
Dataset whose labels are filtered. Key: SRC_DATASET.
Where the images and their filtered labels go. Must differ from the source, and leaving it empty uses the node’s own output dataset. Key: DST_DATASET.
Remove drops the matching labels. Keep drops all the others. Key: MATCHED_LABELS.
Options:
- Remove (
remove) - Keep (
keep)
And requires every condition below. Or requires just one of them. Key: CONDITIONS_OPERATOR.
Options:
- And (
and) - Or (
or)
Classes the label must belong to. Empty means any class. Values come from SRC_DATASET. Key: CLASSES.
Share of the image the label covers, in percent. Minimum: 0. Maximum: 100. Step: 0.5. Key: OBJECT_AREA_PERCENT.
How stretched the label is: its long side over its short side. 1 is a square. Minimum: 1. Step: 0.1. Key: OBJECT_BOX_ASPECT.
Shape the label is drawn with. Key: OBJECT_GEOMETRY.
Options:
- Rectangle (
rectangle) - Polygon (
polygon) - Bitmap (
bitmap) - Alpha mask (
alpha_mask) - Point (
point) - Line (
line) - Graph (
graph)
Tag the label carries. Write key, or key=value to require a value. Key: OBJECT_TAG.
Outputs
ID of the destination dataset holding the images and their filtered annotations. Shown as an artifact. Key: DATASET.
Short badge with the number of labels removed in the latest run. Shown on the node as a badge. Selecting the badge opens DATASET. Key: LAST_REMOVED_LABELS_COUNT.
JSON config
Machine-readable node interface for automation and advanced usage.