cvisionai / tator

Video analytics web platform
https://tator.io
GNU Affero General Public License v3.0
108 stars 34 forks source link

Filter on localization size not working #1532

Open jrtcppv opened 10 months ago

jrtcppv commented 10 months ago

In project detail view, filtering by localization width > 0.3 results in the following backend response:

{
    "message": "Cannot resolve keyword 'width' into field. Choices are: attributes, color, created_by, created_by_id, created_datetime, deleted, elemental_id, extracted, extracted_id, frame, id, localizations, mark, media, modified_by, modified_by_id, modified_datetime, parent, parent_id, project, project_id, rowprotection, segments, state, type, type_id, variant_deleted, version, version_id",
    "details": "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.10/dist-packages/rest_framework/views.py\", line 506, in dispatch\n    response = handler(request, *args, **kwargs)\n  File \"/tator_online/main/rest/_base_views.py\", line 50, in get\n    response_data = self._get(params)\n  File \"/tator_online/main/rest/media_count.py\", line 24, in _get\n    return get_media_count(params[\"project\"], params)\n  File \"/tator_online/main/rest/_media_query.py\", line 259, in get_media_count\n    qs = get_media_queryset(project, params)\n  File \"/tator_online/main/rest/_media_query.py\", line 253, in get_media_queryset\n    qs = _get_media_psql_queryset(project, filter_ops, params)\n  File \"/tator_online/main/rest/_media_query.py\", line 208, in _get_media_psql_queryset\n    qs = _related_search(\n  File \"/tator_online/main/rest/_attribute_query.py\", line 108, in _related_search\n    state_qs = get_attribute_psql_queryset_from_query_obj(state_qs, search_obj)\n  File \"/tator_online/main/rest/_attribute_query.py\", line 468, in get_attribute_psql_queryset_from_query_obj\n    return qs.filter(q_object)\n  File \"/usr/local/lib/python3.10/dist-packages/django/db/models/query.py\", line 941, in filter\n    return self._filter_or_exclude(False, args, kwargs)\n  File \"/usr/local/lib/python3.10/dist-packages/django/db/models/query.py\", line 961, in _filter_or_exclude\n    clone._filter_or_exclude_inplace(negate, args, kwargs)\n  File \"/usr/local/lib/python3.10/dist-packages/django/db/models/query.py\", line 968, in _filter_or_exclude_inplace\n    self._query.add_q(Q(*args, **kwargs))\n  File \"/usr/local/lib/python3.10/dist-packages/django/db/models/sql/query.py\", line 1416, in add_q\n    clause, _ = self._add_q(q_object, self.used_aliases)\n  File \"/usr/local/lib/python3.10/dist-packages/django/db/models/sql/query.py\", line 1435, in _add_q\n    child_clause, needed_inner = self.build_filter(\n  File \"/usr/local/lib/python3.10/dist-packages/django/db/models/sql/query.py\", line 1288, in build_filter\n    return self._add_q(\n  File \"/usr/local/lib/python3.10/dist-packages/django/db/models/sql/query.py\", line 1435, in _add_q\n    child_clause, needed_inner = self.build_filter(\n  File \"/usr/local/lib/python3.10/dist-packages/django/db/models/sql/query.py\", line 1309, in build_filter\n    lookups, parts, reffed_expression = self.solve_lookup_type(arg)\n  File \"/usr/local/lib/python3.10/dist-packages/django/db/models/sql/query.py\", line 1135, in solve_lookup_type\n    _, field, _, lookup_parts = self.names_to_path(lookup_splitted, self.get_meta())\n  File \"/usr/local/lib/python3.10/dist-packages/django/db/models/sql/query.py\", line 1562, in names_to_path\n    raise FieldError(\"Cannot resolve keyword '%s' into field. \"\ndjango.core.exceptions.FieldError: Cannot resolve keyword 'width' into field. Choices are: attributes, color, created_by, created_by_id, created_datetime, deleted, elemental_id, extracted, extracted_id, frame, id, localizations, mark, media, modified_by, modified_by_id, modified_datetime, parent, parent_id, project, project_id, rowprotection, segments, state, type, type_id, variant_deleted, version, version_id\n"
}

Wondering if we are not using related search when we should be?

image

bctcvai commented 10 months ago

Nice regression.

It looks like it is trying to search for $width against the state_qs which implies it is looking for State:$width which is invalid. Not clear why its making that jump, but probably a mundane detail of the related_search looking for any associated metadata (State or Localization).

Unfortunately; explicitly adding a type in the UI didn't appear to resolve it, which would have been convenient.

bctcvai commented 8 months ago

Additionally, position filters broke ($x, $y), etc.

KeySpray commented 3 months ago

These filters appear to be working again.