Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ History

All release highlights of this project will be documented in this file.

4.4.21 - May 23, 2024
_______________________


**Updated**

- Dependencies, removed ``email-validator``.
- ``add_items_to_subset`` added GenAI projects support.



4.4.20 - April 11, 2024
_______________________
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ boto3~=1.26
opencv-python-headless~=4.7
packaging~=23.1
plotly~=5.14
email-validator~=2.0
pandas~=2.0
ffmpeg-python~=0.2
pillow>=9.5,~=10.0
Expand Down
2 changes: 1 addition & 1 deletion src/superannotate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys


__version__ = "4.4.20"
__version__ = "4.4.21"

sys.path.append(os.path.split(os.path.realpath(__file__))[0])

Expand Down
9 changes: 4 additions & 5 deletions src/superannotate/lib/core/usecases/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ def __init__(
self._folder = folder
self._service_provider = service_provider
self._items = items
self._item_name_id_map = {}
self._item_id_name_map = {}
self._item_names_provided = True
self._big_annotations_queue = None

Expand Down Expand Up @@ -1499,9 +1499,8 @@ def _prettify_annotations(self, annotations: List[dict]):
if names_provided:
re_struct[annotation["metadata"]["name"]] = annotation
else:
re_struct[
self._item_name_id_map[annotation["metadata"]["name"]]
] = annotation
if annotation["metadata"]["id"] in self._item_id_name_map.keys():
re_struct[annotation["metadata"]["id"]] = annotation
try:
return [re_struct[x] for x in self._items if x in re_struct]
except KeyError:
Expand Down Expand Up @@ -1589,7 +1588,7 @@ def execute(self):
if not response.ok:
raise AppException(response.error)
items: List[BaseItemEntity] = response.data
self._item_name_id_map = {i.name: i.id for i in items}
self._item_id_name_map = {i.id: i.name for i in items}
len_items, len_provided_items = len(items), len(self._items)
if len_items != len_provided_items:
self.reporter.log_warning(
Expand Down
2 changes: 1 addition & 1 deletion src/superannotate/lib/core/usecases/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ def __build_query_string(self, path, item_names):
_, folder = extract_project_folder(path)
if not folder:
folder = "root"
query_str = f"metadata(name IN {str(item_names)}) AND folder={folder}"
query_str = f"metadata(name IN {str(item_names)}) AND folderName={folder}"

return query_str

Expand Down
25 changes: 25 additions & 0 deletions tests/integration/annotations/test_get_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
class TestGetAnnotations(BaseTestCase):
PROJECT_NAME = "Test-get_annotations"
FOLDER_NAME = "Test-get_annotations"
FOLDER_NAME_2 = "Test-get_annotations_2"
PROJECT_DESCRIPTION = "Desc"
PROJECT_TYPE = "Vector"
TEST_FOLDER_PATH = "data_set/sample_project_vector"
Expand Down Expand Up @@ -57,6 +58,30 @@ def test_get_annotations_by_ids(self):

self.assertEqual(len(annotations), 4)

def test_get_annotations_by_ids_with_duplicate_names(self):
sa.create_folder(self.PROJECT_NAME, self.FOLDER_NAME_2)
self._attach_items(count=4, folder=self.FOLDER_NAME_2) # noqa
self._attach_items(count=4) # noqa

sa.create_annotation_classes_from_classes_json(
self.PROJECT_NAME, f"{self.folder_path}/classes/classes.json"
)
_, _, _ = sa.upload_annotations_from_folder_to_project(
self.PROJECT_NAME, self.folder_path
)
_, _, _ = sa.upload_annotations_from_folder_to_project(
f"{self.PROJECT_NAME}/{self.FOLDER_NAME_2}", self.folder_path
)
items = sa.search_items(self.PROJECT_NAME)
folder_items = sa.search_items(f"{self.PROJECT_NAME}/{self.FOLDER_NAME_2}")
all_items = items + folder_items

annotations = sa.get_annotations(
self._project["id"], [i["id"] for i in all_items]
)

self.assertEqual(len(annotations), 8)

def test_get_annotations_by_wrong_item_ids(self):
annotations = sa.get_annotations(self._project["id"], [1, 2, 3])

Expand Down