supervisely 6.73.366__py3-none-any.whl → 6.73.368__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- supervisely/annotation/annotation.py +21 -21
- supervisely/annotation/label.py +4 -4
- supervisely/annotation/obj_class.py +9 -5
- supervisely/annotation/obj_class_collection.py +2 -2
- supervisely/annotation/tag.py +2 -2
- supervisely/annotation/tag_collection.py +3 -3
- supervisely/annotation/tag_meta.py +2 -2
- supervisely/annotation/tag_meta_collection.py +2 -2
- supervisely/api/agent_api.py +1 -1
- supervisely/api/annotation_api.py +1 -1
- supervisely/api/dataset_api.py +4 -4
- supervisely/api/entities_collection_api.py +1 -1
- supervisely/api/file_api.py +10 -10
- supervisely/api/image_api.py +9 -9
- supervisely/api/labeling_job_api.py +1 -1
- supervisely/api/labeling_queue_api.py +1 -1
- supervisely/api/module_api.py +6 -6
- supervisely/api/object_class_api.py +1 -1
- supervisely/api/plugin_api.py +1 -1
- supervisely/api/pointcloud/pointcloud_annotation_api.py +1 -1
- supervisely/api/pointcloud/pointcloud_api.py +1 -1
- supervisely/api/pointcloud/pointcloud_episode_annotation_api.py +1 -1
- supervisely/api/pointcloud/pointcloud_episode_api.py +1 -1
- supervisely/api/project_api.py +4 -4
- supervisely/api/remote_storage_api.py +6 -6
- supervisely/api/role_api.py +1 -1
- supervisely/api/storage_api.py +3 -3
- supervisely/api/task_api.py +1 -1
- supervisely/api/team_api.py +1 -1
- supervisely/api/user_api.py +1 -1
- supervisely/api/video/video_annotation_api.py +1 -1
- supervisely/api/video/video_api.py +4 -4
- supervisely/api/volume/volume_annotation_api.py +1 -1
- supervisely/api/volume/volume_api.py +1 -1
- supervisely/api/workspace_api.py +1 -2
- supervisely/app/development/sly-net.sh +2 -2
- supervisely/app/fastapi/index.html +3 -3
- supervisely/app/fastapi/subapp.py +1 -1
- supervisely/aug/aug.py +10 -10
- supervisely/cli/__init__.py +15 -10
- supervisely/geometry/alpha_mask.py +2 -2
- supervisely/geometry/bitmap.py +8 -6
- supervisely/geometry/bitmap_base.py +63 -24
- supervisely/geometry/cuboid.py +97 -50
- supervisely/geometry/cuboid_2d.py +2 -2
- supervisely/geometry/graph.py +4 -4
- supervisely/geometry/mask_3d.py +1 -1
- supervisely/geometry/point.py +63 -24
- supervisely/geometry/point_location.py +2 -2
- supervisely/geometry/polygon.py +2 -2
- supervisely/geometry/polyline.py +32 -40
- supervisely/geometry/rectangle.py +2 -2
- supervisely/geometry/vector_geometry.py +27 -39
- supervisely/io/env.py +3 -2
- supervisely/labeling_jobs/utils.py +5 -5
- supervisely/nn/model/prediction_session.py +50 -19
- supervisely/pointcloud/pointcloud.py +2 -2
- supervisely/pointcloud_annotation/pointcloud_annotation.py +19 -17
- supervisely/pointcloud_annotation/pointcloud_episode_annotation.py +23 -20
- supervisely/pointcloud_annotation/pointcloud_episode_frame.py +18 -12
- supervisely/pointcloud_annotation/pointcloud_episode_frame_collection.py +9 -6
- supervisely/pointcloud_annotation/pointcloud_episode_object_collection.py +7 -3
- supervisely/pointcloud_annotation/pointcloud_episode_tag.py +1 -1
- supervisely/pointcloud_annotation/pointcloud_episode_tag_collection.py +2 -2
- supervisely/pointcloud_annotation/pointcloud_figure.py +1 -1
- supervisely/pointcloud_annotation/pointcloud_object_collection.py +11 -10
- supervisely/pointcloud_annotation/pointcloud_tag.py +5 -4
- supervisely/pointcloud_annotation/pointcloud_tag_collection.py +7 -6
- supervisely/pointcloud_episodes/pointcloud_episodes.py +2 -2
- supervisely/project/download.py +1 -1
- supervisely/project/pointcloud_episode_project.py +1 -2
- supervisely/project/pointcloud_project.py +1 -1
- supervisely/project/project.py +8 -7
- supervisely/project/project_meta.py +2 -2
- supervisely/project/readme_template.md +1 -1
- supervisely/project/upload.py +1 -1
- supervisely/project/video_project.py +1 -1
- supervisely/project/volume_project.py +1 -1
- supervisely/task/progress.py +1 -1
- supervisely/video_annotation/frame.py +2 -2
- supervisely/video_annotation/frame_collection.py +3 -3
- supervisely/video_annotation/video_annotation.py +7 -5
- supervisely/video_annotation/video_figure.py +2 -2
- supervisely/video_annotation/video_object.py +47 -28
- supervisely/video_annotation/video_object_collection.py +15 -8
- supervisely/video_annotation/video_tag.py +2 -2
- supervisely/video_annotation/video_tag_collection.py +5 -5
- supervisely/volume_annotation/volume_figure.py +2 -2
- supervisely/volume_annotation/volume_tag.py +6 -5
- {supervisely-6.73.366.dist-info → supervisely-6.73.368.dist-info}/METADATA +2 -2
- {supervisely-6.73.366.dist-info → supervisely-6.73.368.dist-info}/RECORD +95 -95
- {supervisely-6.73.366.dist-info → supervisely-6.73.368.dist-info}/LICENSE +0 -0
- {supervisely-6.73.366.dist-info → supervisely-6.73.368.dist-info}/WHEEL +0 -0
- {supervisely-6.73.366.dist-info → supervisely-6.73.368.dist-info}/entry_points.txt +0 -0
- {supervisely-6.73.366.dist-info → supervisely-6.73.368.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import time
|
|
3
3
|
from os import PathLike
|
|
4
|
+
from pathlib import Path
|
|
4
5
|
from typing import Any, Dict, Iterator, List, Literal, Tuple, Union
|
|
5
6
|
|
|
6
7
|
import numpy as np
|
|
7
8
|
import requests
|
|
8
9
|
from requests import Timeout
|
|
10
|
+
from requests_toolbelt import MultipartEncoder, MultipartEncoderMonitor
|
|
9
11
|
from tqdm.auto import tqdm
|
|
10
12
|
|
|
11
13
|
import supervisely.io.env as env
|
|
@@ -17,6 +19,7 @@ from supervisely.io.fs import (
|
|
|
17
19
|
dir_exists,
|
|
18
20
|
file_exists,
|
|
19
21
|
get_file_ext,
|
|
22
|
+
get_file_size,
|
|
20
23
|
list_files,
|
|
21
24
|
list_files_recursively,
|
|
22
25
|
)
|
|
@@ -173,9 +176,9 @@ class PredictionSession:
|
|
|
173
176
|
ext = get_file_ext(input[0])
|
|
174
177
|
if ext == "":
|
|
175
178
|
raise ValueError("File has no extension.")
|
|
176
|
-
if ext in SUPPORTED_IMG_EXTS:
|
|
179
|
+
if ext.lower() in SUPPORTED_IMG_EXTS:
|
|
177
180
|
self._iterator = self._predict_images(input, **kwargs)
|
|
178
|
-
elif ext in ALLOWED_VIDEO_EXTENSIONS:
|
|
181
|
+
elif ext.lower() in ALLOWED_VIDEO_EXTENSIONS:
|
|
179
182
|
kwargs = get_valid_kwargs(kwargs, self._predict_videos, exclude=["videos"])
|
|
180
183
|
self._iterator = self._predict_videos(input, **kwargs)
|
|
181
184
|
else:
|
|
@@ -374,28 +377,26 @@ class PredictionSession:
|
|
|
374
377
|
json_body = self._get_json_body()
|
|
375
378
|
return self._post(method, json=json_body).json()
|
|
376
379
|
|
|
377
|
-
def _update_progress(
|
|
380
|
+
def _update_progress(
|
|
381
|
+
self,
|
|
382
|
+
tqdm: tqdm,
|
|
383
|
+
message: str = None,
|
|
384
|
+
current: int = None,
|
|
385
|
+
total: int = None,
|
|
386
|
+
is_size: bool = False,
|
|
387
|
+
):
|
|
378
388
|
if tqdm is None:
|
|
379
389
|
return
|
|
380
|
-
json_progress = response.get("progress", None)
|
|
381
|
-
if json_progress is None or json_progress.get("message") is None:
|
|
382
|
-
json_progress = response.get("preparing_progress", None)
|
|
383
|
-
if json_progress is None:
|
|
384
|
-
return
|
|
385
390
|
refresh = False
|
|
386
|
-
message
|
|
387
|
-
if message is not None and tqdm.desc not in [message, f"{message}:"]:
|
|
391
|
+
if message is not None and tqdm.desc != message:
|
|
388
392
|
tqdm.set_description(message, refresh=False)
|
|
389
393
|
refresh = True
|
|
390
|
-
current = json_progress.get("current", None)
|
|
391
394
|
if current is not None and tqdm.n != current:
|
|
392
395
|
tqdm.n = current
|
|
393
396
|
refresh = True
|
|
394
|
-
total = json_progress.get("total", None)
|
|
395
397
|
if total is not None and tqdm.total != total:
|
|
396
398
|
tqdm.total = total
|
|
397
399
|
refresh = True
|
|
398
|
-
is_size = json_progress.get("is_size", False)
|
|
399
400
|
if is_size and tqdm.unit == "it":
|
|
400
401
|
tqdm.unit = "iB"
|
|
401
402
|
tqdm.unit_scale = True
|
|
@@ -409,6 +410,20 @@ class PredictionSession:
|
|
|
409
410
|
if refresh:
|
|
410
411
|
tqdm.refresh()
|
|
411
412
|
|
|
413
|
+
def _update_progress_from_response(self, tqdm: tqdm, response: Dict[str, Any]):
|
|
414
|
+
if tqdm is None:
|
|
415
|
+
return
|
|
416
|
+
json_progress = response.get("progress", None)
|
|
417
|
+
if json_progress is None or json_progress.get("message") is None:
|
|
418
|
+
json_progress = response.get("preparing_progress", None)
|
|
419
|
+
if json_progress is None:
|
|
420
|
+
return
|
|
421
|
+
message = json_progress.get("message", json_progress.get("status", None))
|
|
422
|
+
current = json_progress.get("current", None)
|
|
423
|
+
total = json_progress.get("total", None)
|
|
424
|
+
is_size = json_progress.get("is_size", False)
|
|
425
|
+
self._update_progress(tqdm, message, current, total, is_size)
|
|
426
|
+
|
|
412
427
|
def _wait_for_inference_start(
|
|
413
428
|
self, delay=1, timeout=None, tqdm: tqdm = None
|
|
414
429
|
) -> Tuple[dict, bool]:
|
|
@@ -424,7 +439,7 @@ class PredictionSession:
|
|
|
424
439
|
last_stage = stage
|
|
425
440
|
has_started = stage not in ["preparing", "preprocess", None]
|
|
426
441
|
has_started = has_started or bool(resp.get("result")) or resp["progress"]["total"] != 1
|
|
427
|
-
self.
|
|
442
|
+
self._update_progress_from_response(tqdm, resp)
|
|
428
443
|
if not has_started:
|
|
429
444
|
time.sleep(delay)
|
|
430
445
|
timeout_exceeded = timeout and time.time() - t0 > timeout
|
|
@@ -440,7 +455,7 @@ class PredictionSession:
|
|
|
440
455
|
t0 = time.monotonic()
|
|
441
456
|
while not has_results and not timeout_exceeded:
|
|
442
457
|
resp = self._pop_pending_results()
|
|
443
|
-
self.
|
|
458
|
+
self._update_progress_from_response(tqdm, resp)
|
|
444
459
|
pending_results = resp["pending_results"]
|
|
445
460
|
exception_json = resp["exception"]
|
|
446
461
|
if exception_json:
|
|
@@ -567,14 +582,30 @@ class PredictionSession:
|
|
|
567
582
|
state["video_id"] = videos[0]
|
|
568
583
|
return self._start_inference(method, json=json_body)
|
|
569
584
|
elif isinstance(videos[0], (str, PathLike)):
|
|
585
|
+
video_path = videos[0]
|
|
570
586
|
files = []
|
|
571
587
|
try:
|
|
572
588
|
method = "inference_video_async"
|
|
573
|
-
files
|
|
574
|
-
|
|
575
|
-
|
|
589
|
+
files.append((Path(video_path).name, open(video_path, "rb"), "video/*"))
|
|
590
|
+
fields = {
|
|
591
|
+
"files": files[-1],
|
|
592
|
+
"state": json.dumps(state),
|
|
593
|
+
}
|
|
594
|
+
encoder = MultipartEncoder(fields)
|
|
595
|
+
if self.tqdm is not None:
|
|
596
|
+
|
|
597
|
+
def _callback(monitor):
|
|
598
|
+
self.tqdm.update(monitor.bytes_read)
|
|
599
|
+
|
|
600
|
+
video_size = get_file_size(video_path)
|
|
601
|
+
self._update_progress(self.tqdm, "Uploading video", 0, video_size, is_size=True)
|
|
602
|
+
encoder = MultipartEncoderMonitor(encoder, _callback)
|
|
603
|
+
|
|
604
|
+
return self._start_inference(
|
|
605
|
+
method, data=encoder, headers={"Content-Type": encoder.content_type}
|
|
606
|
+
)
|
|
576
607
|
finally:
|
|
577
|
-
for _, f in files:
|
|
608
|
+
for _, f, _ in files:
|
|
578
609
|
f.close()
|
|
579
610
|
else:
|
|
580
611
|
raise ValueError(
|
|
@@ -225,7 +225,7 @@ def get_labeling_tool_url(dataset_id: int, pointcloud_id: int):
|
|
|
225
225
|
api = sly.Api.from_env()
|
|
226
226
|
|
|
227
227
|
# Pass values into the API constructor (optional, not recommended)
|
|
228
|
-
# api = sly.Api(server_address="https://app.
|
|
228
|
+
# api = sly.Api(server_address="https://app.supervisely.com", token="4r47N...xaTatb")
|
|
229
229
|
|
|
230
230
|
pointcloud_id = 19373403
|
|
231
231
|
pcd_info = api.pointcloud.get_info_by_id(pointcloud_id)
|
|
@@ -268,7 +268,7 @@ def get_labeling_tool_link(url, name="open in labeling tool"):
|
|
|
268
268
|
api = sly.Api.from_env()
|
|
269
269
|
|
|
270
270
|
# Pass values into the API constructor (optional, not recommended)
|
|
271
|
-
# api = sly.Api(server_address="https://app.
|
|
271
|
+
# api = sly.Api(server_address="https://app.supervisely.com", token="4r47N...xaTatb")
|
|
272
272
|
|
|
273
273
|
pointcloud_id = 19373403
|
|
274
274
|
pcd_info = api.pointcloud.get_info_by_id(pointcloud_id)
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
2
|
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
from supervisely.project.project_meta import ProjectMeta
|
|
5
|
-
from copy import deepcopy
|
|
6
|
-
import uuid
|
|
3
|
+
|
|
7
4
|
import json
|
|
5
|
+
import uuid
|
|
6
|
+
from copy import deepcopy
|
|
7
|
+
from typing import Dict, List, Optional
|
|
8
8
|
|
|
9
9
|
from supervisely._utils import take_with_default
|
|
10
|
-
from supervisely.pointcloud_annotation.pointcloud_tag_collection import PointcloudTagCollection
|
|
11
10
|
from supervisely.pointcloud_annotation.constants import (
|
|
12
11
|
DESCRIPTION,
|
|
13
|
-
TAGS,
|
|
14
|
-
OBJECTS,
|
|
15
|
-
KEY,
|
|
16
12
|
FIGURES,
|
|
13
|
+
KEY,
|
|
14
|
+
OBJECTS,
|
|
17
15
|
POINTCLOUD_ID,
|
|
16
|
+
TAGS,
|
|
18
17
|
)
|
|
19
|
-
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
20
|
-
|
|
21
|
-
from supervisely.video_annotation.video_annotation import VideoAnnotation
|
|
22
18
|
from supervisely.pointcloud_annotation.pointcloud_figure import PointcloudFigure
|
|
23
19
|
from supervisely.pointcloud_annotation.pointcloud_object_collection import (
|
|
24
20
|
PointcloudObjectCollection,
|
|
25
21
|
)
|
|
22
|
+
from supervisely.pointcloud_annotation.pointcloud_tag_collection import (
|
|
23
|
+
PointcloudTagCollection,
|
|
24
|
+
)
|
|
25
|
+
from supervisely.project.project_meta import ProjectMeta
|
|
26
|
+
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
27
|
+
from supervisely.video_annotation.video_annotation import VideoAnnotation
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
class PointcloudAnnotation(VideoAnnotation):
|
|
@@ -117,7 +119,7 @@ class PointcloudAnnotation(VideoAnnotation):
|
|
|
117
119
|
|
|
118
120
|
import supervisely as sly
|
|
119
121
|
|
|
120
|
-
address = 'https://app.
|
|
122
|
+
address = 'https://app.supervisely.com/'
|
|
121
123
|
token = 'Your Supervisely API Token'
|
|
122
124
|
api = sly.Api(address, token)
|
|
123
125
|
|
|
@@ -148,7 +150,7 @@ class PointcloudAnnotation(VideoAnnotation):
|
|
|
148
150
|
|
|
149
151
|
import supervisely as sly
|
|
150
152
|
|
|
151
|
-
address = 'https://app.
|
|
153
|
+
address = 'https://app.supervisely.com/'
|
|
152
154
|
token = 'Your Supervisely API Token'
|
|
153
155
|
api = sly.Api(address, token)
|
|
154
156
|
|
|
@@ -179,7 +181,7 @@ class PointcloudAnnotation(VideoAnnotation):
|
|
|
179
181
|
|
|
180
182
|
import supervisely as sly
|
|
181
183
|
|
|
182
|
-
address = 'https://app.
|
|
184
|
+
address = 'https://app.supervisely.com/'
|
|
183
185
|
token = 'Your Supervisely API Token'
|
|
184
186
|
api = sly.Api(address, token)
|
|
185
187
|
|
|
@@ -297,7 +299,7 @@ class PointcloudAnnotation(VideoAnnotation):
|
|
|
297
299
|
import supervisely as sly
|
|
298
300
|
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
299
301
|
|
|
300
|
-
address = 'https://app.
|
|
302
|
+
address = 'https://app.supervisely.com/'
|
|
301
303
|
token = 'Your Supervisely API Token'
|
|
302
304
|
api = sly.Api(address, token)
|
|
303
305
|
|
|
@@ -354,7 +356,7 @@ class PointcloudAnnotation(VideoAnnotation):
|
|
|
354
356
|
|
|
355
357
|
import supervisely as sly
|
|
356
358
|
|
|
357
|
-
address = 'https://app.
|
|
359
|
+
address = 'https://app.supervisely.com/'
|
|
358
360
|
token = 'Your Supervisely API Token'
|
|
359
361
|
api = sly.Api(address, token)
|
|
360
362
|
|
|
@@ -405,7 +407,7 @@ class PointcloudAnnotation(VideoAnnotation):
|
|
|
405
407
|
import supervisely as sly
|
|
406
408
|
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
407
409
|
|
|
408
|
-
address = 'https://app.
|
|
410
|
+
address = 'https://app.supervisely.com/'
|
|
409
411
|
token = 'Your Supervisely API Token'
|
|
410
412
|
api = sly.Api(address, token)
|
|
411
413
|
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
2
|
from __future__ import annotations
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import json
|
|
5
|
-
|
|
5
|
+
import uuid
|
|
6
|
+
from typing import Dict, List, Optional
|
|
6
7
|
|
|
7
|
-
from supervisely.project.project_meta import ProjectMeta
|
|
8
8
|
from supervisely._utils import take_with_default
|
|
9
9
|
from supervisely.api.module_api import ApiField
|
|
10
|
+
from supervisely.pointcloud_annotation.pointcloud_episode_frame_collection import (
|
|
11
|
+
PointcloudEpisodeFrameCollection,
|
|
12
|
+
)
|
|
10
13
|
from supervisely.pointcloud_annotation.pointcloud_episode_object_collection import (
|
|
11
14
|
PointcloudEpisodeObjectCollection,
|
|
12
15
|
)
|
|
16
|
+
from supervisely.pointcloud_annotation.pointcloud_episode_tag_collection import (
|
|
17
|
+
PointcloudEpisodeTagCollection,
|
|
18
|
+
)
|
|
19
|
+
from supervisely.pointcloud_annotation.pointcloud_figure import PointcloudFigure
|
|
20
|
+
from supervisely.project.project_meta import ProjectMeta
|
|
13
21
|
from supervisely.video_annotation.constants import (
|
|
14
|
-
FRAMES,
|
|
15
22
|
DESCRIPTION,
|
|
23
|
+
FRAMES,
|
|
16
24
|
FRAMES_COUNT,
|
|
17
|
-
TAGS,
|
|
18
|
-
OBJECTS,
|
|
19
25
|
KEY,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
from supervisely.pointcloud_annotation.pointcloud_episode_frame_collection import (
|
|
23
|
-
PointcloudEpisodeFrameCollection,
|
|
26
|
+
OBJECTS,
|
|
27
|
+
TAGS,
|
|
24
28
|
)
|
|
25
29
|
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
26
|
-
from supervisely.pointcloud_annotation.pointcloud_episode_tag_collection import (
|
|
27
|
-
PointcloudEpisodeTagCollection,
|
|
28
|
-
)
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
class PointcloudEpisodeAnnotation:
|
|
@@ -388,7 +389,9 @@ class PointcloudEpisodeAnnotation:
|
|
|
388
389
|
tags = PointcloudEpisodeTagCollection.from_json(
|
|
389
390
|
data[TAGS], project_meta.tag_metas, key_id_map
|
|
390
391
|
)
|
|
391
|
-
objects = PointcloudEpisodeObjectCollection.from_json(
|
|
392
|
+
objects = PointcloudEpisodeObjectCollection.from_json(
|
|
393
|
+
data[OBJECTS], project_meta, key_id_map
|
|
394
|
+
)
|
|
392
395
|
frames = PointcloudEpisodeFrameCollection.from_json(
|
|
393
396
|
data[FRAMES], objects, key_id_map=key_id_map
|
|
394
397
|
)
|
|
@@ -416,7 +419,7 @@ class PointcloudEpisodeAnnotation:
|
|
|
416
419
|
|
|
417
420
|
import supervisely as sly
|
|
418
421
|
|
|
419
|
-
address = 'https://app.
|
|
422
|
+
address = 'https://app.supervisely.com/'
|
|
420
423
|
token = 'Your Supervisely API Token'
|
|
421
424
|
api = sly.Api(address, token)
|
|
422
425
|
|
|
@@ -466,7 +469,7 @@ class PointcloudEpisodeAnnotation:
|
|
|
466
469
|
import supervisely as sly
|
|
467
470
|
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
468
471
|
|
|
469
|
-
address = 'https://app.
|
|
472
|
+
address = 'https://app.supervisely.com/'
|
|
470
473
|
token = 'Your Supervisely API Token'
|
|
471
474
|
api = sly.Api(address, token)
|
|
472
475
|
|
|
@@ -608,7 +611,7 @@ class PointcloudEpisodeAnnotation:
|
|
|
608
611
|
|
|
609
612
|
import supervisely as sly
|
|
610
613
|
|
|
611
|
-
address = 'https://app.
|
|
614
|
+
address = 'https://app.supervisely.com/'
|
|
612
615
|
token = 'Your Supervisely API Token'
|
|
613
616
|
api = sly.Api(address, token)
|
|
614
617
|
|
|
@@ -689,7 +692,7 @@ class PointcloudEpisodeAnnotation:
|
|
|
689
692
|
|
|
690
693
|
import supervisely as sly
|
|
691
694
|
|
|
692
|
-
address = 'https://app.
|
|
695
|
+
address = 'https://app.supervisely.com/'
|
|
693
696
|
token = 'Your Supervisely API Token'
|
|
694
697
|
api = sly.Api(address, token)
|
|
695
698
|
|
|
@@ -733,7 +736,7 @@ class PointcloudEpisodeAnnotation:
|
|
|
733
736
|
|
|
734
737
|
import supervisely as sly
|
|
735
738
|
|
|
736
|
-
address = 'https://app.
|
|
739
|
+
address = 'https://app.supervisely.com/'
|
|
737
740
|
token = 'Your Supervisely API Token'
|
|
738
741
|
api = sly.Api(address, token)
|
|
739
742
|
|
|
@@ -804,7 +807,7 @@ class PointcloudEpisodeAnnotation:
|
|
|
804
807
|
import supervisely as sly
|
|
805
808
|
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
806
809
|
|
|
807
|
-
address = 'https://app.
|
|
810
|
+
address = 'https://app.supervisely.com/'
|
|
808
811
|
token = 'Your Supervisely API Token'
|
|
809
812
|
api = sly.Api(address, token)
|
|
810
813
|
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
from typing import Dict, List, Optional
|
|
3
4
|
|
|
4
5
|
from supervisely._utils import take_with_default
|
|
6
|
+
from supervisely.pointcloud_annotation.pointcloud_episode_object_collection import (
|
|
7
|
+
PointcloudEpisodeObjectCollection,
|
|
8
|
+
)
|
|
9
|
+
from supervisely.pointcloud_annotation.pointcloud_figure import PointcloudFigure
|
|
5
10
|
from supervisely.video_annotation.frame import Frame
|
|
6
11
|
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
7
|
-
|
|
8
|
-
from supervisely.pointcloud_annotation.pointcloud_episode_object_collection import PointcloudEpisodeObjectCollection
|
|
12
|
+
|
|
9
13
|
|
|
10
14
|
class PointcloudEpisodeFrame(Frame):
|
|
11
15
|
"""
|
|
@@ -56,19 +60,19 @@ class PointcloudEpisodeFrame(Frame):
|
|
|
56
60
|
|
|
57
61
|
figure_type = PointcloudFigure
|
|
58
62
|
|
|
59
|
-
def __init__(self, index: int, figures: Optional[List[PointcloudFigure]]=None):
|
|
63
|
+
def __init__(self, index: int, figures: Optional[List[PointcloudFigure]] = None):
|
|
60
64
|
super().__init__(index, figures)
|
|
61
65
|
|
|
62
66
|
@classmethod
|
|
63
67
|
def from_json(
|
|
64
|
-
cls,
|
|
65
|
-
data: Dict,
|
|
66
|
-
objects: PointcloudEpisodeObjectCollection,
|
|
67
|
-
frames_count: Optional[int]=None,
|
|
68
|
-
key_id_map: Optional[KeyIdMap]=None
|
|
68
|
+
cls,
|
|
69
|
+
data: Dict,
|
|
70
|
+
objects: PointcloudEpisodeObjectCollection,
|
|
71
|
+
frames_count: Optional[int] = None,
|
|
72
|
+
key_id_map: Optional[KeyIdMap] = None,
|
|
69
73
|
) -> PointcloudEpisodeFrame:
|
|
70
74
|
"""
|
|
71
|
-
Convert a json dict to PointcloudEpisodeFrame. Read more about `Supervisely format <https://docs.
|
|
75
|
+
Convert a json dict to PointcloudEpisodeFrame. Read more about `Supervisely format <https://docs.supervisely.com/data-organization/00_ann_format_navi>`_.
|
|
72
76
|
|
|
73
77
|
:param data: Dict in json format.
|
|
74
78
|
:type data: dict
|
|
@@ -108,5 +112,7 @@ class PointcloudEpisodeFrame(Frame):
|
|
|
108
112
|
|
|
109
113
|
return super().from_json(data, objects, frames_count, key_id_map)
|
|
110
114
|
|
|
111
|
-
def clone(
|
|
112
|
-
|
|
115
|
+
def clone(
|
|
116
|
+
self, index: Optional[int] = None, figures: Optional[List[PointcloudFigure]] = None
|
|
117
|
+
) -> PointcloudEpisodeFrame:
|
|
118
|
+
return super().clone(index, figures)
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from typing import List, Dict, Optional, Any, Iterator
|
|
3
2
|
|
|
4
|
-
from
|
|
5
|
-
|
|
6
|
-
from supervisely.pointcloud_annotation.
|
|
7
|
-
|
|
3
|
+
from typing import Any, Dict, Iterator, List, Optional
|
|
4
|
+
|
|
5
|
+
from supervisely.pointcloud_annotation.pointcloud_episode_frame import (
|
|
6
|
+
PointcloudEpisodeFrame,
|
|
7
|
+
)
|
|
8
8
|
from supervisely.pointcloud_annotation.pointcloud_episode_object_collection import (
|
|
9
9
|
PointcloudEpisodeObjectCollection,
|
|
10
10
|
)
|
|
11
|
+
from supervisely.pointcloud_annotation.pointcloud_figure import PointcloudFigure
|
|
12
|
+
from supervisely.video_annotation.frame_collection import FrameCollection
|
|
13
|
+
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
class PointcloudEpisodeFrameCollection(FrameCollection):
|
|
@@ -259,7 +262,7 @@ class PointcloudEpisodeFrameCollection(FrameCollection):
|
|
|
259
262
|
key_id_map: Optional[KeyIdMap] = None,
|
|
260
263
|
) -> PointcloudEpisodeFrameCollection:
|
|
261
264
|
"""
|
|
262
|
-
Convert a list of json dicts to PointcloudEpisodeFrameCollection. Read more about `Supervisely format <https://docs.
|
|
265
|
+
Convert a list of json dicts to PointcloudEpisodeFrameCollection. Read more about `Supervisely format <https://docs.supervisely.com/data-organization/00_ann_format_navi>`_.
|
|
263
266
|
|
|
264
267
|
:param data: List with dicts in json format.
|
|
265
268
|
:type data: List[dict]
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
2
|
from __future__ import annotations
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
from typing import Dict, Iterator, List, Optional
|
|
5
|
+
|
|
6
|
+
from supervisely.pointcloud_annotation.pointcloud_episode_object import (
|
|
7
|
+
PointcloudEpisodeObject,
|
|
8
|
+
)
|
|
4
9
|
from supervisely.pointcloud_annotation.pointcloud_object_collection import (
|
|
5
10
|
PointcloudObjectCollection,
|
|
6
11
|
)
|
|
7
|
-
from supervisely.pointcloud_annotation.pointcloud_episode_object import PointcloudEpisodeObject
|
|
8
12
|
from supervisely.project.project_meta import ProjectMeta
|
|
9
13
|
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
10
14
|
|
|
@@ -25,7 +29,7 @@ class PointcloudEpisodeObjectCollection(PointcloudObjectCollection):
|
|
|
25
29
|
cls, data: List[Dict], project_meta: ProjectMeta, key_id_map: Optional[KeyIdMap] = None
|
|
26
30
|
) -> PointcloudEpisodeObjectCollection:
|
|
27
31
|
"""
|
|
28
|
-
Convert a list of json dicts to PointcloudEpisodeObjectCollection. Read more about `Supervisely format <https://docs.
|
|
32
|
+
Convert a list of json dicts to PointcloudEpisodeObjectCollection. Read more about `Supervisely format <https://docs.supervisely.com/data-organization/00_ann_format_navi>`_.
|
|
29
33
|
|
|
30
34
|
:param data: List with dicts in json format.
|
|
31
35
|
:type data: List[dict]
|
|
@@ -92,7 +92,7 @@ class PointcloudEpisodeTag(VideoTag):
|
|
|
92
92
|
key_id_map: Optional[KeyIdMap] = None,
|
|
93
93
|
) -> PointcloudEpisodeTag:
|
|
94
94
|
"""
|
|
95
|
-
Convert a json dict to PointcloudEpisodeTag. Read more about `Supervisely format <https://docs.
|
|
95
|
+
Convert a json dict to PointcloudEpisodeTag. Read more about `Supervisely format <https://docs.supervisely.com/data-organization/00_ann_format_navi>`_.
|
|
96
96
|
|
|
97
97
|
:param data: PointcloudEpisodeTag in json format as a dict.
|
|
98
98
|
:type data: dict
|
|
@@ -177,7 +177,7 @@ class PointcloudEpisodeTagCollection(PointcloudTagCollection):
|
|
|
177
177
|
import supervisely as sly
|
|
178
178
|
|
|
179
179
|
# You can connect to API directly
|
|
180
|
-
address = 'https://app.
|
|
180
|
+
address = 'https://app.supervisely.com/'
|
|
181
181
|
token = 'Your Supervisely API Token'
|
|
182
182
|
api = sly.Api(address, token)
|
|
183
183
|
|
|
@@ -224,7 +224,7 @@ class PointcloudEpisodeTagCollection(PointcloudTagCollection):
|
|
|
224
224
|
) -> PointcloudEpisodeTagCollection:
|
|
225
225
|
"""
|
|
226
226
|
Convert a list with dicts in json format to :class:`PointcloudEpisodeTagCollection<PointcloudEpisodeTagCollection>`.
|
|
227
|
-
Read more about `Supervisely format <https://docs.
|
|
227
|
+
Read more about `Supervisely format <https://docs.supervisely.com/data-organization/00_ann_format_navi>`_.
|
|
228
228
|
|
|
229
229
|
:param data: List with dicts in json format.
|
|
230
230
|
:type data: :class:`List[Dict]`
|
|
@@ -137,7 +137,7 @@ class PointcloudFigure(VideoFigure):
|
|
|
137
137
|
key_id_map: Optional[KeyIdMap] = None,
|
|
138
138
|
) -> PointcloudFigure:
|
|
139
139
|
"""
|
|
140
|
-
Convert a json dict to PointcloudFigure. Read more about `Supervisely format <https://docs.
|
|
140
|
+
Convert a json dict to PointcloudFigure. Read more about `Supervisely format <https://docs.supervisely.com/data-organization/00_ann_format_navi>`_.
|
|
141
141
|
|
|
142
142
|
:param data: Dict in json format.
|
|
143
143
|
:type data: dict
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
2
|
from __future__ import annotations
|
|
3
|
-
|
|
4
|
-
from
|
|
3
|
+
|
|
4
|
+
from typing import Dict, Iterator, List, Optional
|
|
5
|
+
|
|
5
6
|
from supervisely.pointcloud_annotation.pointcloud_object import PointcloudObject
|
|
6
7
|
from supervisely.project.project_meta import ProjectMeta
|
|
7
8
|
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
9
|
+
from supervisely.video_annotation.video_object_collection import VideoObjectCollection
|
|
10
|
+
|
|
8
11
|
|
|
9
12
|
class PointcloudObjectCollection(VideoObjectCollection):
|
|
10
|
-
|
|
13
|
+
"""
|
|
11
14
|
Collection with :class:`PointcloudObject<supervisely.pointcloud_annotation.pointcloud_object.PointcloudObject>` instances.
|
|
12
15
|
:class:`PointcloudObjectCollection<PointcloudObjectCollection>` object is immutable.
|
|
13
|
-
|
|
16
|
+
"""
|
|
17
|
+
|
|
14
18
|
item_type = PointcloudObject
|
|
15
19
|
|
|
16
20
|
def __iter__(self) -> Iterator[PointcloudObject]:
|
|
@@ -18,13 +22,10 @@ class PointcloudObjectCollection(VideoObjectCollection):
|
|
|
18
22
|
|
|
19
23
|
@classmethod
|
|
20
24
|
def from_json(
|
|
21
|
-
cls,
|
|
22
|
-
data: List[Dict],
|
|
23
|
-
project_meta: ProjectMeta,
|
|
24
|
-
key_id_map: Optional[KeyIdMap]=None
|
|
25
|
+
cls, data: List[Dict], project_meta: ProjectMeta, key_id_map: Optional[KeyIdMap] = None
|
|
25
26
|
) -> PointcloudObjectCollection:
|
|
26
27
|
"""
|
|
27
|
-
Convert a list of json dicts to PointcloudObjectCollection. Read more about `Supervisely format <https://docs.
|
|
28
|
+
Convert a list of json dicts to PointcloudObjectCollection. Read more about `Supervisely format <https://docs.supervisely.com/data-organization/00_ann_format_navi>`_.
|
|
28
29
|
|
|
29
30
|
:param data: List with dicts in json format.
|
|
30
31
|
:type data: List[dict]
|
|
@@ -62,4 +63,4 @@ class PointcloudObjectCollection(VideoObjectCollection):
|
|
|
62
63
|
pointcloud_obj_collection = sly.PointcloudObjectCollection.from_json(obj_collection_json, meta)
|
|
63
64
|
"""
|
|
64
65
|
|
|
65
|
-
return super().from_json(data, project_meta, key_id_map=key_id_map)
|
|
66
|
+
return super().from_json(data, project_meta, key_id_map=key_id_map)
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import uuid
|
|
4
|
+
from typing import Dict, Optional, Union
|
|
4
5
|
|
|
5
6
|
from supervisely._utils import take_with_default
|
|
6
7
|
from supervisely.annotation.tag import Tag, TagJsonFields
|
|
7
8
|
from supervisely.annotation.tag_meta import TagMeta
|
|
8
9
|
from supervisely.annotation.tag_meta_collection import TagMetaCollection
|
|
10
|
+
from supervisely.pointcloud_annotation.constants import ID, KEY
|
|
9
11
|
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
10
|
-
from supervisely.pointcloud_annotation.constants import KEY, ID
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class PointcloudTag(Tag):
|
|
@@ -195,7 +196,7 @@ class PointcloudTag(Tag):
|
|
|
195
196
|
def to_json(self, key_id_map: Optional[KeyIdMap] = None) -> Dict:
|
|
196
197
|
"""
|
|
197
198
|
Convert the PointcloudTag to a json dict.
|
|
198
|
-
Read more about `Supervisely format <https://docs.
|
|
199
|
+
Read more about `Supervisely format <https://docs.supervisely.com/data-organization/00_ann_format_navi>`_.
|
|
199
200
|
|
|
200
201
|
:param key_id_map: KeyIdMap object.
|
|
201
202
|
:type key_id_map: :class:`KeyIdMap<supervisely.video_annotation.key_id_map.KeyIdMap>`, optional
|
|
@@ -238,7 +239,7 @@ class PointcloudTag(Tag):
|
|
|
238
239
|
key_id_map: Optional[KeyIdMap] = None,
|
|
239
240
|
) -> PointcloudTag:
|
|
240
241
|
"""
|
|
241
|
-
Convert a json dict to VideoTag. Read more about `Supervisely format <https://docs.
|
|
242
|
+
Convert a json dict to VideoTag. Read more about `Supervisely format <https://docs.supervisely.com/data-organization/00_ann_format_navi>`_.
|
|
242
243
|
|
|
243
244
|
:param data: PointcloudTag in json format as a dict.
|
|
244
245
|
:type data: :class:`dict`
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from typing import Optional, List, Dict, Any, Iterator
|
|
3
2
|
|
|
4
|
-
from
|
|
3
|
+
from typing import Any, Dict, Iterator, List, Optional
|
|
4
|
+
|
|
5
|
+
import supervisely.sly_logger as logger
|
|
5
6
|
from supervisely.annotation.tag_collection import TagCollection
|
|
7
|
+
from supervisely.annotation.tag_meta import TagMeta
|
|
6
8
|
from supervisely.annotation.tag_meta_collection import TagMetaCollection
|
|
7
9
|
from supervisely.pointcloud_annotation.pointcloud_tag import PointcloudTag
|
|
8
|
-
from supervisely.
|
|
9
|
-
import supervisely.sly_logger as logger
|
|
10
|
+
from supervisely.video_annotation.key_id_map import KeyIdMap
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
class PointcloudTagCollection(TagCollection):
|
|
@@ -192,7 +193,7 @@ class PointcloudTagCollection(TagCollection):
|
|
|
192
193
|
def to_json(self, key_id_map: Optional[KeyIdMap] = None) -> List[Dict]:
|
|
193
194
|
"""
|
|
194
195
|
Convert the :class:`PointcloudTagCollection<PointcloudTagCollection>` to a list of json dicts.
|
|
195
|
-
Read more about `Supervisely format <https://docs.
|
|
196
|
+
Read more about `Supervisely format <https://docs.supervisely.com/data-organization/00_ann_format_navi>`_.
|
|
196
197
|
|
|
197
198
|
:param key_id_map: KeyIdMap object.
|
|
198
199
|
:type key_id_map: :class:`KeyIdMap<supervisely.video_annotation.key_id_map.KeyIdMap>`, optional
|
|
@@ -241,7 +242,7 @@ class PointcloudTagCollection(TagCollection):
|
|
|
241
242
|
) -> PointcloudTagCollection:
|
|
242
243
|
"""
|
|
243
244
|
Convert a list with dicts in json format to :class:`PointcloudTagCollection<PointcloudTagCollection>`.
|
|
244
|
-
Read more about `Supervisely format <https://docs.
|
|
245
|
+
Read more about `Supervisely format <https://docs.supervisely.com/data-organization/00_ann_format_navi>`_.
|
|
245
246
|
|
|
246
247
|
:param data: List with dicts in json format.
|
|
247
248
|
:type data: :class:`List[Dict]`
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"""Functions for processing pointcloud episodes"""
|
|
2
2
|
|
|
3
|
-
from supervisely._utils import
|
|
3
|
+
from supervisely._utils import abs_url, is_development
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
def get_labeling_tool_url(dataset_id, pointcloud_id):
|
|
@@ -29,7 +29,7 @@ def get_labeling_tool_url(dataset_id, pointcloud_id):
|
|
|
29
29
|
api = sly.Api.from_env()
|
|
30
30
|
|
|
31
31
|
# Pass values into the API constructor (optional, not recommended)
|
|
32
|
-
# api = sly.Api(server_address="https://app.
|
|
32
|
+
# api = sly.Api(server_address="https://app.supervisely.com", token="4r47N...xaTatb")
|
|
33
33
|
|
|
34
34
|
pointcloud_id = 19373403
|
|
35
35
|
pcd_info = api.pointcloud_episodes.get_info_by_id(pointcloud_id)
|