Skip to content

Commit c67e973

Browse files
committed
Add name to annotation init
1 parent 163adf5 commit c67e973

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

pytest.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

superannotate/db/projects.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,11 +538,12 @@ def upload_images_from_folder_to_project(
538538
)
539539

540540

541-
def create_empty_annotation(size):
541+
def create_empty_annotation(size, image_name):
542542
return {
543543
"metadata": {
544544
'height': size[1],
545-
'width': size[0]
545+
'width': size[0],
546+
'name': image_name
546547
},
547548
"instances": [],
548549
"comments": [],
@@ -567,7 +568,9 @@ def upload_image_array_to_s3(
567568
bucket.put_object(Body=thumbnail_image, Key=key + '___thumb.jpg')
568569
postfix_json = '___objects.json' if project_type == "Vector" else '___pixel.json'
569570
bucket.put_object(
570-
Body=json.dumps(create_empty_annotation(size)), Key=key + postfix_json
571+
Body=json.dumps(create_empty_annotation(size,
572+
Path(key).name)),
573+
Key=key + postfix_json
571574
)
572575

573576

tests/test_init_annot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def test_meta_init(tmpdir):
2727
print(annot)
2828
assert annot["metadata"]["width"] == size[1]
2929
assert annot["metadata"]["height"] == size[0]
30-
assert len(annot["metadata"]) == 2
30+
assert annot["metadata"]["name"] == image.name
31+
assert len(annot["metadata"]) == 3
3132

3233
sa.download_export(project, sa.prepare_export(project), tmpdir)

0 commit comments

Comments
 (0)