Skip to content
Open
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
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
import typing

__version__ = "4.4.10"
__version__ = "4.4.11dev1"

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

Expand Down
2 changes: 1 addition & 1 deletion src/superannotate/lib/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def setup_logging(level=DEFAULT_LOGGING_LEVEL, file_path=LOG_FILE_LOCATION):
file_handler.setFormatter(file_formatter)
logger.addHandler(file_handler)
except OSError as e:
logging.error(e)
logger.debug(e)


DEFAULT_IMAGE_EXTENSIONS = ["jpg", "jpeg", "png", "tif", "tiff", "webp", "bmp"]
Expand Down
4 changes: 4 additions & 0 deletions src/superannotate/lib/core/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ class ProjectType(BaseTitledEnum):
def images(self):
return self.VECTOR.value, self.PIXEL.value, self.TILED.value

@classproperty
def unsupported_types(cls):
return cls.POINT_CLOUD.value, cls.OTHER.value


class UserRole(BaseTitledEnum):
SUPER_ADMIN = "Superadmin", 1 # noqa
Expand Down
24 changes: 19 additions & 5 deletions src/superannotate/lib/core/usecases/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ def get_annotation_from_s3(bucket, path: str):

def prepare_annotation(self, annotation: dict, size) -> dict:
errors = None
if self._project.type == constants.ProjectType.POINT_CLOUD.value:
return annotation
if size < BIG_FILE_THRESHOLD:
use_case = ValidateAnnotationUseCase(
reporter=self.reporter,
Expand Down Expand Up @@ -664,7 +666,13 @@ async def distribute_queues(self, items_to_upload: List[ItemToUpload]):
json.dump(annotation, item_to_upload.file)
item_to_upload.file.seek(0)
while True:
if item_to_upload.file_size > BIG_FILE_THRESHOLD:
if (
self._project.type
== constants.ProjectType.POINT_CLOUD.value
):
self._big_files_queue.put_nowait(item_to_upload)
break
elif item_to_upload.file_size > BIG_FILE_THRESHOLD:
if self._big_files_queue.qsize() > 32:
await asyncio.sleep(3)
continue
Expand Down Expand Up @@ -1414,13 +1422,13 @@ def validate_item_names(self):
def _prettify_annotations(self, annotations: List[dict]):
re_struct = {}
if self._item_names:
for annotation in annotations:
re_struct[annotation["metadata"]["name"]] = annotation
try:
for annotation in annotations:
re_struct[annotation["metadata"]["name"]] = annotation
return [re_struct[x] for x in self._item_names if x in re_struct]
except KeyError:
raise AppException("Broken data.")

if self._project.type not in constants.ProjectType.unsupported_types:
raise AppException("Broken data.")
return annotations

async def get_big_annotation(self):
Expand Down Expand Up @@ -1587,6 +1595,12 @@ def __init__(
self._big_file_queue = None
self._small_file_queue = None

def validate_project_type(self):
if self._project.type == constants.ProjectType.POINT_CLOUD.value:
raise AppException(
f"The function is not supported for {constants.ProjectType(self._project.type).name} projects."
)

def validate_item_names(self):
if self._item_names:
item_names = list(dict.fromkeys(self._item_names))
Expand Down
136 changes: 136 additions & 0 deletions tests/data_set/sample_project_point_cloud/3d_item_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"000950": [
{
"psr": {
"position": {
"x": -5.080617901849534,
"y": 4.7485066265361535,
"z": -0.5211173295974731
},
"scale": {
"x": 10.438753155962607,
"y": 7.852290496368532,
"z": 3.3729794025421143
},
"rotation": {
"x": 0,
"y": 0,
"z": 1.9247371622914418
}
},
"obj_type": "Personal vehicle",
"obj_id": "1"
},
{
"psr": {
"position": {
"x": 15.25457933415853,
"y": -7.289155780814713,
"z": 0.3909074068069458
},
"scale": {
"x": 16.67372701148617,
"y": 12.997588199926543,
"z": 5.432509660720825
},
"rotation": {
"x": 0,
"y": 0,
"z": 2.993572126346171
}
},
"obj_type": "Personal vehicle",
"obj_id": "2"
}
],
"000965": [
{
"psr": {
"position": {
"x": 12.678969509007786,
"y": -12.72550632620182,
"z": -0.5258613526821136
},
"scale": {
"x": 14.873953074212206,
"y": 9.01690452224452,
"z": 2.72206574678421
},
"rotation": {
"x": 0,
"y": 0,
"z": 2.99357212634617
}
},
"obj_type": "Personal vehicle",
"obj_id": "3"
},
{
"psr": {
"position": {
"x": 14.04525345440314,
"y": 3.6402911227157486,
"z": -0.04190933704376221
},
"scale": {
"x": 10.071495305599894,
"y": 7.171325113558155,
"z": 5.090493440628052
},
"rotation": {
"x": 0,
"y": 0,
"z": -2.6580474313269304
}
},
"obj_type": "Personal vehicle",
"obj_id": "4"
}
],
"000970": [
{
"psr": {
"position": {
"x": 2.4613493554371804,
"y": 8.947661626313172,
"z": 0.21572160720825195
},
"scale": {
"x": 62.35026185183082,
"y": 97.18034925311514,
"z": 8.726404190063477
},
"rotation": {
"x": 0,
"y": 0,
"z": -2.6580474313269304
}
},
"obj_type": "Personal vehicle",
"obj_id": "5"
}
],
"000975": [
{
"psr": {
"position": {
"x": 13.960599950371503,
"y": 0.7873128198567101,
"z": -1.5273447930812836
},
"scale": {
"x": 20.379303339511864,
"y": 14.074981597535814,
"z": 2.112749397754669
},
"rotation": {
"x": 0,
"y": 0,
"z": -0.39218261369803376
}
},
"obj_type": "Default",
"obj_id": "6"
}
]
}
157 changes: 157 additions & 0 deletions tests/data_set/sample_project_point_cloud/classes/classes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
[
{
"id": 55917,
"project_id": 11979,
"name": "Personal vehicle",
"color": "#ecb65f",
"count": 25,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:48:19.000Z",
"attribute_groups": [
{
"id": 17245,
"class_id": 55917,
"name": "Num doors",
"is_multiselect": 0,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:35:20.000Z",
"attributes": [
{
"id": 62792,
"group_id": 17245,
"project_id": 11979,
"name": "2",
"count": 1,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:46:28.000Z"
},
{
"id": 62793,
"group_id": 17245,
"project_id": 11979,
"name": "4",
"count": 1,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:35:20.000Z"
}
]
}
]
},
{
"id": 55918,
"project_id": 11979,
"name": "Large vehicle",
"color": "#737b28",
"count": 1,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:48:19.000Z",
"attribute_groups": [
{
"id": 17246,
"class_id": 55918,
"name": "swedish",
"is_multiselect": 0,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:35:20.000Z",
"attributes": [
{
"id": 62794,
"group_id": 17246,
"project_id": 11979,
"name": "yes",
"count": 0,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:35:20.000Z"
},
{
"id": 62795,
"group_id": 17246,
"project_id": 11979,
"name": "no",
"count": 1,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:46:28.000Z"
}
]
},
{
"id": 17247,
"class_id": 55918,
"name": "Num doors",
"is_multiselect": 0,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:35:20.000Z",
"attributes": [
{
"id": 62796,
"group_id": 17247,
"project_id": 11979,
"name": "2",
"count": 0,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:35:20.000Z"
},
{
"id": 62797,
"group_id": 17247,
"project_id": 11979,
"name": "4",
"count": 1,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:46:28.000Z"
}
]
}
]
},
{
"id": 55919,
"project_id": 11979,
"name": "Human",
"color": "#e4542b",
"count": 9,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:48:14.000Z",
"attribute_groups": [
{
"id": 17248,
"class_id": 55919,
"name": "Height",
"is_multiselect": 0,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:35:20.000Z",
"attributes": [
{
"id": 62798,
"group_id": 17248,
"project_id": 11979,
"name": "Tall",
"count": 0,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:35:20.000Z"
},
{
"id": 62799,
"group_id": 17248,
"project_id": 11979,
"name": "Short",
"count": 0,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:35:20.000Z"
}
]
}
]
},
{
"id": 55920,
"project_id": 11979,
"name": "Plant",
"color": "#46ccb2",
"count": 0,
"createdAt": "2020-10-12T11:35:20.000Z",
"updatedAt": "2020-10-12T11:35:20.000Z",
"attribute_groups": []
}
]
2 changes: 2 additions & 0 deletions tests/data_set/sample_project_point_cloud/urls_template.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
url,name
https://sa-public-text-files.s3.us-west-2.amazonaws.com/davitb/lidar/data/3d_item_1.json,3d_item_1
Loading