supervisely 6.73.384__py3-none-any.whl → 6.73.385__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 +1 -1
- supervisely/convert/image/coco/coco_helper.py +29 -22
- supervisely/convert/pointcloud/pointcloud_converter.py +19 -19
- supervisely/convert/pointcloud/sly/sly_pointcloud_converter.py +20 -18
- supervisely/convert/pointcloud_episodes/pointcloud_episodes_converter.py +16 -18
- supervisely/convert/pointcloud_episodes/sly/sly_pointcloud_episodes_converter.py +16 -19
- {supervisely-6.73.384.dist-info → supervisely-6.73.385.dist-info}/METADATA +1 -1
- {supervisely-6.73.384.dist-info → supervisely-6.73.385.dist-info}/RECORD +12 -12
- {supervisely-6.73.384.dist-info → supervisely-6.73.385.dist-info}/LICENSE +0 -0
- {supervisely-6.73.384.dist-info → supervisely-6.73.385.dist-info}/WHEEL +0 -0
- {supervisely-6.73.384.dist-info → supervisely-6.73.385.dist-info}/entry_points.txt +0 -0
- {supervisely-6.73.384.dist-info → supervisely-6.73.385.dist-info}/top_level.txt +0 -0
|
@@ -3056,7 +3056,7 @@ class Annotation:
|
|
|
3056
3056
|
licenses=[dict(url="None", id=0, name="None")],
|
|
3057
3057
|
images=[],
|
|
3058
3058
|
annotations=[],
|
|
3059
|
-
categories=get_categories_from_meta(meta), # [{"supercategory": "lemon", "id":
|
|
3059
|
+
categories=get_categories_from_meta(meta), # [{"supercategory": "lemon", "id": 1, "name": "lemon"}, ...]
|
|
3060
3060
|
)
|
|
3061
3061
|
|
|
3062
3062
|
ann = sly.Annotation.from_json(ann_json, meta)
|
|
@@ -357,7 +357,7 @@ def get_categories_from_meta(meta: ProjectMeta) -> List[Dict[str, Any]]:
|
|
|
357
357
|
cat = lambda idx, c: {"supercategory": c.name, "id": idx, "name": c.name}
|
|
358
358
|
return [
|
|
359
359
|
cat(idx, c) if c.geometry_type != GraphNodes else _get_graph_info(idx, c)
|
|
360
|
-
for idx, c in enumerate(meta.obj_classes)
|
|
360
|
+
for idx, c in enumerate(meta.obj_classes, start=1)
|
|
361
361
|
]
|
|
362
362
|
|
|
363
363
|
|
|
@@ -435,7 +435,7 @@ def sly_ann_to_coco(
|
|
|
435
435
|
licenses=[dict(url="None", id=0, name="None")],
|
|
436
436
|
images=[],
|
|
437
437
|
annotations=[],
|
|
438
|
-
categories=get_categories_from_meta(meta), # [{"supercategory": "lemon", "id":
|
|
438
|
+
categories=get_categories_from_meta(meta), # [{"supercategory": "lemon", "id": 1, "name": "lemon"}, ...]
|
|
439
439
|
)
|
|
440
440
|
|
|
441
441
|
ann = sly.Annotation.from_json(ann_json, meta)
|
|
@@ -524,20 +524,21 @@ def sly_ann_to_coco(
|
|
|
524
524
|
h, w = ann.img_size
|
|
525
525
|
for binding_key, labels in ann.get_bindings().items():
|
|
526
526
|
if binding_key is None:
|
|
527
|
-
polygons = [l for l in labels if l.
|
|
528
|
-
masks = [l for l in labels if l.
|
|
529
|
-
bboxes = [l for l in labels if l.
|
|
530
|
-
graphs = [l for l in labels if l.
|
|
527
|
+
polygons = [l for l in labels if l.geometry.name() == Polygon.geometry_name()]
|
|
528
|
+
masks = [l for l in labels if l.geometry.name() == Bitmap.geometry_name()]
|
|
529
|
+
bboxes = [l for l in labels if l.geometry.name() == Rectangle.geometry_name()]
|
|
530
|
+
graphs = [l for l in labels if l.geometry.name() == GraphNodes.geometry_name()]
|
|
531
|
+
# polygons = [l for l in labels if l.obj_class.geometry_type == Polygon]
|
|
531
532
|
for label in polygons + bboxes + masks:
|
|
532
533
|
cat_id = class_mapping[label.obj_class.name]
|
|
533
534
|
coco_obj = coco_obj_template(label_id, coco_image_id, cat_id)
|
|
534
535
|
coco_obj["bbox"] = _get_common_bbox([label])
|
|
535
536
|
coco_obj["area"] = label.geometry.area
|
|
536
|
-
if label.
|
|
537
|
+
if label.geometry.name() == Polygon.geometry_name():
|
|
537
538
|
poly = label.geometry.to_json()["points"]["exterior"]
|
|
538
539
|
poly = np.array(poly).flatten().astype(float).tolist()
|
|
539
540
|
coco_obj["segmentation"] = [poly]
|
|
540
|
-
elif label.
|
|
541
|
+
elif label.geometry.name() == Bitmap.geometry_name():
|
|
541
542
|
segmentation = extend_mask_up_to_image(
|
|
542
543
|
label.geometry.data, (h, w), label.geometry.origin
|
|
543
544
|
)
|
|
@@ -552,10 +553,10 @@ def sly_ann_to_coco(
|
|
|
552
553
|
|
|
553
554
|
continue
|
|
554
555
|
|
|
555
|
-
bboxes = [l for l in labels if l.
|
|
556
|
-
polygons = [l for l in labels if l.
|
|
557
|
-
masks = [l for l in labels if l.
|
|
558
|
-
graphs = [l for l in labels if l.
|
|
556
|
+
bboxes = [l for l in labels if l.geometry.name() == Rectangle.geometry_name()]
|
|
557
|
+
polygons = [l for l in labels if l.geometry.name() == Polygon.geometry_name()]
|
|
558
|
+
masks = [l for l in labels if l.geometry.name() == Bitmap.geometry_name()]
|
|
559
|
+
graphs = [l for l in labels if l.geometry.name() == GraphNodes.geometry_name()]
|
|
559
560
|
|
|
560
561
|
need_to_process_separately = len(masks) > 0 and len(polygons) > 0
|
|
561
562
|
bbox_matched_w_mask = False
|
|
@@ -624,8 +625,14 @@ def sly_ann_to_coco(
|
|
|
624
625
|
|
|
625
626
|
res_captions = [] # result list of COCO captions
|
|
626
627
|
for tag in caption_tags:
|
|
627
|
-
caption = {
|
|
628
|
-
|
|
628
|
+
caption = {
|
|
629
|
+
"image_id": coco_image_id,
|
|
630
|
+
"id": last_caption_id,
|
|
631
|
+
"caption": tag.value,
|
|
632
|
+
}
|
|
633
|
+
last_caption_id = _update_caption_results(
|
|
634
|
+
last_caption_id, coco_captions, caption, res_captions
|
|
635
|
+
)
|
|
629
636
|
|
|
630
637
|
return res_inst, res_captions
|
|
631
638
|
|
|
@@ -738,7 +745,7 @@ def sly_ds_to_coco(
|
|
|
738
745
|
sly_id=info.id,
|
|
739
746
|
)
|
|
740
747
|
|
|
741
|
-
class_mapping = {cls.name: idx for idx, cls in enumerate(meta.obj_classes)}
|
|
748
|
+
class_mapping = {cls.name: idx for idx, cls in enumerate(meta.obj_classes, start=1)}
|
|
742
749
|
label_id = 0
|
|
743
750
|
caption_id = 0
|
|
744
751
|
for image_idx, name in enumerate(dataset.get_items_names(), 1):
|
|
@@ -751,16 +758,20 @@ def sly_ds_to_coco(
|
|
|
751
758
|
dst_img_path = images_dir / img_name
|
|
752
759
|
shutil.copy(img_path, dst_img_path)
|
|
753
760
|
|
|
761
|
+
ann = Annotation.load_json_file(ann_path, meta)
|
|
762
|
+
if ann.img_size is None or ann.img_size == (0, 0) or ann.img_size == (None, None):
|
|
763
|
+
img = sly_image(img_path)
|
|
764
|
+
ann = ann.clone(img_size=[img.shape[0], img.shape[1]])
|
|
765
|
+
|
|
754
766
|
if os.path.exists(img_info_path):
|
|
755
767
|
image_info_json = load_json_file(img_info_path)
|
|
756
768
|
else:
|
|
757
|
-
img = sly_image(img_path, remove_alpha_channel=False)
|
|
758
769
|
now = datetime.now()
|
|
759
770
|
image_info_json = {
|
|
760
771
|
"id": None,
|
|
761
772
|
"name": img_name,
|
|
762
|
-
"height":
|
|
763
|
-
"width":
|
|
773
|
+
"height": ann.img_size[0],
|
|
774
|
+
"width": ann.img_size[1],
|
|
764
775
|
"created_at": now.strftime("%Y-%m-%d %H:%M:%S"),
|
|
765
776
|
}
|
|
766
777
|
image_info = ImageApi._convert_json_info(ImageApi(None), image_info_json)
|
|
@@ -771,10 +782,6 @@ def sly_ds_to_coco(
|
|
|
771
782
|
coco_captions["images"].append(image_coco(image_info, image_idx))
|
|
772
783
|
# pylint: enable=unsubscriptable-object
|
|
773
784
|
|
|
774
|
-
ann = Annotation.load_json_file(ann_path, meta)
|
|
775
|
-
if ann.img_size is None or ann.img_size == (0, 0) or ann.img_size == (None, None):
|
|
776
|
-
img = sly_image(img_path)
|
|
777
|
-
ann = ann.clone(img_size=[img.shape[0], img.shape[1]])
|
|
778
785
|
insts, captions = ann.to_coco(
|
|
779
786
|
image_idx, class_mapping, coco_ann, label_id, coco_captions, caption_id
|
|
780
787
|
)
|
|
@@ -3,7 +3,6 @@ import os
|
|
|
3
3
|
from typing import Dict, List, Optional, Set, Tuple
|
|
4
4
|
from uuid import UUID
|
|
5
5
|
|
|
6
|
-
import supervisely.convert.pointcloud.sly.sly_pointcloud_helper as helpers
|
|
7
6
|
from supervisely import (
|
|
8
7
|
Api,
|
|
9
8
|
PointcloudAnnotation,
|
|
@@ -14,7 +13,7 @@ from supervisely import (
|
|
|
14
13
|
)
|
|
15
14
|
from supervisely.api.module_api import ApiField
|
|
16
15
|
from supervisely.convert.base_converter import BaseConverter
|
|
17
|
-
from supervisely.io.fs import get_file_ext,
|
|
16
|
+
from supervisely.io.fs import get_file_ext, get_file_name_with_ext
|
|
18
17
|
from supervisely.io.json import load_json_file
|
|
19
18
|
from supervisely.pointcloud.pointcloud import ALLOWED_POINTCLOUD_EXTENSIONS
|
|
20
19
|
from supervisely.pointcloud.pointcloud import validate_ext as validate_pcd_ext
|
|
@@ -88,6 +87,7 @@ class PointcloudConverter(BaseConverter):
|
|
|
88
87
|
else:
|
|
89
88
|
progress_cb = None
|
|
90
89
|
|
|
90
|
+
key_id_map = KeyIdMap()
|
|
91
91
|
for batch in batched(self._items, batch_size=batch_size):
|
|
92
92
|
item_names = []
|
|
93
93
|
item_paths = []
|
|
@@ -110,7 +110,6 @@ class PointcloudConverter(BaseConverter):
|
|
|
110
110
|
pcd_ids = [pcd_info.id for pcd_info in pcd_infos]
|
|
111
111
|
pcl_to_rimg_figures: Dict[int, Dict[str, List[Dict]]] = {}
|
|
112
112
|
pcl_to_hash_to_id: Dict[int, Dict[str, int]] = {}
|
|
113
|
-
key_id_map = KeyIdMap()
|
|
114
113
|
for pcd_id, ann, item in zip(pcd_ids, anns, batch):
|
|
115
114
|
if ann is not None:
|
|
116
115
|
api.pointcloud.annotation.append(pcd_id, ann, key_id_map)
|
|
@@ -229,7 +228,6 @@ class PointcloudConverter(BaseConverter):
|
|
|
229
228
|
only_modality_items = True
|
|
230
229
|
unsupported_exts = set()
|
|
231
230
|
pcd_list, rimg_dict, rimg_ann_dict, rimg_fig_dict = [], {}, {}, {}
|
|
232
|
-
used_img_ext = set()
|
|
233
231
|
for root, _, files in os.walk(self._input_data):
|
|
234
232
|
for file in files:
|
|
235
233
|
full_path = os.path.join(root, file)
|
|
@@ -237,7 +235,9 @@ class PointcloudConverter(BaseConverter):
|
|
|
237
235
|
continue
|
|
238
236
|
|
|
239
237
|
ext = get_file_ext(full_path)
|
|
240
|
-
if
|
|
238
|
+
if file.endswith(".figures.json"):
|
|
239
|
+
rimg_fig_dict[file] = full_path
|
|
240
|
+
elif ext == ".json":
|
|
241
241
|
dir_name = os.path.basename(root)
|
|
242
242
|
parent_dir_name = os.path.basename(os.path.dirname(root))
|
|
243
243
|
if any(
|
|
@@ -246,17 +246,15 @@ class PointcloudConverter(BaseConverter):
|
|
|
246
246
|
) or dir_name.endswith("_pcd"):
|
|
247
247
|
rimg_ann_dict[file] = full_path
|
|
248
248
|
elif imghdr.what(full_path):
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
if dir_name not in rimg_dict:
|
|
250
|
+
rimg_dict[dir_name] = []
|
|
251
|
+
rimg_dict[dir_name].append(full_path)
|
|
252
252
|
elif ext.lower() in self.allowed_exts:
|
|
253
253
|
try:
|
|
254
254
|
validate_pcd_ext(ext)
|
|
255
255
|
pcd_list.append(full_path)
|
|
256
256
|
except:
|
|
257
257
|
pass
|
|
258
|
-
elif file.endswith(".figures.json"):
|
|
259
|
-
rimg_fig_dict[file] = full_path
|
|
260
258
|
else:
|
|
261
259
|
only_modality_items = False
|
|
262
260
|
unsupported_exts.add(ext)
|
|
@@ -265,14 +263,16 @@ class PointcloudConverter(BaseConverter):
|
|
|
265
263
|
items = []
|
|
266
264
|
for pcd_path in pcd_list:
|
|
267
265
|
item = self.Item(pcd_path)
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
rimg_fig_path = rimg_fig_dict.get(
|
|
276
|
-
|
|
266
|
+
rimg_dir_name = item.name.replace(".pcd", "_pcd")
|
|
267
|
+
rimgs = rimg_dict.get(rimg_dir_name, [])
|
|
268
|
+
for rimg_path in rimgs:
|
|
269
|
+
rimg_ann_name = f"{get_file_name_with_ext(rimg_path)}.json"
|
|
270
|
+
if rimg_ann_name in rimg_ann_dict:
|
|
271
|
+
rimg_ann_path = rimg_ann_dict[rimg_ann_name]
|
|
272
|
+
rimg_fig_name = f"{get_file_name_with_ext(rimg_path)}.figures.json"
|
|
273
|
+
rimg_fig_path = rimg_fig_dict.get(rimg_fig_name, None)
|
|
274
|
+
if rimg_fig_path is not None and not os.path.exists(rimg_fig_path):
|
|
275
|
+
rimg_fig_path = None
|
|
276
|
+
item.set_related_images((rimg_path, rimg_ann_path, rimg_fig_path))
|
|
277
277
|
items.append(item)
|
|
278
278
|
return items, only_modality_items, unsupported_exts
|
|
@@ -6,7 +6,7 @@ import supervisely.convert.pointcloud.sly.sly_pointcloud_helper as helpers
|
|
|
6
6
|
from supervisely import PointcloudAnnotation, ProjectMeta, logger
|
|
7
7
|
from supervisely.convert.base_converter import AvailablePointcloudConverters
|
|
8
8
|
from supervisely.convert.pointcloud.pointcloud_converter import PointcloudConverter
|
|
9
|
-
from supervisely.io.fs import get_file_ext, get_file_name
|
|
9
|
+
from supervisely.io.fs import get_file_ext, get_file_name, get_file_name_with_ext
|
|
10
10
|
from supervisely.io.json import load_json_file
|
|
11
11
|
from supervisely.pointcloud.pointcloud import validate_ext as validate_pcd_ext
|
|
12
12
|
|
|
@@ -47,8 +47,8 @@ class SLYPointcloudConverter(PointcloudConverter):
|
|
|
47
47
|
|
|
48
48
|
def validate_format(self) -> bool:
|
|
49
49
|
pcd_list, ann_dict, rimg_dict, rimg_ann_dict = [], {}, {}, {}
|
|
50
|
-
used_img_ext = []
|
|
51
50
|
for root, _, files in os.walk(self._input_data):
|
|
51
|
+
dir_name = os.path.basename(root)
|
|
52
52
|
for file in files:
|
|
53
53
|
full_path = os.path.join(root, file)
|
|
54
54
|
if file == "key_id_map.json":
|
|
@@ -60,19 +60,18 @@ class SLYPointcloudConverter(PointcloudConverter):
|
|
|
60
60
|
|
|
61
61
|
ext = get_file_ext(full_path)
|
|
62
62
|
if ext in self.ann_ext:
|
|
63
|
-
dir_name = os.path.basename(root)
|
|
64
63
|
parent_dir_name = os.path.basename(os.path.dirname(root))
|
|
64
|
+
possible_dirs = ["images", "related images", "photo context"]
|
|
65
65
|
if any(
|
|
66
|
-
p.replace("_", " ") in
|
|
67
|
-
|
|
68
|
-
) or dir_name.endswith("_pcd"):
|
|
66
|
+
p.replace("_", " ") in possible_dirs for p in [dir_name, parent_dir_name]
|
|
67
|
+
):
|
|
69
68
|
rimg_ann_dict[file] = full_path
|
|
70
69
|
else:
|
|
71
70
|
ann_dict[file] = full_path
|
|
72
71
|
elif imghdr.what(full_path):
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
if dir_name not in rimg_dict:
|
|
73
|
+
rimg_dict[dir_name] = []
|
|
74
|
+
rimg_dict[dir_name].append(full_path)
|
|
76
75
|
else:
|
|
77
76
|
try:
|
|
78
77
|
validate_pcd_ext(ext)
|
|
@@ -97,15 +96,18 @@ class SLYPointcloudConverter(PointcloudConverter):
|
|
|
97
96
|
if is_valid:
|
|
98
97
|
item.ann_data = ann_path
|
|
99
98
|
sly_ann_detected = True
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
99
|
+
|
|
100
|
+
rimg_dir_name = item.name.replace(".pcd", "_pcd")
|
|
101
|
+
rimgs = rimg_dict.get(rimg_dir_name, [])
|
|
102
|
+
for rimg_path in rimgs:
|
|
103
|
+
rimg_ann_name = f"{get_file_name_with_ext(rimg_path)}.json"
|
|
104
|
+
if rimg_ann_name in rimg_ann_dict:
|
|
105
|
+
rimg_ann_path = rimg_ann_dict[rimg_ann_name]
|
|
106
|
+
rimg_fig_name = f"{get_file_name_with_ext(rimg_path)}.figures.json"
|
|
107
|
+
rimg_fig_path = rimg_ann_dict.get(rimg_fig_name, None)
|
|
108
|
+
if rimg_fig_path is not None and not os.path.exists(rimg_fig_path):
|
|
109
|
+
rimg_fig_path = None
|
|
110
|
+
item.set_related_images((rimg_path, rimg_ann_path, rimg_fig_path))
|
|
109
111
|
self._items.append(item)
|
|
110
112
|
return sly_ann_detected
|
|
111
113
|
|
|
@@ -13,7 +13,7 @@ from supervisely import (
|
|
|
13
13
|
)
|
|
14
14
|
from supervisely.api.module_api import ApiField
|
|
15
15
|
from supervisely.convert.base_converter import BaseConverter
|
|
16
|
-
from supervisely.io.fs import get_file_ext,
|
|
16
|
+
from supervisely.io.fs import get_file_ext, get_file_name_with_ext
|
|
17
17
|
from supervisely.io.json import load_json_file
|
|
18
18
|
from supervisely.pointcloud.pointcloud import ALLOWED_POINTCLOUD_EXTENSIONS
|
|
19
19
|
from supervisely.pointcloud.pointcloud import validate_ext as validate_pcd_ext
|
|
@@ -281,9 +281,9 @@ class PointcloudEpisodeConverter(BaseConverter):
|
|
|
281
281
|
unsupported_exts = set()
|
|
282
282
|
pcd_dict = {}
|
|
283
283
|
frames_pcd_map = None
|
|
284
|
-
used_img_ext = set()
|
|
285
284
|
rimg_dict, rimg_json_dict, rimg_fig_dict = {}, {}, {}
|
|
286
285
|
for root, _, files in os.walk(self._input_data):
|
|
286
|
+
dir_name = os.path.basename(root)
|
|
287
287
|
for file in files:
|
|
288
288
|
full_path = os.path.join(root, file)
|
|
289
289
|
if file == "frame_pointcloud_map.json":
|
|
@@ -302,9 +302,9 @@ class PointcloudEpisodeConverter(BaseConverter):
|
|
|
302
302
|
f"File '{file}' has been recognized as '.{recognized_ext}' format. Skipping."
|
|
303
303
|
)
|
|
304
304
|
continue
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
305
|
+
if dir_name not in rimg_dict:
|
|
306
|
+
rimg_dict[dir_name] = []
|
|
307
|
+
rimg_dict[dir_name].append(full_path)
|
|
308
308
|
elif ext.lower() in self.allowed_exts:
|
|
309
309
|
try:
|
|
310
310
|
validate_pcd_ext(ext)
|
|
@@ -326,19 +326,17 @@ class PointcloudEpisodeConverter(BaseConverter):
|
|
|
326
326
|
if pcd_name in pcd_dict:
|
|
327
327
|
updated_frames_pcd_map[i] = pcd_name
|
|
328
328
|
item = self.Item(pcd_dict[pcd_name], i)
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
if
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
rimg_fig_path
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
rimg_ann_path = rimg_json_dict[rimg_ann_name]
|
|
341
|
-
item.set_related_images((rimg_path, rimg_ann_path, rimg_fig_path))
|
|
329
|
+
rimg_dir_name = pcd_name.replace(".pcd", "_pcd")
|
|
330
|
+
rimgs = rimg_dict.get(rimg_dir_name, [])
|
|
331
|
+
for rimg_path in rimgs:
|
|
332
|
+
rimg_ann_name = f"{get_file_name_with_ext(rimg_path)}.json"
|
|
333
|
+
if rimg_ann_name in rimg_json_dict:
|
|
334
|
+
rimg_ann_path = rimg_json_dict[rimg_ann_name]
|
|
335
|
+
rimg_fig_name = f"{get_file_name_with_ext(rimg_path)}.figures.json"
|
|
336
|
+
rimg_fig_path = rimg_fig_dict.get(rimg_fig_name, None)
|
|
337
|
+
if rimg_fig_path is not None and not os.path.exists(rimg_fig_path):
|
|
338
|
+
rimg_fig_path = None
|
|
339
|
+
item.set_related_images((rimg_path, rimg_ann_path, rimg_fig_path))
|
|
342
340
|
items.append(item)
|
|
343
341
|
else:
|
|
344
342
|
logger.warning(f"Pointcloud file {pcd_name} not found. Skipping frame.")
|
|
@@ -7,7 +7,7 @@ from supervisely.convert.base_converter import AvailablePointcloudEpisodesConver
|
|
|
7
7
|
from supervisely.convert.pointcloud_episodes.pointcloud_episodes_converter import (
|
|
8
8
|
PointcloudEpisodeConverter,
|
|
9
9
|
)
|
|
10
|
-
from supervisely.io.fs import JUNK_FILES, get_file_ext,
|
|
10
|
+
from supervisely.io.fs import JUNK_FILES, get_file_ext, get_file_name_with_ext
|
|
11
11
|
from supervisely.io.json import load_json_file
|
|
12
12
|
from supervisely.pointcloud.pointcloud import validate_ext as validate_pcd_ext
|
|
13
13
|
|
|
@@ -52,9 +52,9 @@ class SLYPointcloudEpisodesConverter(PointcloudEpisodeConverter):
|
|
|
52
52
|
ann_path = None
|
|
53
53
|
pcd_dict = {}
|
|
54
54
|
frames_pcd_map = None
|
|
55
|
-
used_img_ext = []
|
|
56
55
|
rimg_dict, rimg_json_dict = {}, {}
|
|
57
56
|
for root, _, files in os.walk(self._input_data):
|
|
57
|
+
dir_name = os.path.basename(root)
|
|
58
58
|
for file in files:
|
|
59
59
|
full_path = os.path.join(root, file)
|
|
60
60
|
if file == "key_id_map.json":
|
|
@@ -82,9 +82,9 @@ class SLYPointcloudEpisodesConverter(PointcloudEpisodeConverter):
|
|
|
82
82
|
f"File '{file}' has been recognized as '.{recognized_ext}' format. Skipping."
|
|
83
83
|
)
|
|
84
84
|
continue
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
if dir_name not in rimg_dict:
|
|
86
|
+
rimg_dict[dir_name] = []
|
|
87
|
+
rimg_dict[dir_name].append(full_path)
|
|
88
88
|
else:
|
|
89
89
|
try:
|
|
90
90
|
validate_pcd_ext(ext)
|
|
@@ -118,20 +118,17 @@ class SLYPointcloudEpisodesConverter(PointcloudEpisodeConverter):
|
|
|
118
118
|
if pcd_name in pcd_dict:
|
|
119
119
|
updated_frames_pcd_map[i] = pcd_name
|
|
120
120
|
item = self.Item(pcd_dict[pcd_name], i)
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if not os.path.exists(rimg_fig_path):
|
|
133
|
-
rimg_fig_path = None
|
|
134
|
-
item.set_related_images((rimg_path, rimg_ann_path, rimg_fig_path))
|
|
121
|
+
rimg_dir_name = pcd_name.replace(".pcd", "_pcd")
|
|
122
|
+
rimgs = rimg_dict.get(rimg_dir_name, [])
|
|
123
|
+
for rimg_path in rimgs:
|
|
124
|
+
rimg_ann_name = f"{get_file_name_with_ext(rimg_path)}.json"
|
|
125
|
+
if rimg_ann_name in rimg_json_dict:
|
|
126
|
+
rimg_ann_path = rimg_json_dict[rimg_ann_name]
|
|
127
|
+
rimg_fig_name = f"{get_file_name_with_ext(rimg_path)}.figures.json"
|
|
128
|
+
rimg_fig_path = rimg_json_dict.get(rimg_fig_name, None)
|
|
129
|
+
if rimg_fig_path is not None and not os.path.exists(rimg_fig_path):
|
|
130
|
+
rimg_fig_path = None
|
|
131
|
+
item.set_related_images((rimg_path, rimg_ann_path, rimg_fig_path))
|
|
135
132
|
self._items.append(item)
|
|
136
133
|
else:
|
|
137
134
|
logger.warning(f"Pointcloud file {pcd_name} not found. Skipping frame.")
|
|
@@ -5,7 +5,7 @@ supervisely/function_wrapper.py,sha256=R5YajTQ0GnRp2vtjwfC9hINkzQc0JiyGsu8TER373
|
|
|
5
5
|
supervisely/sly_logger.py,sha256=z92Vu5hmC0GgTIJO1n6kPDayRW9__8ix8hL6poDZj-Y,6274
|
|
6
6
|
supervisely/tiny_timer.py,sha256=hkpe_7FE6bsKL79blSs7WBaktuPavEVu67IpEPrfmjE,183
|
|
7
7
|
supervisely/annotation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
supervisely/annotation/annotation.py,sha256=
|
|
8
|
+
supervisely/annotation/annotation.py,sha256=th4gsIU-LNGcMRohHrtupmjxDwdzx1g4_0xIAa6NyJU,114717
|
|
9
9
|
supervisely/annotation/annotation_transforms.py,sha256=TlVy_gUbM-XH6GbLpZPrAi6pMIGTr7Ow02iSKOSTa-I,9582
|
|
10
10
|
supervisely/annotation/json_geometries_map.py,sha256=nL6AmMhFy02fw9ryBm75plKyOkDh61QdOToSuLAcz_Q,1659
|
|
11
11
|
supervisely/annotation/label.py,sha256=FzILYIvkk4cSUzdHLlmYJyWw8L3rfOEEhNkHi0Qsr_E,37510
|
|
@@ -586,7 +586,7 @@ supervisely/convert/image/cityscapes/cityscapes_helper.py,sha256=in5nR7__q_u5dCk
|
|
|
586
586
|
supervisely/convert/image/coco/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
587
587
|
supervisely/convert/image/coco/coco_anntotation_converter.py,sha256=O1PQbwrbnpQBks2pcz2nbAnhSqpKqNk13B2ARk_roFM,7078
|
|
588
588
|
supervisely/convert/image/coco/coco_converter.py,sha256=7dW7vE6yTRz7O31vTVSnEA4MDCc_UXTqc2UFEqaKorI,5650
|
|
589
|
-
supervisely/convert/image/coco/coco_helper.py,sha256=
|
|
589
|
+
supervisely/convert/image/coco/coco_helper.py,sha256=gkSLgLPUQh-xFN1A7Nh41nZE7rwHvdZSzcPG_C1dh8I,39473
|
|
590
590
|
supervisely/convert/image/csv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
591
591
|
supervisely/convert/image/csv/csv_converter.py,sha256=iLyc2PAVtlsAq7blnGH4iS1_D7Ai6-4UsdI_RlDVB9Q,11677
|
|
592
592
|
supervisely/convert/image/csv/csv_helper.py,sha256=-nR192IfMU0vTlNRoKXu5FS6tTs9fENqySyeKKyemRs,8409
|
|
@@ -623,7 +623,7 @@ supervisely/convert/image/yolo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
|
623
623
|
supervisely/convert/image/yolo/yolo_converter.py,sha256=Wn5dR05y4SEPONcaxWr9ofnbvbf-SbRZN0fkksk5Dps,11391
|
|
624
624
|
supervisely/convert/image/yolo/yolo_helper.py,sha256=5b0ShsVlqikA071VT8AiRW_079_WD6pdB5Bx3OU12Bw,25989
|
|
625
625
|
supervisely/convert/pointcloud/__init__.py,sha256=WPeIpPoTWDIKAa0lF6t2SMUhFNZ0l-vKujf6yD6w7SA,589
|
|
626
|
-
supervisely/convert/pointcloud/pointcloud_converter.py,sha256=
|
|
626
|
+
supervisely/convert/pointcloud/pointcloud_converter.py,sha256=X00tYXdIsSwaLHYX5xqqizQy30MjuhmVjhbrhtLnBjU,12078
|
|
627
627
|
supervisely/convert/pointcloud/bag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
628
628
|
supervisely/convert/pointcloud/bag/bag_converter.py,sha256=WWd6A2hS7H4MRgtLdJ-yYgmNU-Wk2eycl6LTTJM2GKQ,11391
|
|
629
629
|
supervisely/convert/pointcloud/bag/bag_helper.py,sha256=2TFe49isZTxMhya-PApqLPxrvGnvRFMBc_--BwyCpWU,4284
|
|
@@ -642,10 +642,10 @@ supervisely/convert/pointcloud/ply/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
|
|
|
642
642
|
supervisely/convert/pointcloud/ply/ply_converter.py,sha256=2ZCYkhJQzUev-sWGsBwCPtj1TGjdcx8o-Q--RAHavp8,2698
|
|
643
643
|
supervisely/convert/pointcloud/ply/ply_helper.py,sha256=YfLiV9m6a4NNEMs0J32dmMTLffMLX4-JPTThMHOEK4w,268
|
|
644
644
|
supervisely/convert/pointcloud/sly/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
645
|
-
supervisely/convert/pointcloud/sly/sly_pointcloud_converter.py,sha256=
|
|
645
|
+
supervisely/convert/pointcloud/sly/sly_pointcloud_converter.py,sha256=WBTFNGCygc_V-94YyyMQCnxn6Y1sualZo7kCmyBJt5E,5543
|
|
646
646
|
supervisely/convert/pointcloud/sly/sly_pointcloud_helper.py,sha256=kOluL97FfCFfIvnUE_FeN8iQLMlwdiMR5gayorOGDXw,3968
|
|
647
647
|
supervisely/convert/pointcloud_episodes/__init__.py,sha256=LePLQFEjXwhXap2zOY9SVTbW_NMbxKYZKBjBdRLimKE,557
|
|
648
|
-
supervisely/convert/pointcloud_episodes/pointcloud_episodes_converter.py,sha256=
|
|
648
|
+
supervisely/convert/pointcloud_episodes/pointcloud_episodes_converter.py,sha256=QJgO7lsdFU4m4rlpro25qnlmF4mQH_K_b2aSOWnYF_4,14489
|
|
649
649
|
supervisely/convert/pointcloud_episodes/bag/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
650
650
|
supervisely/convert/pointcloud_episodes/bag/bag_converter.py,sha256=jzWKXoFUWu11d5WlPfT1hphCubYpq_lhQZmhh07xZdQ,1659
|
|
651
651
|
supervisely/convert/pointcloud_episodes/kitti_360/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -657,7 +657,7 @@ supervisely/convert/pointcloud_episodes/nuscenes_conv/__init__.py,sha256=47DEQpj
|
|
|
657
657
|
supervisely/convert/pointcloud_episodes/nuscenes_conv/nuscenes_converter.py,sha256=O8QIwqwb0DUuYmS8oq6kGv3uTlzS3GyGvAxfL1bYW-s,12764
|
|
658
658
|
supervisely/convert/pointcloud_episodes/nuscenes_conv/nuscenes_helper.py,sha256=cJTwhFn1JgblbPjrTrZu30y6FxyjGF-12sMFfvN1xzM,8969
|
|
659
659
|
supervisely/convert/pointcloud_episodes/sly/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
660
|
-
supervisely/convert/pointcloud_episodes/sly/sly_pointcloud_episodes_converter.py,sha256=
|
|
660
|
+
supervisely/convert/pointcloud_episodes/sly/sly_pointcloud_episodes_converter.py,sha256=mHmmxeP63oaaXBTEMsmR4hISAiPVptn6qriNGTPPXzo,6322
|
|
661
661
|
supervisely/convert/pointcloud_episodes/sly/sly_pointcloud_episodes_helper.py,sha256=h4WvNH6cEHtjxxhCnU7Hs2vkyJMye0qwabqXNYVTywE,3570
|
|
662
662
|
supervisely/convert/video/__init__.py,sha256=8T99u_2rurKksx24aNQZf8b_TPFEiGViSDPzCqjDBfU,157
|
|
663
663
|
supervisely/convert/video/video_converter.py,sha256=f-b6FexBjXw9xWv5w8lxlNxCh4FvacNolX-WQDibWFs,11338
|
|
@@ -1103,9 +1103,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
1103
1103
|
supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
|
|
1104
1104
|
supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
|
|
1105
1105
|
supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
|
|
1106
|
-
supervisely-6.73.
|
|
1107
|
-
supervisely-6.73.
|
|
1108
|
-
supervisely-6.73.
|
|
1109
|
-
supervisely-6.73.
|
|
1110
|
-
supervisely-6.73.
|
|
1111
|
-
supervisely-6.73.
|
|
1106
|
+
supervisely-6.73.385.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
1107
|
+
supervisely-6.73.385.dist-info/METADATA,sha256=38qHHIiRGEYffwGVbazc2eXQ4_fNNjlxROUqPhBgH-4,35154
|
|
1108
|
+
supervisely-6.73.385.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
1109
|
+
supervisely-6.73.385.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
|
|
1110
|
+
supervisely-6.73.385.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
|
|
1111
|
+
supervisely-6.73.385.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|