Skip to content

Commit 13f6ac6

Browse files
authored
Merge pull request #628 from superannotateai/friday
fix annotations mask upload
2 parents ae1125f + f411157 commit 13f6ac6

File tree

3 files changed

+121
-4
lines changed

3 files changed

+121
-4
lines changed

src/superannotate/lib/core/usecases/annotations.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,10 @@ async def get_annotation(
612612
else:
613613
async with aiofiles.open(path, encoding="utf-8") as file:
614614
content = await file.read()
615-
if self._project.type == constants.ProjectType.PIXEL.value:
615+
if (
616+
self._project.type == constants.ProjectType.PIXEL.value
617+
and os.path.exists(mask_path)
618+
):
616619
async with aiofiles.open(mask_path, "rb") as mask:
617620
mask = await mask.read()
618621
if not isinstance(content, bytes):
@@ -698,7 +701,7 @@ def s3_bucket(self):
698701
return self._s3_bucket
699702

700703
def _upload_mask(self, item_data: ItemToUpload):
701-
if self._project.type == constants.ProjectType.PIXEL.value:
704+
if self._project.type == constants.ProjectType.PIXEL.value and item_data.mask:
702705
self.s3_bucket.put_object(
703706
Key=self.annotation_upload_data.images[item_data.item.id][
704707
"annotation_bluemap_path"
Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,35 @@
1-
[{"id": 4991071, "project_id": 533166, "name": "cat3", "color": "#d08e91", "count": 0, "type": "object", "createdAt": "2023-07-20T12:58:35.000Z", "updatedAt": "2023-07-20T12:58:35.000Z", "attribute_groups": []}, {"id": 4991070, "project_id": 533166, "name": "cat2", "color": "#1c09ea", "count": 0, "type": "object", "createdAt": "2023-07-20T12:58:30.000Z", "updatedAt": "2023-07-20T12:58:30.000Z", "attribute_groups": []}, {"id": 4991069, "project_id": 533166, "name": "cat 1", "color": "#e23787", "count": 0, "type": "object", "createdAt": "2023-07-20T12:58:24.000Z", "updatedAt": "2023-07-20T12:58:24.000Z", "attribute_groups": []}]
1+
[
2+
{
3+
"id": 4991071,
4+
"project_id": 533166,
5+
"name": "cat3",
6+
"color": "#d08e91",
7+
"count": 0,
8+
"type": "object",
9+
"createdAt": "2023-07-20T12:58:35.000Z",
10+
"updatedAt": "2023-07-20T12:58:35.000Z",
11+
"attribute_groups": []
12+
},
13+
{
14+
"id": 4991070,
15+
"project_id": 533166,
16+
"name": "cat2",
17+
"color": "#1c09ea",
18+
"count": 0,
19+
"type": "object",
20+
"createdAt": "2023-07-20T12:58:30.000Z",
21+
"updatedAt": "2023-07-20T12:58:30.000Z",
22+
"attribute_groups": []
23+
},
24+
{
25+
"id": 4991069,
26+
"project_id": 533166,
27+
"name": "cat 1",
28+
"color": "#e23787",
29+
"count": 0,
30+
"type": "object",
31+
"createdAt": "2023-07-20T12:58:24.000Z",
32+
"updatedAt": "2023-07-20T12:58:24.000Z",
33+
"attribute_groups": []
34+
}
35+
]
Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,81 @@
1-
{"metadata": {"height": 560, "width": 1440, "name": "Hero Pedigree Cats.jpg", "lastAction": {"email": "narekm@superannotate.com", "timestamp": 1689857925400}, "projectId": 533166, "isPredicted": false, "isSegmented": false, "status": "Completed", "pinned": false, "annotatorEmail": null, "qaEmail": null}, "instances": [{"classId": 4991070, "probability": 100, "visible": true, "attributes": [], "parts": [{"color": "#00005a"}], "error": null, "locked": false, "createdAt": "2023-07-20T12:59:49.061Z", "createdBy": {"email": "narekm@superannotate.com", "role": "Admin"}, "creationType": "Manual", "updatedAt": "2023-07-20T13:00:00.234Z", "updatedBy": {"email": "narekm@superannotate.com", "role": "Admin"}, "className": "cat2"}, {"classId": 4991069, "probability": 100, "visible": true, "attributes": [], "parts": [{"color": "#00000f"}, {"color": "#00001e"}, {"color": "#00002d"}, {"color": "#00003c"}], "error": null, "locked": false, "createdAt": "2023-07-20T12:59:02.464Z", "createdBy": {"email": "narekm@superannotate.com", "role": "Admin"}, "creationType": "Manual", "updatedAt": "2023-07-20T12:59:38.786Z", "updatedBy": {"email": "narekm@superannotate.com", "role": "Admin"}, "className": "cat 1"}], "comments": [], "tags": []}
1+
{
2+
"metadata": {
3+
"height": 560,
4+
"width": 1440,
5+
"name": "Hero Pedigree Cats.jpg",
6+
"lastAction": {
7+
"email": "narekm@superannotate.com",
8+
"timestamp": 1689857925400
9+
},
10+
"projectId": 533166,
11+
"isPredicted": false,
12+
"isSegmented": false,
13+
"status": "Completed",
14+
"pinned": false,
15+
"annotatorEmail": null,
16+
"qaEmail": null
17+
},
18+
"instances": [
19+
{
20+
"classId": 4991070,
21+
"probability": 100,
22+
"visible": true,
23+
"attributes": [],
24+
"parts": [
25+
{
26+
"color": "#00005a"
27+
}
28+
],
29+
"error": null,
30+
"locked": false,
31+
"createdAt": "2023-07-20T12:59:49.061Z",
32+
"createdBy": {
33+
"email": "narekm@superannotate.com",
34+
"role": "Admin"
35+
},
36+
"creationType": "Manual",
37+
"updatedAt": "2023-07-20T13:00:00.234Z",
38+
"updatedBy": {
39+
"email": "narekm@superannotate.com",
40+
"role": "Admin"
41+
},
42+
"className": "cat2"
43+
},
44+
{
45+
"classId": 4991069,
46+
"probability": 100,
47+
"visible": true,
48+
"attributes": [],
49+
"parts": [
50+
{
51+
"color": "#00000f"
52+
},
53+
{
54+
"color": "#00001e"
55+
},
56+
{
57+
"color": "#00002d"
58+
},
59+
{
60+
"color": "#00003c"
61+
}
62+
],
63+
"error": null,
64+
"locked": false,
65+
"createdAt": "2023-07-20T12:59:02.464Z",
66+
"createdBy": {
67+
"email": "narekm@superannotate.com",
68+
"role": "Admin"
69+
},
70+
"creationType": "Manual",
71+
"updatedAt": "2023-07-20T12:59:38.786Z",
72+
"updatedBy": {
73+
"email": "narekm@superannotate.com",
74+
"role": "Admin"
75+
},
76+
"className": "cat 1"
77+
}
78+
],
79+
"comments": [],
80+
"tags": []
81+
}

0 commit comments

Comments
 (0)