I want to create a filter using the sdk to filter out images where the ‘annotation_results’ column is a an empty dictionary. I tried to do so with the following code but it does not seem to work:
To filter out images where the annotation_results column is an empty dictionary using the SDK, you need to ensure that the filter is correctly set up to handle the specific structure of the annotation_results field.
The NOT_EQUAL operator might not work as expected with an empty list or dictionary. Instead, you can use the EMPTY operator to check if the annotation_results field is empty.
from label_studio_sdk.data_manager import Filters, Column, Operator, Type
filters = Filters.create(Filters.OR, [
Filters.item(
Column.annotations_results,
Operator.EMPTY,
Type.String,
Filters.value(True)
)
])
This filter will match tasks where the annotation_results field is empty. If you want to exclude these tasks, you can use the NOT_EMPTY operator instead: