supervisely 6.73.370__py3-none-any.whl → 6.73.371__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.
@@ -36,6 +36,7 @@ from supervisely.io.fs import (
36
36
  )
37
37
  from supervisely.pointcloud.pointcloud import is_valid_format
38
38
  from supervisely.sly_logger import logger
39
+ from supervisely.imaging import image as sly_image
39
40
 
40
41
 
41
42
  class PointcloudInfo(NamedTuple):
@@ -420,7 +421,7 @@ class PointcloudApi(RemoveableBulkModuleApi):
420
421
  convert_json_info_cb=lambda x: x,
421
422
  )
422
423
 
423
- def download_related_image(self, id: int, path: str) -> Response:
424
+ def download_related_image(self, id: int, path: str = None) -> Response:
424
425
  """
425
426
  Download a related context image from Supervisely to local directory by image id.
426
427
 
@@ -454,11 +455,16 @@ class PointcloudApi(RemoveableBulkModuleApi):
454
455
  {ApiField.ID: id},
455
456
  stream=True,
456
457
  )
457
- ensure_base_path(path)
458
- with open(path, "wb") as fd:
459
- for chunk in response.iter_content(chunk_size=1024 * 1024):
460
- fd.write(chunk)
461
- return response
458
+
459
+ if path:
460
+ ensure_base_path(path)
461
+ with open(path, "wb") as fd:
462
+ for chunk in response.iter_content(chunk_size=1024 * 1024):
463
+ fd.write(chunk)
464
+ return response
465
+ else:
466
+ related_image = sly_image.read_bytes(response.content, False)
467
+ return related_image
462
468
 
463
469
  # @TODO: copypaste from video_api
464
470
  def upload_hash(
@@ -233,14 +233,17 @@ class InferenceImageCache:
233
233
  with self._lock:
234
234
  self._cache.clear(False)
235
235
 
236
- def download_image(self, api: sly.Api, image_id: int):
236
+ def download_image(self, api: sly.Api, image_id: int, related: bool = False):
237
237
  name = self._image_name(image_id)
238
238
  self._wait_if_in_queue(name, api.logger)
239
239
 
240
240
  if name not in self._cache:
241
241
  self._load_queue.set(name, image_id)
242
242
  api.logger.debug(f"Add image #{image_id} to cache")
243
- img = api.image.download_np(image_id)
243
+ if not related:
244
+ img = api.image.download_np(image_id)
245
+ else:
246
+ img = api.pointcloud.download_related_image(image_id)
244
247
  self._add_to_cache(name, img)
245
248
  return img
246
249
 
@@ -52,6 +52,10 @@ def download_image_from_context(
52
52
  return api.video.frame.download_np(
53
53
  context["video"]["video_id"], context["video"]["frame_index"]
54
54
  )
55
+ elif "pcd_related_image_id" in context:
56
+ if cache_load_img is not None:
57
+ return cache_load_img(api, context["pcd_related_image_id"], related=True)
58
+ return api.pointcloud.download_related_image(context["pcd_related_image_id"])
55
59
  else:
56
60
  raise Exception("Project type is not supported")
57
61
 
@@ -110,6 +114,8 @@ def get_hash_from_context(context: dict):
110
114
  return "_".join(map(str, [volume_id, slice_index, plane, window_center, window_width]))
111
115
  elif "video" in context:
112
116
  return "_".join(map(str, [context["video"]["video_id"], context["video"]["frame_index"]]))
117
+ elif "pcd_related_image_id" in context:
118
+ return str(context["pcd_related_image_id"])
113
119
  else:
114
120
  raise Exception("Project type is not supported")
115
121
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.370
3
+ Version: 6.73.371
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -59,7 +59,7 @@ supervisely/api/nn/deploy_api.py,sha256=V7zWO8yoroFDifIqLIFYmZA72tLQriH5kYAhN0-5
59
59
  supervisely/api/nn/neural_network_api.py,sha256=vZyYBaKQzLJX9G3SAt09LmsxNLC8h88oYJ9b_PACzp0,10466
60
60
  supervisely/api/pointcloud/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
61
  supervisely/api/pointcloud/pointcloud_annotation_api.py,sha256=xIXqCu0rKYsGt5ezh2EFT2utwsVrr2Xo-MOWUCnbvXc,11259
62
- supervisely/api/pointcloud/pointcloud_api.py,sha256=PKfgh-ssK9W1wLXSEuFgC36DSMoZAzo1cY_bu-inV-8,53280
62
+ supervisely/api/pointcloud/pointcloud_api.py,sha256=Gii6INYqo5f3EUCkI14VMi2XuaxbRHEaqSb_HHmJJTA,53497
63
63
  supervisely/api/pointcloud/pointcloud_episode_annotation_api.py,sha256=zmDWDkRzUSfHKX65qDVrc44kNyYjfvItSwYmsERJ_8g,7012
64
64
  supervisely/api/pointcloud/pointcloud_episode_api.py,sha256=xg1zRKONV9ly0-B72V1dR6OMPFIw35bujazuEdrPGTQ,7922
65
65
  supervisely/api/pointcloud/pointcloud_episode_object_api.py,sha256=k2_wV0EVPo9vxSTVe1qOvqVOMSVE6zGDSkfR6TRNsKs,691
@@ -887,7 +887,7 @@ supervisely/nn/benchmark/visualization/widgets/sidebar/sidebar.py,sha256=tKPURRS
887
887
  supervisely/nn/benchmark/visualization/widgets/table/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
888
888
  supervisely/nn/benchmark/visualization/widgets/table/table.py,sha256=atmDnF1Af6qLQBUjLhK18RMDKAYlxnsuVHMSEa5a-e8,4319
889
889
  supervisely/nn/inference/__init__.py,sha256=QFukX2ip-U7263aEPCF_UCFwj6EujbMnsgrXp5Bbt8I,1623
890
- supervisely/nn/inference/cache.py,sha256=rc_CRlCuTCzLDtcl1paTJib7ALTer0ge9o32WtoUMkY,34795
890
+ supervisely/nn/inference/cache.py,sha256=yqVPIWzhIDRHwrCIpdm-gPxUM2rH8BD98omF659RElw,34938
891
891
  supervisely/nn/inference/inference.py,sha256=gq0yvMiFZ2FfJvvEmw7PRHa0GikCwRX9S2CE_0fuGX4,177798
892
892
  supervisely/nn/inference/inference_request.py,sha256=y6yw0vbaRRcEBS27nq3y0sL6Gmq2qLA_Bm0GrnJGegE,14267
893
893
  supervisely/nn/inference/session.py,sha256=dIg2F-OBl68pUzcmtmcI0YQIp1WWNnrJTVMjwFN91Q4,35824
@@ -906,7 +906,7 @@ supervisely/nn/inference/instance_segmentation/dashboard/main_ui.py,sha256=_M46q
906
906
  supervisely/nn/inference/instance_segmentation/dashboard/preview.py,sha256=uwUDlJzDLgKlGOn5CovCh03WAijlx04iyPs00qbsUpU,847
907
907
  supervisely/nn/inference/instance_segmentation/dashboard/preview_image.py,sha256=wXfPg7bAT2xXPlnl2zywkx4MJ66myl5KBGzrvoyS8zQ,279
908
908
  supervisely/nn/inference/interactive_segmentation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
909
- supervisely/nn/inference/interactive_segmentation/functional.py,sha256=m2eL7e-yCVPsg9D26YtmWCnJd7t3Y-974b0PnTvTSBQ,4554
909
+ supervisely/nn/inference/interactive_segmentation/functional.py,sha256=3GaeeOemji_ym0-C2mwj6SVEhnPkq7v3KCc4npw3iZ8,4905
910
910
  supervisely/nn/inference/interactive_segmentation/interactive_segmentation.py,sha256=vX1H9eaR8oRfMecQxJfpu6hGxbtf8bEESGJp_fPmfWc,20402
911
911
  supervisely/nn/inference/object_detection/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
912
912
  supervisely/nn/inference/object_detection/object_detection.py,sha256=Ki4updsAid1KOI2ahcdVVZ9lzdyRcYKyuQyzSz_9sXQ,1746
@@ -1097,9 +1097,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1097
1097
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1098
1098
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1099
1099
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1100
- supervisely-6.73.370.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1101
- supervisely-6.73.370.dist-info/METADATA,sha256=fcZ2RfmecBVHdsVjrjwfDZ4Uv2z21M0Y-jJYbnaiFRE,35154
1102
- supervisely-6.73.370.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1103
- supervisely-6.73.370.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1104
- supervisely-6.73.370.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1105
- supervisely-6.73.370.dist-info/RECORD,,
1100
+ supervisely-6.73.371.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1101
+ supervisely-6.73.371.dist-info/METADATA,sha256=kxGz3tIoXNmaQE4KCZ4zyX0iv1BAzItmJ2DjN4jZKkw,35154
1102
+ supervisely-6.73.371.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1103
+ supervisely-6.73.371.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1104
+ supervisely-6.73.371.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1105
+ supervisely-6.73.371.dist-info/RECORD,,