Skip to content

Commit c86e50f

Browse files
committed
Fix pixel annotation copy
1 parent bcd94f6 commit c86e50f

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

superannotate/db/project_images.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ def _copy_images(
183183
annotations = get_image_annotations(
184184
(source_project, source_project_folder), image_name
185185
)
186-
if annotations["annotation_json"] is not None:
186+
if annotations["annotation_json"] is not None and annotations[
187+
"annotation_mask"] is not None:
187188
if "annotation_mask" in annotations:
188189
upload_image_annotations(
189190
(destination_project, destination_project_folder),

tests/test_folders.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,32 @@ def test_copy_images3(tmpdir):
274274
assert num_images == 4
275275

276276

277+
def test_copy_images4(tmpdir):
278+
PROJECT_NAME = "test copy4 folder images"
279+
tmpdir = Path(tmpdir)
280+
281+
projects_found = sa.search_projects(PROJECT_NAME, return_metadata=True)
282+
for pr in projects_found:
283+
sa.delete_project(pr)
284+
285+
project = sa.create_project(PROJECT_NAME, 'test', 'Pixel')
286+
sa.upload_images_from_folder_to_project(
287+
project, FROM_FOLDER, annotation_status="InProgress"
288+
)
289+
sa.create_folder(project, "folder1")
290+
project = PROJECT_NAME + "/folder1"
291+
292+
sa.copy_images(
293+
PROJECT_NAME, ["example_image_2.jpg", "example_image_3.jpg"], project
294+
)
295+
296+
num_images = sa.get_project_image_count(project)
297+
assert num_images == 2
298+
299+
num_images = sa.get_project_image_count(PROJECT_NAME)
300+
assert num_images == 4
301+
302+
277303
def test_copy_images(tmpdir):
278304
PROJECT_NAME = "test copy folder images"
279305
tmpdir = Path(tmpdir)

0 commit comments

Comments
 (0)