supervisely 6.73.443__py3-none-any.whl → 6.73.445__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.
@@ -24,10 +24,10 @@ from requests_toolbelt import MultipartDecoder, MultipartEncoder
24
24
  from tqdm import tqdm
25
25
 
26
26
  from supervisely._utils import batched, logger, run_coroutine
27
+ from supervisely.annotation.label import LabelingStatus
27
28
  from supervisely.api.module_api import ApiField, ModuleApi, RemoveableBulkModuleApi
28
29
  from supervisely.geometry.rectangle import Rectangle
29
30
  from supervisely.video_annotation.key_id_map import KeyIdMap
30
- from supervisely.annotation.label import LabelingStatus
31
31
 
32
32
 
33
33
  class FigureInfo(NamedTuple):
@@ -595,10 +595,13 @@ class FigureApi(RemoveableBulkModuleApi):
595
595
  """
596
596
  geometries = {}
597
597
  for idx, part in self._download_geometries_generator(ids):
598
- if progress_cb is not None:
599
- progress_cb(len(part.content))
600
- geometry_json = json.loads(part.content)
601
- geometries[idx] = geometry_json
598
+ try:
599
+ if progress_cb is not None:
600
+ progress_cb(len(part.content))
601
+ geometry_json = json.loads(part.content)
602
+ geometries[idx] = geometry_json
603
+ except Exception as e:
604
+ raise RuntimeError(f"Failed to decode geometry for figure ID {idx}") from e
602
605
 
603
606
  if len(geometries) != len(ids):
604
607
  raise RuntimeError("Not all geometries were downloaded")
@@ -1253,7 +1253,6 @@ class Inference:
1253
1253
  if self._model_meta is None:
1254
1254
  self._set_model_meta_from_classes()
1255
1255
 
1256
-
1257
1256
  def _set_model_meta_custom_model(self, model_info: dict):
1258
1257
  model_meta = model_info.get("model_meta")
1259
1258
  if model_meta is None:
@@ -2146,7 +2145,7 @@ class Inference:
2146
2145
  video_id = get_value_for_keys(state, ["videoId", "video_id"], ignore_none=True)
2147
2146
  if video_id is None:
2148
2147
  raise ValueError("Video id is not provided")
2149
- video_info = api.video.get_info_by_id(video_id)
2148
+ video_info = api.video.get_info_by_id(video_id, force_metadata_for_links=True)
2150
2149
  start_frame_index = get_value_for_keys(
2151
2150
  state, ["startFrameIndex", "start_frame_index", "start_frame"], ignore_none=True
2152
2151
  )
@@ -2747,10 +2746,10 @@ class Inference:
2747
2746
  context.setdefault("created_dataset", {})[src_dataset_id] = created_dataset.id
2748
2747
  return created_dataset.id
2749
2748
 
2750
- created_names = []
2751
2749
  if context is None:
2752
2750
  context = {}
2753
2751
  for dataset_id, preds in ds_predictions.items():
2752
+ created_names = set()
2754
2753
  if dst_project_id is not None:
2755
2754
  # upload to the destination project
2756
2755
  dst_dataset_id = _get_or_create_dataset(
@@ -2826,7 +2825,7 @@ class Inference:
2826
2825
  with_annotations=False,
2827
2826
  save_source_date=False,
2828
2827
  )
2829
- created_names.extend([image_info.name for image_info in dst_image_infos])
2828
+ created_names.update([image_info.name for image_info in dst_image_infos])
2830
2829
  api.annotation.upload_anns([image_info.id for image_info in dst_image_infos], anns)
2831
2830
  else:
2832
2831
  # upload to the source dataset
@@ -4440,7 +4439,6 @@ def _get_log_extra_for_inference_request(
4440
4439
  "has_result": inference_request.final_result is not None,
4441
4440
  "pending_results": inference_request.pending_num(),
4442
4441
  "exception": inference_request.exception_json(),
4443
- "result": inference_request._final_result,
4444
4442
  "preparing_progress": progress,
4445
4443
  }
4446
4444
  return log_extra
@@ -47,6 +47,8 @@ class InferenceRequest:
47
47
  self._final_result = None
48
48
  self._exception = None
49
49
  self._stopped = threading.Event()
50
+ self._progress_log_interval = 5.0
51
+ self._last_progress_report_time = 0
50
52
  self.progress = Progress(
51
53
  message=self._stage,
52
54
  total_cnt=1,
@@ -135,9 +137,19 @@ class InferenceRequest:
135
137
  )
136
138
  self._updated()
137
139
 
140
+ def set_progress_log_interval(self, interval: float):
141
+ self._progress_log_interval = interval
142
+
138
143
  def done(self, n=1):
139
144
  with self._lock:
140
- self.progress.iters_done_report(n)
145
+ if (
146
+ self._progress_log_interval is None
147
+ or time.monotonic() - self._last_progress_report_time > self._progress_log_interval
148
+ ) or (self.progress.current + n >= self.progress.total):
149
+ self.progress.iters_done_report(n)
150
+ self._last_progress_report_time = time.monotonic()
151
+ else:
152
+ self.progress.iters_done(n)
141
153
  if self._stage == InferenceRequest.Stage.INFERENCE:
142
154
  self.global_progress_current += n
143
155
  if self.manager is not None:
@@ -523,18 +523,16 @@ class PredictionSession:
523
523
  "Inference is already running. Please stop it before starting a new one."
524
524
  )
525
525
  resp = self._post(method, **kwargs).json()
526
-
527
526
  self.inference_request_uuid = resp["inference_request_uuid"]
528
-
529
- logger.info(
530
- "Inference has started:",
531
- extra={"inference_request_uuid": resp.get("inference_request_uuid")},
532
- )
533
527
  try:
534
528
  resp, has_started = self._wait_for_inference_start(tqdm=self.tqdm)
535
529
  except:
536
530
  self.stop()
537
531
  raise
532
+ logger.info(
533
+ "Inference has started:",
534
+ extra={"inference_request_uuid": resp.get("inference_request_uuid")},
535
+ )
538
536
  frame_iterator = self.Iterator(resp["progress"]["total"], self, tqdm=self.tqdm)
539
537
  return frame_iterator
540
538
 
@@ -647,8 +645,11 @@ class PredictionSession:
647
645
  encoder = MultipartEncoder(fields)
648
646
  if self.tqdm is not None:
649
647
 
648
+ bytes_read = 0
650
649
  def _callback(monitor):
651
- self.tqdm.update(monitor.bytes_read)
650
+ nonlocal bytes_read
651
+ self.tqdm.update(monitor.bytes_read - bytes_read)
652
+ bytes_read = monitor.bytes_read
652
653
 
653
654
  video_size = get_file_size(video_path)
654
655
  self._update_progress(self.tqdm, "Uploading video", 0, video_size, is_size=True)
@@ -3177,22 +3177,33 @@ class TrainApp:
3177
3177
  experiment_name = self.gui.training_process.get_experiment_name()
3178
3178
 
3179
3179
  train_collection_idx = 1
3180
- val_collection_idx = 1
3180
+ val_collection_idx = 1
3181
+
3182
+ def _extract_index_from_col_name(name: str, expected_prefix: str) -> Optional[int]:
3183
+ parts = name.split("_")
3184
+ if len(parts) == 2 and parts[0] == expected_prefix and parts[1].isdigit():
3185
+ return int(parts[1])
3186
+ return None
3181
3187
 
3182
3188
  # Get train collection with max idx
3183
3189
  if len(all_train_collections) > 0:
3184
- train_collection_idx = max([int(collection.name.split("_")[1]) for collection in all_train_collections])
3185
- train_collection_idx += 1
3190
+ train_indices = [_extract_index_from_col_name(collection.name, "train") for collection in all_train_collections]
3191
+ train_indices = [idx for idx in train_indices if idx is not None]
3192
+ if len(train_indices) > 0:
3193
+ train_collection_idx = max(train_indices) + 1
3194
+
3186
3195
  # Get val collection with max idx
3187
3196
  if len(all_val_collections) > 0:
3188
- val_collection_idx = max([int(collection.name.split("_")[1]) for collection in all_val_collections])
3189
- val_collection_idx += 1
3197
+ val_indices = [_extract_index_from_col_name(collection.name, "val") for collection in all_val_collections]
3198
+ val_indices = [idx for idx in val_indices if idx is not None]
3199
+ if len(val_indices) > 0:
3200
+ val_collection_idx = max(val_indices) + 1
3190
3201
  # -------------------------------- #
3191
3202
 
3192
3203
  # Create Train Collection
3193
3204
  train_img_ids = list(self._train_split_item_ids)
3194
3205
  train_collection_description = f"Collection with train {item_type} for experiment: {experiment_name}"
3195
- train_collection = self._api.entities_collection.create(self.project_id, f"train_{train_collection_idx}", train_collection_description)
3206
+ train_collection = self._api.entities_collection.create(self.project_id, f"train_{train_collection_idx:03d}", train_collection_description)
3196
3207
  train_collection_id = getattr(train_collection, "id", None)
3197
3208
  if train_collection_id is None:
3198
3209
  raise AttributeError("Train EntitiesCollectionInfo object does not have 'id' attribute")
@@ -3202,7 +3213,7 @@ class TrainApp:
3202
3213
  # Create Val Collection
3203
3214
  val_img_ids = list(self._val_split_item_ids)
3204
3215
  val_collection_description = f"Collection with val {item_type} for experiment: {experiment_name}"
3205
- val_collection = self._api.entities_collection.create(self.project_id, f"val_{val_collection_idx}", val_collection_description)
3216
+ val_collection = self._api.entities_collection.create(self.project_id, f"val_{val_collection_idx:03d}", val_collection_description)
3206
3217
  val_collection_id = getattr(val_collection, "id", None)
3207
3218
  if val_collection_id is None:
3208
3219
  raise AttributeError("Val EntitiesCollectionInfo object does not have 'id' attribute")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.443
3
+ Version: 6.73.445
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -52,7 +52,7 @@ supervisely/api/video_annotation_tool_api.py,sha256=3A9-U8WJzrTShP_n9T8U01M9FzGY
52
52
  supervisely/api/workspace_api.py,sha256=24O9uR5eIA2JdD0eQLi9LGaaHISdb2gUqnxJtx7bTew,9222
53
53
  supervisely/api/entity_annotation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  supervisely/api/entity_annotation/entity_annotation_api.py,sha256=R7irdsYmUecsibuUFbcPRiS6tV3GnCHi9NfWeuoN7_0,3085
55
- supervisely/api/entity_annotation/figure_api.py,sha256=DN0mL40ZIoDoVQtCoUfcff9AEKcAoKRYDi6zdHDR7rg,38652
55
+ supervisely/api/entity_annotation/figure_api.py,sha256=c0XH5Gq0I0wze8UxAohiQROy6XksFwLry1gLyEItcfE,38812
56
56
  supervisely/api/entity_annotation/object_api.py,sha256=gbcNvN_KY6G80Me8fHKQgryc2Co7VU_kfFd1GYILZ4E,8875
57
57
  supervisely/api/entity_annotation/tag_api.py,sha256=IapvSZmakjdOn0yvqP2tQRY8gkZg0bcvIZBwWRcafrg,18996
58
58
  supervisely/api/nn/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -904,8 +904,8 @@ supervisely/nn/benchmark/visualization/widgets/table/__init__.py,sha256=47DEQpj8
904
904
  supervisely/nn/benchmark/visualization/widgets/table/table.py,sha256=atmDnF1Af6qLQBUjLhK18RMDKAYlxnsuVHMSEa5a-e8,4319
905
905
  supervisely/nn/inference/__init__.py,sha256=QFukX2ip-U7263aEPCF_UCFwj6EujbMnsgrXp5Bbt8I,1623
906
906
  supervisely/nn/inference/cache.py,sha256=rfmb1teJ9lNDfisUSh6bwDCVkPZocn8GMvDgLQktnbo,35023
907
- supervisely/nn/inference/inference.py,sha256=aFFFuNhRV8m4Ch4eB-zvw1gnhz7X9WJZz-bQ3g6wUyM,207124
908
- supervisely/nn/inference/inference_request.py,sha256=y6yw0vbaRRcEBS27nq3y0sL6Gmq2qLA_Bm0GrnJGegE,14267
907
+ supervisely/nn/inference/inference.py,sha256=Zc6DomIJxM301QsYAqrtCT0FyXvCOmxlLEJ-TIxnKHg,207110
908
+ supervisely/nn/inference/inference_request.py,sha256=1Tq-OV7bYtr0bKDqvBXh72wpR5Misgk-iQn5waCxtqo,14830
909
909
  supervisely/nn/inference/session.py,sha256=XUqJ_CqHk3ZJYkWxdnErN_6afCpIBU76nq6Ek7DiOQI,35792
910
910
  supervisely/nn/inference/uploader.py,sha256=Dn5MfMRq7tclEWpP0B9fJjTiQPBpwumfXxC8-lOYgnM,5659
911
911
  supervisely/nn/inference/video_inference.py,sha256=8Bshjr6rDyLay5Za8IB8Dr6FURMO2R_v7aELasO8pR4,5746
@@ -993,7 +993,7 @@ supervisely/nn/legacy/training/eval_planner.py,sha256=zN9b0_CX7sWGdC8e6riTvD-NOU
993
993
  supervisely/nn/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
994
994
  supervisely/nn/model/model_api.py,sha256=tSstGGdzm3cHc81P7IoM447sMVesUYJpspzMqUY70pg,10322
995
995
  supervisely/nn/model/prediction.py,sha256=gt4c80LkcBFd5-a2iHpShPDTRO81MKHSWiBp47Gb1z0,11983
996
- supervisely/nn/model/prediction_session.py,sha256=9fPECqnRJLqi2HCJINhDabB7IbgKWAMbDHIxt4RDJeE,27691
996
+ supervisely/nn/model/prediction_session.py,sha256=0Vs614dqG21U27OhplvzxGvHds-5CWFvj5icaOnwz3g,27837
997
997
  supervisely/nn/tracker/__init__.py,sha256=1Pv1zLedcZaTk1BS3ezscQbVizq7vQABlNbLhEhHkOI,326
998
998
  supervisely/nn/tracker/base_tracker.py,sha256=2d23JlHizOqVye324YT20EE8RP52uwoQUkPYvPXJTdw,1668
999
999
  supervisely/nn/tracker/botsort_tracker.py,sha256=F2OaoeK1EAlBKAY95Fd9ZooZIlOZBh4YThhzmKNyP6w,10224
@@ -1012,7 +1012,7 @@ supervisely/nn/tracker/botsort/tracker/kalman_filter.py,sha256=waTArMcbmpHAzb57a
1012
1012
  supervisely/nn/tracker/botsort/tracker/matching.py,sha256=bgnheHwWD3XZSI3OJVfdrU5bYJ44rxPHzzSElfg6LZM,6600
1013
1013
  supervisely/nn/tracker/botsort/tracker/mc_bot_sort.py,sha256=dFjWmubyJLrUP4i-CJaOhPEkQD-WD144deW7Ua5a7Rc,17775
1014
1014
  supervisely/nn/training/__init__.py,sha256=gY4PCykJ-42MWKsqb9kl-skemKa8yB6t_fb5kzqR66U,111
1015
- supervisely/nn/training/train_app.py,sha256=yHr8s8xQsk1zs3wxOxSlJ_qMecO4g112SXvFUL6n99M,132593
1015
+ supervisely/nn/training/train_app.py,sha256=l4t4zzE-nPwV-tXzbw4ENQcGMQ1PCeqmyxfkLg_eFDI,133159
1016
1016
  supervisely/nn/training/gui/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
1017
1017
  supervisely/nn/training/gui/classes_selector.py,sha256=tqmVwUfC2u5K53mZmvDvNOhu9Mw5mddjpB2kxRXXUO8,12453
1018
1018
  supervisely/nn/training/gui/gui.py,sha256=_CtpzlwP6WLFgOTBDB_4RPcaqrQPK92DwSCDvO-dIKM,51749
@@ -1127,9 +1127,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1127
1127
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1128
1128
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1129
1129
  supervisely_lib/__init__.py,sha256=yRwzEQmVwSd6lUQoAUdBngKEOlnoQ6hA9ZcoZGJRNC4,331
1130
- supervisely-6.73.443.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1131
- supervisely-6.73.443.dist-info/METADATA,sha256=XiNJG5fGmMFlBABN2mptuO55-VvjCbOxLMflB-PHDOE,35480
1132
- supervisely-6.73.443.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1133
- supervisely-6.73.443.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1134
- supervisely-6.73.443.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1135
- supervisely-6.73.443.dist-info/RECORD,,
1130
+ supervisely-6.73.445.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1131
+ supervisely-6.73.445.dist-info/METADATA,sha256=okbQprEc_0SUdjAP1h_TRp8DvyVWlTOJgvhMF06O_H8,35480
1132
+ supervisely-6.73.445.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1133
+ supervisely-6.73.445.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1134
+ supervisely-6.73.445.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1135
+ supervisely-6.73.445.dist-info/RECORD,,