supervisely 6.73.401__py3-none-any.whl → 6.73.403__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.
@@ -33,7 +33,7 @@ def get_meta_from_annotation(ann_json: dict, meta: ProjectMeta) -> ProjectMeta:
33
33
  ann_json = ann_json.get("annotation", {})
34
34
 
35
35
  if not all(key in ann_json for key in SLY_IMAGE_ANN_KEYS):
36
- logger.warn(
36
+ logger.warning(
37
37
  f"Some keys are missing in the annotation file. "
38
38
  "Check the annotation format documentation at: "
39
39
  "https://docs.supervisely.com/customization-and-integration/00_ann_format_navi/05_supervisely_format_images"
@@ -44,7 +44,7 @@ def get_meta_from_annotation(ann_json: dict, meta: ProjectMeta) -> ProjectMeta:
44
44
  for object in ann_objects:
45
45
  obj_tags = object.get(LabelJsonFields.TAGS, None)
46
46
  if obj_tags is None:
47
- logger.warn(
47
+ logger.warning(
48
48
  f"Key '{LabelJsonFields.TAGS}' for object tags is missing in the annotation file. Tags will not be added to the meta."
49
49
  )
50
50
  obj_tags = []
@@ -52,7 +52,7 @@ def get_meta_from_annotation(ann_json: dict, meta: ProjectMeta) -> ProjectMeta:
52
52
  meta = create_classes_from_annotation(object, meta)
53
53
  img_tags = ann_json.get(AnnotationJsonFields.IMG_TAGS, None)
54
54
  if img_tags is None:
55
- logger.warn(
55
+ logger.warning(
56
56
  f"Key '{AnnotationJsonFields.IMG_TAGS}' for image tags is missing in the annotation file. Tags will not be added to the meta."
57
57
  )
58
58
  img_tags = []
@@ -63,14 +63,14 @@ def get_meta_from_annotation(ann_json: dict, meta: ProjectMeta) -> ProjectMeta:
63
63
  def create_tags_from_annotation(tags: List[dict], meta: ProjectMeta) -> ProjectMeta:
64
64
  for tag in tags:
65
65
  if not all(key in tag for key in SLY_TAG_KEYS):
66
- logger.warn(
66
+ logger.warning(
67
67
  f"Tag in annotation file is not in Supervisely format. "
68
68
  "Read more about the Supervisely JSON format of tags in the documentation at: "
69
69
  "https://docs.supervisely.com/customization-and-integration/00_ann_format_navi/03_supervisely_format_tags"
70
70
  )
71
71
  continue
72
72
  tag_name = tag[TagJsonFields.TAG_NAME]
73
- tag_value = tag[TagJsonFields.VALUE]
73
+ tag_value = tag.get(TagJsonFields.VALUE)
74
74
  if tag_value is None:
75
75
  tag_meta = TagMeta(tag_name, TagValueType.NONE)
76
76
  elif isinstance(tag_value, int) or isinstance(tag_value, float):
@@ -87,7 +87,7 @@ def create_tags_from_annotation(tags: List[dict], meta: ProjectMeta) -> ProjectM
87
87
 
88
88
  def create_classes_from_annotation(object: dict, meta: ProjectMeta) -> ProjectMeta:
89
89
  if not all(key in object for key in SLY_OBJECT_KEYS):
90
- logger.warn(
90
+ logger.warning(
91
91
  f"Object in annotation file is not in Supervisely format: {object}. "
92
92
  "Read more about the Supervisely JSON format of objects in the documentation at: "
93
93
  "https://docs.supervisely.com/customization-and-integration/00_ann_format_navi/04_supervisely_format_objects"
@@ -100,7 +100,7 @@ def create_classes_from_annotation(object: dict, meta: ProjectMeta) -> ProjectMe
100
100
  try:
101
101
  geometry_type = GET_GEOMETRY_FROM_STR(geometry_type_str)
102
102
  except KeyError:
103
- logger.warn(f"Unknown geometry type {geometry_type_str} for class {class_name}")
103
+ logger.warning(f"Unknown geometry type {geometry_type_str} for class {class_name}")
104
104
  return meta
105
105
 
106
106
  obj_class = None
@@ -117,7 +117,7 @@ def create_classes_from_annotation(object: dict, meta: ProjectMeta) -> ProjectMe
117
117
  existing_class = meta.get_obj_class(class_name)
118
118
 
119
119
  if obj_class is None:
120
- logger.warn(
120
+ logger.warning(
121
121
  f"Failed to create object class for {class_name} with geometry type {geometry_type_str}"
122
122
  )
123
123
  return meta
@@ -14,17 +14,34 @@ from supervisely import (
14
14
  TagValueType,
15
15
  logger,
16
16
  )
17
- from supervisely.geometry.graph import KeypointsTemplate
18
- from supervisely.io.json import load_json_file
19
17
  from supervisely.annotation.label import LabelJsonFields
20
18
  from supervisely.annotation.tag import TagJsonFields
21
- from supervisely.video_annotation.constants import FIGURES, INDEX, KEY, IMG_SIZE, OBJECT_KEY, OBJECTS, FRAMES_COUNT, TAGS, FRAMES
19
+ from supervisely.geometry.graph import KeypointsTemplate
20
+ from supervisely.io.json import load_json_file
21
+ from supervisely.video_annotation.constants import (
22
+ FIGURES,
23
+ FRAMES,
24
+ FRAMES_COUNT,
25
+ IMG_SIZE,
26
+ INDEX,
27
+ KEY,
28
+ OBJECT_KEY,
29
+ OBJECTS,
30
+ TAGS,
31
+ )
22
32
 
23
33
  SLY_ANN_KEYS = [IMG_SIZE, FRAMES_COUNT, FRAMES, OBJECTS, TAGS]
24
34
  SLY_VIDEO_OBJECT_KEYS = [LabelJsonFields.OBJ_CLASS_NAME, LabelJsonFields.TAGS, KEY]
25
- SLY_TAG_KEYS = [TagJsonFields.TAG_NAME, TagJsonFields.VALUE]
35
+ SLY_TAG_KEYS = [
36
+ TagJsonFields.TAG_NAME,
37
+ # TagJsonFields.VALUE
38
+ ]
26
39
  SLY_FRAME_KEYS = [FIGURES, INDEX]
27
- SLY_FIGURE_KEYS = [KEY, OBJECT_KEY, "geometryType"] #, LabelJsonFields.GEOMETRY_TYPE] TODO: add geometry type
40
+ SLY_FIGURE_KEYS = [
41
+ KEY,
42
+ OBJECT_KEY,
43
+ "geometryType",
44
+ ] # , LabelJsonFields.GEOMETRY_TYPE] TODO: add geometry type
28
45
 
29
46
 
30
47
  def get_meta_from_annotation(ann_path: str, meta: ProjectMeta) -> ProjectMeta:
@@ -32,7 +49,7 @@ def get_meta_from_annotation(ann_path: str, meta: ProjectMeta) -> ProjectMeta:
32
49
  if "annotation" in ann_json:
33
50
  ann_json = ann_json["annotation"]
34
51
  if not all(key in ann_json for key in SLY_ANN_KEYS):
35
- logger.warn(
52
+ logger.warning(
36
53
  f"VideoAnnotation file {ann_path} is not in Supervisely format. "
37
54
  "Check the annotation format documentation at: "
38
55
  "https://docs.supervisely.com/customization-and-integration/00_ann_format_navi/06_supervisely_format_videos"
@@ -42,7 +59,7 @@ def get_meta_from_annotation(ann_path: str, meta: ProjectMeta) -> ProjectMeta:
42
59
  object_key_to_name = {}
43
60
  for object in ann_json[OBJECTS]:
44
61
  if not all(key in object for key in SLY_VIDEO_OBJECT_KEYS):
45
- logger.warn(
62
+ logger.warning(
46
63
  f"Object in annotation file is not in Supervisely format: {object}. "
47
64
  "Read more about the Supervisely JSON format of objects in the documentation at: "
48
65
  "https://docs.supervisely.com/customization-and-integration/00_ann_format_navi/06_supervisely_format_videos"
@@ -52,7 +69,7 @@ def get_meta_from_annotation(ann_path: str, meta: ProjectMeta) -> ProjectMeta:
52
69
  object_key_to_name[object[KEY]] = object[LabelJsonFields.OBJ_CLASS_NAME]
53
70
  for frame in ann_json[FRAMES]:
54
71
  if not all(key in frame for key in SLY_FRAME_KEYS):
55
- logger.warn(
72
+ logger.warning(
56
73
  f"Frame in annotation file is not in Supervisely format: {frame}."
57
74
  "Read more about the Supervisely JSON format of frames in the documentation at: "
58
75
  "https://docs.supervisely.com/customization-and-integration/00_ann_format_navi/06_supervisely_format_videos"
@@ -86,7 +103,7 @@ def create_classes_from_annotation(
86
103
  ) -> ProjectMeta:
87
104
  for fig in frame[FIGURES]:
88
105
  if not all(key in fig for key in SLY_FIGURE_KEYS):
89
- logger.warn(
106
+ logger.warning(
90
107
  f"Figure in annotation file is not in Supervisely format: {fig}. "
91
108
  "Read more about the Supervisely JSON format of figures in the documentation at: "
92
109
  "https://docs.supervisely.com/customization-and-integration/00_ann_format_navi/06_supervisely_format_videos"
@@ -119,11 +136,13 @@ def create_classes_from_annotation(
119
136
  if "loc" not in node or len(node["loc"]) != 2:
120
137
  continue
121
138
  template.add_point(label=uuid, row=node["loc"][0], col=node["loc"][1])
122
- obj_class = ObjClass(name=class_name, geometry_type=GraphNodes, geometry_config=template)
139
+ obj_class = ObjClass(
140
+ name=class_name, geometry_type=GraphNodes, geometry_config=template
141
+ )
123
142
 
124
143
  existing_class = meta.get_obj_class(class_name)
125
144
  if obj_class is None:
126
- logger.warn(f"Object class {class_name} is not in Supervisely format.")
145
+ logger.warning(f"Object class {class_name} is not in Supervisely format.")
127
146
  continue
128
147
  if existing_class is None:
129
148
  meta = meta.add_obj_class(obj_class)
@@ -134,6 +153,7 @@ def create_classes_from_annotation(
134
153
  meta = meta.add_obj_class(obj_class)
135
154
  return meta
136
155
 
156
+
137
157
  def rename_in_json(ann_json, renamed_classes=None, renamed_tags=None):
138
158
  if renamed_classes:
139
159
  for obj in ann_json[OBJECTS]:
@@ -89,6 +89,7 @@ class Cuboid2d(GraphNodes):
89
89
  position: Optional[Dict] = None,
90
90
  rotation: Optional[Dict] = None,
91
91
  dimensions: Optional[Dict] = None,
92
+ face: Optional[List[str]] = None,
92
93
  ):
93
94
  super().__init__(
94
95
  nodes=nodes,
@@ -101,6 +102,7 @@ class Cuboid2d(GraphNodes):
101
102
  self._position = position
102
103
  self._rotation = rotation
103
104
  self._dimensions = dimensions
105
+ self._face = face
104
106
 
105
107
  if len(self._nodes) != 8:
106
108
  raise ValueError("Cuboid2d must have exactly 8 vertices")
@@ -148,6 +150,17 @@ class Cuboid2d(GraphNodes):
148
150
  if isinstance(self._dimensions, dict):
149
151
  return self._dimensions.copy()
150
152
 
153
+ @property
154
+ def face(self) -> Optional[List[str]]:
155
+ """
156
+ Copy of the face of the Cuboid2d.
157
+
158
+ :return: Face of the Cuboid2d
159
+ :rtype: Optional[List[str]]
160
+ """
161
+ if isinstance(self._face, list):
162
+ return self._face.copy()
163
+
151
164
  @classmethod
152
165
  def from_json(cls, data: Dict[str, Dict]) -> Cuboid2d:
153
166
  """
@@ -182,7 +195,13 @@ class Cuboid2d(GraphNodes):
182
195
  "x": 0.1425456564648202,
183
196
  "y": 0.1,
184
197
  "z": 0.36738880874660756
185
- }
198
+ },
199
+ "face": [
200
+ "face2-topleft",
201
+ "face2-topright",
202
+ "face2-bottomright",
203
+ "face2-bottomleft"
204
+ ]
186
205
  }
187
206
  }
188
207
  from supervisely.geometry.graph import Cuboid2d
@@ -200,6 +219,7 @@ class Cuboid2d(GraphNodes):
200
219
  position = data.get("position", None)
201
220
  rotation = data.get("rotation", None)
202
221
  dimensions = data.get("dimensions", None)
222
+ face = data.get("face", None)
203
223
  return cls(
204
224
  nodes=nodes,
205
225
  sly_id=sly_id,
@@ -210,6 +230,7 @@ class Cuboid2d(GraphNodes):
210
230
  position=position,
211
231
  rotation=rotation,
212
232
  dimensions=dimensions,
233
+ face=face,
213
234
  )
214
235
 
215
236
  def to_json(self) -> Dict[str, Dict]:
@@ -255,8 +276,13 @@ class Cuboid2d(GraphNodes):
255
276
  # "x": 0.1425456564648202,
256
277
  # "y": 0.1,
257
278
  # "z": 0.36738880874660756
258
- # }
259
-
279
+ # },
280
+ # "face": [
281
+ # "face2-topleft",
282
+ # "face2-topright",
283
+ # "face2-bottomright",
284
+ # "face2-bottomleft"
285
+ # ],
260
286
  # }
261
287
  """
262
288
  res = {
@@ -270,6 +296,8 @@ class Cuboid2d(GraphNodes):
270
296
  res["rotation"] = self._rotation
271
297
  if self._dimensions is not None:
272
298
  res["dimensions"] = self._dimensions
299
+ if self._face is not None:
300
+ res["face"] = self._face
273
301
 
274
302
  self._add_creation_info(res)
275
303
  return res
@@ -547,6 +547,7 @@ class InferenceImageCache:
547
547
  f"Video #{video_id} downloaded to cache in {download_time:.2f} sec",
548
548
  extra={"video_id": video_id, "download_time": download_time},
549
549
  )
550
+ silent_remove(temp_video_path)
550
551
  except Exception as e:
551
552
  self._load_queue.delete(video_id)
552
553
  raise e
@@ -624,14 +625,9 @@ class InferenceImageCache:
624
625
  self.add_frame_to_cache(frame, video_id, frame_index)
625
626
  elif task_type is InferenceImageCache._LoadType.Video:
626
627
  video_id = image_ids
627
- temp_video_path = Path("/tmp/smart_cache").joinpath(
628
- f"_{sly.rand_str(6)}_" + files[0].file.name
629
- )
630
- with open(temp_video_path, "wb") as f:
631
- shutil.copyfileobj(files[0].file, f)
632
628
  self._wait_if_in_queue(video_id, sly.logger)
633
629
  self._load_queue.set(video_id, video_id)
634
- self.add_video_to_cache(video_id, str(temp_video_path))
630
+ self.add_video_to_cache(video_id, files[0].file)
635
631
 
636
632
  def run_cache_task_manually(
637
633
  self,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.401
3
+ Version: 6.73.403
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -618,7 +618,7 @@ supervisely/convert/image/pdf/pdf_helper.py,sha256=IDwLEvsVy8lu-KC1lXvSRkZZ9BCC6
618
618
  supervisely/convert/image/sly/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
619
619
  supervisely/convert/image/sly/fast_sly_image_converter.py,sha256=r_Nhowicm-oah-XfGEeAOrGNbIzMh63m6ZRYaLKHUu0,5903
620
620
  supervisely/convert/image/sly/sly_image_converter.py,sha256=dT7fVivM-u2hhKehGJWPeLsVTi4nW-WX1X6Lktl2mks,14812
621
- supervisely/convert/image/sly/sly_image_helper.py,sha256=8zSWtLlF5fZUaR8UMUqqEvLqyz8HrsDxfb5AcwYW3Qs,7385
621
+ supervisely/convert/image/sly/sly_image_helper.py,sha256=CrlDh6E4aLLtva-TbC0pUCA2oi5184dQDecnlm6ty_c,7410
622
622
  supervisely/convert/image/yolo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
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
@@ -667,7 +667,7 @@ supervisely/convert/video/mot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5N
667
667
  supervisely/convert/video/mot/mot_converter.py,sha256=wXbv-9Psc2uVnhzHuOt5VnRIvSg70NDPQSoKdWwL4Lo,490
668
668
  supervisely/convert/video/sly/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
669
669
  supervisely/convert/video/sly/sly_video_converter.py,sha256=S2qif7JFxqIi9VN_ez_iBtoJXpG9W6Ky2k5Er3-DtUo,4418
670
- supervisely/convert/video/sly/sly_video_helper.py,sha256=D8PgoXpi0y3z-VEqvBLDf_gSUQ2hTL3irrfJyGhaV0Y,6758
670
+ supervisely/convert/video/sly/sly_video_helper.py,sha256=sT1Q7RQHkIjNezYASVyLYixLPQdpP0m4Lxzqxa_QXBI,6873
671
671
  supervisely/convert/volume/__init__.py,sha256=NaACs000WT2iy_g63TiZZ6IlgCjyDXx6i2OHsGpCYOs,391
672
672
  supervisely/convert/volume/volume_converter.py,sha256=3jpt2Yn_G4FSP_vHFsJHQfYNQpT7q6ar_sRyr_xrPnA,5335
673
673
  supervisely/convert/volume/dicom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -695,7 +695,7 @@ supervisely/geometry/closed_surface_mesh.py,sha256=3ZplCm3Q2bhPcxNmtv2U1UfdezRkC
695
695
  supervisely/geometry/constants.py,sha256=6lXpwTTFuswuH9WXMy4akHKshQ5C6fgQhdY-XCdVIMA,842
696
696
  supervisely/geometry/conversions.py,sha256=ZY6xWYFWaDA5KDJkcIBBP8LAmMfZwxMeVFfYUYEM6fw,1170
697
697
  supervisely/geometry/cuboid.py,sha256=GVHeUrVgfjUjE3PorV_vtge6_thDvvUYI5-9_HZjfWs,21077
698
- supervisely/geometry/cuboid_2d.py,sha256=enQ-7ZVix5SqC7ZEwxgC0Kvmz9J_wXL7NH3m02snNvc,13444
698
+ supervisely/geometry/cuboid_2d.py,sha256=I0-V0SPlM-NTStfzDyc7YjW9XSOguCs4yhDZS7-qtZ4,14358
699
699
  supervisely/geometry/cuboid_3d.py,sha256=x472ZPHTZDIY5Dj8tKbLQG3BCukFPgSvPJlxfHdKi1w,4168
700
700
  supervisely/geometry/geometry.py,sha256=dbXnct8hrr7Wour6yCrtAef22KSJ2uYRm1F5GE10_MM,15287
701
701
  supervisely/geometry/graph.py,sha256=kSShcGU4kZgwAbvTrqGzC55qha0nI7M5luiMZSbNx_4,24486
@@ -892,7 +892,7 @@ supervisely/nn/benchmark/visualization/widgets/sidebar/sidebar.py,sha256=tKPURRS
892
892
  supervisely/nn/benchmark/visualization/widgets/table/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
893
893
  supervisely/nn/benchmark/visualization/widgets/table/table.py,sha256=atmDnF1Af6qLQBUjLhK18RMDKAYlxnsuVHMSEa5a-e8,4319
894
894
  supervisely/nn/inference/__init__.py,sha256=QFukX2ip-U7263aEPCF_UCFwj6EujbMnsgrXp5Bbt8I,1623
895
- supervisely/nn/inference/cache.py,sha256=eEjQ5NONink-MiBpek2WQ2n-GbueZDq7Jk69pRzNc_o,35226
895
+ supervisely/nn/inference/cache.py,sha256=rfmb1teJ9lNDfisUSh6bwDCVkPZocn8GMvDgLQktnbo,35023
896
896
  supervisely/nn/inference/inference.py,sha256=L14M8qGofz6EGrgJvGMcz0h3vsu-AnHPeL_iUO8Kf3Y,195721
897
897
  supervisely/nn/inference/inference_request.py,sha256=y6yw0vbaRRcEBS27nq3y0sL6Gmq2qLA_Bm0GrnJGegE,14267
898
898
  supervisely/nn/inference/session.py,sha256=dIg2F-OBl68pUzcmtmcI0YQIp1WWNnrJTVMjwFN91Q4,35824
@@ -1114,9 +1114,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1114
1114
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1115
1115
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1116
1116
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1117
- supervisely-6.73.401.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1118
- supervisely-6.73.401.dist-info/METADATA,sha256=YG4zQT06n55B3OhubdAKrzIjdV1coFrKy9jR1QXh3Y0,35254
1119
- supervisely-6.73.401.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1120
- supervisely-6.73.401.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1121
- supervisely-6.73.401.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1122
- supervisely-6.73.401.dist-info/RECORD,,
1117
+ supervisely-6.73.403.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1118
+ supervisely-6.73.403.dist-info/METADATA,sha256=Ek7DVdSGCs3CqJle5jkio4qOs6tr3C_FiN6rqsHuC7c,35254
1119
+ supervisely-6.73.403.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1120
+ supervisely-6.73.403.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1121
+ supervisely-6.73.403.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1122
+ supervisely-6.73.403.dist-info/RECORD,,