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
7 changes: 5 additions & 2 deletions src/superannotate/lib/core/usecases/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,10 @@ async def get_annotation(
else:
async with aiofiles.open(path, encoding="utf-8") as file:
content = await file.read()
if self._project.type == constants.ProjectType.PIXEL.value:
if (
self._project.type == constants.ProjectType.PIXEL.value
and os.path.exists(mask_path)
):
async with aiofiles.open(mask_path, "rb") as mask:
mask = await mask.read()
if not isinstance(content, bytes):
Expand Down Expand Up @@ -698,7 +701,7 @@ def s3_bucket(self):
return self._s3_bucket

def _upload_mask(self, item_data: ItemToUpload):
if self._project.type == constants.ProjectType.PIXEL.value:
if self._project.type == constants.ProjectType.PIXEL.value and item_data.mask:
self.s3_bucket.put_object(
Key=self.annotation_upload_data.images[item_data.item.id][
"annotation_bluemap_path"
Expand Down
36 changes: 35 additions & 1 deletion tests/data_set/sample_explore_export_pixel/classes/classes.json
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
[{"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": []}]
[
{
"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": []
}
]
82 changes: 81 additions & 1 deletion tests/data_set/sample_explore_export_pixel/file_example.jpg.json
Original file line number Diff line number Diff line change
@@ -1 +1,81 @@
{"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": []}
{
"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": []
}