supervisely 6.73.297__py3-none-any.whl → 6.73.298__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.

Potentially problematic release.


This version of supervisely might be problematic. Click here for more details.

@@ -5,6 +5,7 @@ from __future__ import annotations
5
5
 
6
6
  from typing import Any, Dict, List, Optional, Tuple
7
7
 
8
+ from supervisely.sly_logger import logger
8
9
  from supervisely.api.module_api import ApiField
9
10
  from supervisely.collection.key_indexed_collection import KeyIndexedCollection
10
11
  from supervisely.video_annotation.frame import Frame
@@ -244,6 +245,7 @@ class FrameCollection(KeyIndexedCollection):
244
245
  objects: VideoObjectCollection,
245
246
  frames_count: Optional[int] = None,
246
247
  key_id_map: Optional[KeyIdMap] = None,
248
+ skip_corrupted: Optional[bool] = False,
247
249
  ) -> FrameCollection:
248
250
  """
249
251
  Convert a list of json dicts to FrameCollection. Read more about `Supervisely format <https://docs.supervise.ly/data-organization/00_ann_format_navi>`_.
@@ -279,10 +281,17 @@ class FrameCollection(KeyIndexedCollection):
279
281
  objects = []
280
282
  fr_collection = sly.FrameCollection.from_json(fr_collection_json, objects)
281
283
  """
282
- frames = [
283
- cls.item_type.from_json(frame_json, objects, frames_count, key_id_map)
284
- for frame_json in data
285
- ]
284
+ frames = []
285
+ for frame_json in data:
286
+ try:
287
+ frame = cls.item_type.from_json(frame_json, objects, frames_count, key_id_map)
288
+ frames.append(frame)
289
+ except Exception as e:
290
+ if skip_corrupted:
291
+ logger.warning(f"Skipping corrupted frame: {e}", exc_info=True)
292
+ continue
293
+ else:
294
+ raise e
286
295
  return cls(frames)
287
296
 
288
297
  def __str__(self):
@@ -587,7 +587,11 @@ class VideoAnnotation:
587
587
 
588
588
  @classmethod
589
589
  def from_json(
590
- cls, data: Dict, project_meta: ProjectMeta, key_id_map: KeyIdMap = None
590
+ cls,
591
+ data: Dict,
592
+ project_meta: ProjectMeta,
593
+ key_id_map: KeyIdMap = None,
594
+ skip_corrupted: Optional[bool] = False,
591
595
  ) -> VideoAnnotation:
592
596
  """
593
597
  Convert a json dict to VideoAnnotation. Read more about `Supervisely format <https://docs.supervise.ly/data-organization/00_ann_format_navi>`_.
@@ -598,6 +602,8 @@ class VideoAnnotation:
598
602
  :type project_meta: ProjectMeta
599
603
  :param key_id_map: KeyIdMap object.
600
604
  :type key_id_map: Union[KeyIdMap, None]
605
+ :param skip_corrupted: Skip corrupted items (currently only frames) during conversion.
606
+ :type skip_corrupted: bool, optional
601
607
  :return: VideoAnnotation object
602
608
  :rtype: :class:`VideoAnnotation`
603
609
 
@@ -638,7 +644,7 @@ class VideoAnnotation:
638
644
 
639
645
  tags = VideoTagCollection.from_json(data[TAGS], project_meta.tag_metas, key_id_map)
640
646
  objects = VideoObjectCollection.from_json(data[OBJECTS], project_meta, key_id_map)
641
- frames = FrameCollection.from_json(data[FRAMES], objects, frames_count, key_id_map)
647
+ frames = FrameCollection.from_json(data[FRAMES], objects, frames_count, key_id_map, skip_corrupted)
642
648
 
643
649
  return cls(
644
650
  img_size=img_size,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.297
3
+ Version: 6.73.298
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -1036,9 +1036,9 @@ supervisely/video/video.py,sha256=4dHlMYvXtiMQYqrCnF-u61C6bmfnXfOyCTdISMlsxWM,16
1036
1036
  supervisely/video_annotation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1037
1037
  supervisely/video_annotation/constants.py,sha256=_gW9iMhVk1w_dUaFiaiyXn66mt13S6bkxC64xpjP-CU,529
1038
1038
  supervisely/video_annotation/frame.py,sha256=H1G7Wl4LEEmQE-E0B2QWD8kyzZ4-w-GJSUdq7v_Qs2g,10568
1039
- supervisely/video_annotation/frame_collection.py,sha256=_iGFyZV0Vz7JnGNdtJaTKjI5H0Ci1fS-cNN2iunCEbY,14654
1039
+ supervisely/video_annotation/frame_collection.py,sha256=RZrnw7lURgvzRrskwvnEIQQfJkp9htMhircU3hLiHVY,15031
1040
1040
  supervisely/video_annotation/key_id_map.py,sha256=KayYOhTtAe3ITq1-NQ82T6YIiBjmu4aJm8t4UxdvI8U,37712
1041
- supervisely/video_annotation/video_annotation.py,sha256=w_3JnK1rYSY5iqPXSB_9hF7fBkZyomlmBQ2L3tAZZs4,28638
1041
+ supervisely/video_annotation/video_annotation.py,sha256=syqfhIerzhMWNh8scM_kWskBl8R2E-pfOSW_jN2Lb1Y,28867
1042
1042
  supervisely/video_annotation/video_figure.py,sha256=j1ZoDnMLO_bFRUI19GDK3A2CzTWGr5pGYbd3NjC7ztE,23766
1043
1043
  supervisely/video_annotation/video_object.py,sha256=i-oiliNpDr2X4Wcy9DJ7sBbuVUT3QYiSrtklCCJGVsY,16736
1044
1044
  supervisely/video_annotation/video_object_collection.py,sha256=Epu9MAC9uZiThfBn4NxKbQ7JRbW4eFZHglTzaJJ9WUQ,9047
@@ -1070,9 +1070,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1070
1070
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1071
1071
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1072
1072
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1073
- supervisely-6.73.297.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1074
- supervisely-6.73.297.dist-info/METADATA,sha256=p2QoWWUXTlEJZk8S66O8i8bRRuXdDZgX42Fw_fY_k7w,33573
1075
- supervisely-6.73.297.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1076
- supervisely-6.73.297.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1077
- supervisely-6.73.297.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1078
- supervisely-6.73.297.dist-info/RECORD,,
1073
+ supervisely-6.73.298.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1074
+ supervisely-6.73.298.dist-info/METADATA,sha256=KRpOS5RHRzEpuetnO0yl7tAhP8BG9Ndpqz3zUNRAZDw,33573
1075
+ supervisely-6.73.298.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1076
+ supervisely-6.73.298.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1077
+ supervisely-6.73.298.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1078
+ supervisely-6.73.298.dist-info/RECORD,,