Objects Filter
This layer (objects_filter) deletes annotations less (or greater) than specified size or percentage of image area.

Settings

  • filter_by
    • polygon_sizes
      • filtering_classes (type: array of classes)
      • area_size one of
        • percent (type: number)
        • size:
          • width (type: number)
          • height (type: number)
      • comparator (type: enum ["less", "greater"])
      • action (type: enum ["delete"])
      or
    • names (type: array of classes)

Case: names

1
{
2
"action": "objects_filter",
3
"src": ["$sample1"],
4
"dst": "$sample2",
5
"settings": {
6
"filter_by": {
7
"names": ["Class A", "Class C"]
8
}
9
}
10
}
Copied!
Delete annotations of classes which not present in names.

Case: area percent

1
{
2
"action": "objects_filter",
3
"src": ["$sample1"],
4
"dst": "$sample2",
5
"settings": {
6
"filter_by": {
7
"polygon_sizes": {
8
"filtering_classes": ["person"],
9
"area_size": {
10
"percent": 5
11
},
12
"action": "delete",
13
"comparator": "less"
14
}
15
}
16
}
17
}
Copied!
Delete annotations of classes from filtering_classes that have area (in percentage of image area) less than specified value of area_size.
Use comparator = greater to delete annotations which area is greater than defined.

Case: bounding box size

1
{
2
"action": "objects_filter",
3
"src": ["$sample1"],
4
"dst": "$sample2",
5
"settings": {
6
"filter_by": {
7
"polygon_sizes": {
8
"filtering_classes": ["person"],
9
"area_size": {
10
"width": 10,
11
"height": 40
12
},
13
"action": "delete",
14
"comparator": "less"
15
}
16
}
17
}
18
}
Copied!
Delete annotations of classes from filtering_classes that have some side (determined by the annotation bounding box) less than specified value of width or height correspondingly.
Use comparator = greater to delete annotations which some side is greater than defined.

Example

Remove annotations of class bus that are smaller than 10% of image area.
1
[
2
{
3
"dst": "$data",
4
"src": [
5
"mini_pascal/*"
6
],
7
"action": "data",
8
"settings": {
9
"classes_mapping": "default"
10
}
11
},
12
{
13
"action": "objects_filter",
14
"src": ["$data"],
15
"dst": "$output",
16
"settings": {
17
"filter_by": {
18
"polygon_sizes": {
19
"filtering_classes": ["bus"],
20
"area_size": {
21
"percent": 10
22
},
23
"action": "delete",
24
"comparator": "less"
25
}
26
}
27
}
28
},
29
{
30
"dst": "example_filter",
31
"src": [
32
"$output"
33
],
34
"action": "supervisely",
35
"settings": {}
36
}
37
]
Copied!
Last modified 1yr ago