supervisely 6.73.461__py3-none-any.whl → 6.73.463__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.
- supervisely/app/widgets/select_dataset_tree/select_dataset_tree.py +9 -2
- supervisely/nn/inference/session.py +40 -34
- supervisely/video/sampling.py +41 -21
- supervisely/video/video.py +25 -10
- {supervisely-6.73.461.dist-info → supervisely-6.73.463.dist-info}/METADATA +1 -1
- {supervisely-6.73.461.dist-info → supervisely-6.73.463.dist-info}/RECORD +10 -10
- {supervisely-6.73.461.dist-info → supervisely-6.73.463.dist-info}/LICENSE +0 -0
- {supervisely-6.73.461.dist-info → supervisely-6.73.463.dist-info}/WHEEL +0 -0
- {supervisely-6.73.461.dist-info → supervisely-6.73.463.dist-info}/entry_points.txt +0 -0
- {supervisely-6.73.461.dist-info → supervisely-6.73.463.dist-info}/top_level.txt +0 -0
|
@@ -7,7 +7,6 @@ from supervisely.app.widgets.checkbox.checkbox import Checkbox
|
|
|
7
7
|
from supervisely.app.widgets.container.container import Container
|
|
8
8
|
from supervisely.app.widgets.field.field import Field
|
|
9
9
|
from supervisely.app.widgets.select.select import Select
|
|
10
|
-
from supervisely.app.widgets.select_project.select_project import SelectProject
|
|
11
10
|
from supervisely.app.widgets.tree_select.tree_select import TreeSelect
|
|
12
11
|
from supervisely.project.project_type import ProjectType
|
|
13
12
|
|
|
@@ -120,7 +119,15 @@ class SelectDatasetTree(Widget):
|
|
|
120
119
|
if self._project_id:
|
|
121
120
|
project_info = self._api.project.get_info_by_id(self._project_id)
|
|
122
121
|
if allowed_project_types is not None:
|
|
123
|
-
|
|
122
|
+
allowed_values = []
|
|
123
|
+
if not isinstance(allowed_project_types, list):
|
|
124
|
+
allowed_project_types = [allowed_project_types]
|
|
125
|
+
|
|
126
|
+
for pt in allowed_project_types:
|
|
127
|
+
if isinstance(pt, (ProjectType, str)):
|
|
128
|
+
allowed_values.append(str(pt))
|
|
129
|
+
|
|
130
|
+
if project_info.type not in allowed_values:
|
|
124
131
|
self._project_id = None
|
|
125
132
|
|
|
126
133
|
self._multiselect = multiselect
|
|
@@ -441,46 +441,52 @@ class SessionJSON:
|
|
|
441
441
|
prev_current = 0
|
|
442
442
|
if preparing_cb:
|
|
443
443
|
# wait for inference status
|
|
444
|
-
|
|
445
|
-
awaiting_preparing_progress = 0
|
|
446
|
-
break_flag = False
|
|
447
|
-
while resp.get("status") is None:
|
|
448
|
-
time.sleep(1)
|
|
449
|
-
awaiting_preparing_progress += 1
|
|
450
|
-
if awaiting_preparing_progress > 30:
|
|
451
|
-
break_flag = True
|
|
444
|
+
try:
|
|
452
445
|
resp = self._get_preparing_progress()
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
446
|
+
for i in range(30):
|
|
447
|
+
logger.info(
|
|
448
|
+
f"Waiting for preparing progress... {30 - i} seconds left until timeout"
|
|
449
|
+
)
|
|
450
|
+
resp = self._get_preparing_progress()
|
|
451
|
+
if resp.get("status") is not None:
|
|
452
|
+
break
|
|
453
|
+
time.sleep(1)
|
|
454
|
+
if not resp.get("status"):
|
|
455
|
+
raise RuntimeError("Preparing progress status is not available.")
|
|
456
|
+
|
|
457
|
+
if resp.get("status") == "download_info":
|
|
458
|
+
logger.info("Downloading infos...")
|
|
459
459
|
progress_widget = preparing_cb(
|
|
460
460
|
message="Downloading infos", total=resp["total"], unit="it"
|
|
461
461
|
)
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
if resp
|
|
462
|
+
while resp["status"] == "download_info":
|
|
463
|
+
current = resp["current"]
|
|
464
|
+
# pylint: disable=possibly-used-before-assignment
|
|
465
|
+
progress_widget.update(current - prev_current)
|
|
466
|
+
prev_current = current
|
|
467
|
+
resp = self._get_preparing_progress()
|
|
468
|
+
|
|
469
|
+
if resp.get("status") == "download_project":
|
|
470
|
+
logger.info("Downloading project...")
|
|
470
471
|
progress_widget = preparing_cb(message="Download project", total=resp["total"])
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
if resp
|
|
472
|
+
while resp.get("status") == "download_project":
|
|
473
|
+
current = resp["current"]
|
|
474
|
+
progress_widget.update(current - prev_current)
|
|
475
|
+
prev_current = current
|
|
476
|
+
resp = self._get_preparing_progress()
|
|
477
|
+
|
|
478
|
+
if resp.get("status") == "warmup":
|
|
479
|
+
logger.info("Running warmup...")
|
|
478
480
|
progress_widget = preparing_cb(message="Running warmup", total=resp["total"])
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
481
|
+
while resp.get("status") == "warmup":
|
|
482
|
+
current = resp["current"]
|
|
483
|
+
progress_widget.update(current - prev_current)
|
|
484
|
+
prev_current = current
|
|
485
|
+
resp = self._get_preparing_progress()
|
|
486
|
+
except Exception as ex:
|
|
487
|
+
logger.warning(
|
|
488
|
+
f"An error occurred while getting preparing progress: {ex}. Continue without preparing progress status."
|
|
489
|
+
)
|
|
484
490
|
|
|
485
491
|
logger.info("Inference has started:", extra={"response": resp})
|
|
486
492
|
resp, has_started = self._wait_for_async_inference_start()
|
supervisely/video/sampling.py
CHANGED
|
@@ -225,28 +225,48 @@ def sample_video(
|
|
|
225
225
|
progress.miniters = 1
|
|
226
226
|
progress.refresh()
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
228
|
+
batch_size = 50
|
|
229
|
+
try:
|
|
230
|
+
with VideoFrameReader(video_path, frame_indices) as reader:
|
|
231
|
+
for batch_indices in batched_iter(frame_indices, batch_size):
|
|
232
|
+
batch_indices_list = list(batch_indices)
|
|
233
|
+
frames = reader.read_batch(batch_indices_list)
|
|
234
|
+
|
|
235
|
+
if resize:
|
|
236
|
+
resized_frames = []
|
|
237
|
+
for frame in frames:
|
|
238
|
+
resized_frame = cv2.resize(
|
|
239
|
+
frame,
|
|
240
|
+
(resize[1], resize[0]), # (width, height)
|
|
241
|
+
interpolation=cv2.INTER_LINEAR,
|
|
242
|
+
)
|
|
243
|
+
resized_frames.append(resized_frame)
|
|
244
|
+
frames = resized_frames
|
|
245
|
+
|
|
246
|
+
image_ids = _upload_frames(
|
|
247
|
+
api=api,
|
|
248
|
+
frames=frames,
|
|
249
|
+
video_name=video_info.name,
|
|
250
|
+
video_frames_count=video_info.frames_count,
|
|
251
|
+
indices=batch_indices_list,
|
|
252
|
+
dataset_id=dst_dataset_info.id,
|
|
253
|
+
sample_info=sample_info,
|
|
254
|
+
context=context,
|
|
255
|
+
copy_annotations=copy_annotations,
|
|
256
|
+
video_annotation=video_annotation,
|
|
257
|
+
)
|
|
247
258
|
|
|
248
|
-
|
|
249
|
-
|
|
259
|
+
if progress is not None:
|
|
260
|
+
progress.update(len(image_ids))
|
|
261
|
+
|
|
262
|
+
# Free memory after each batch
|
|
263
|
+
del frames
|
|
264
|
+
if resize:
|
|
265
|
+
del resized_frames
|
|
266
|
+
finally:
|
|
267
|
+
import os
|
|
268
|
+
if os.path.exists(video_path):
|
|
269
|
+
os.remove(video_path)
|
|
250
270
|
|
|
251
271
|
|
|
252
272
|
def _get_or_create_dst_dataset(
|
supervisely/video/video.py
CHANGED
|
@@ -537,11 +537,9 @@ class VideoFrameReader:
|
|
|
537
537
|
try:
|
|
538
538
|
import decord
|
|
539
539
|
|
|
540
|
-
self.vr = decord.VideoReader(str(self.video_path))
|
|
540
|
+
self.vr = decord.VideoReader(str(self.video_path), num_threads=1)
|
|
541
541
|
except ImportError:
|
|
542
|
-
default_logger.debug(
|
|
543
|
-
"Decord is not installed. Falling back to OpenCV for video reading."
|
|
544
|
-
)
|
|
542
|
+
default_logger.debug("Decord is not installed. Falling back to OpenCV for video reading.")
|
|
545
543
|
self.cap = cv2.VideoCapture(str(self.video_path))
|
|
546
544
|
|
|
547
545
|
def close(self):
|
|
@@ -562,24 +560,30 @@ class VideoFrameReader:
|
|
|
562
560
|
def __del__(self):
|
|
563
561
|
self.close()
|
|
564
562
|
|
|
565
|
-
def iterate_frames(self, frame_indexes: List[int] = None) -> Generator[np.ndarray, None, None]:
|
|
563
|
+
def iterate_frames(self, frame_indexes: Optional[List[int]] = None) -> Generator[np.ndarray, None, None]:
|
|
566
564
|
self._ensure_initialized()
|
|
567
565
|
if frame_indexes is None:
|
|
568
566
|
frame_indexes = self.frame_indexes
|
|
569
567
|
if self.vr is not None:
|
|
568
|
+
# Decord
|
|
570
569
|
if frame_indexes is None:
|
|
571
570
|
frame_indexes = range(len(self.vr))
|
|
572
|
-
for
|
|
573
|
-
|
|
574
|
-
yield
|
|
571
|
+
for idx in frame_indexes:
|
|
572
|
+
arr = self.vr[idx].asnumpy()
|
|
573
|
+
yield arr
|
|
574
|
+
del arr
|
|
575
575
|
else:
|
|
576
|
+
# OpenCV fallback
|
|
576
577
|
if frame_indexes is None:
|
|
577
578
|
frame_count = int(self.cap.get(cv2.CAP_PROP_FRAME_COUNT))
|
|
578
579
|
frame_indexes = range(frame_count)
|
|
579
580
|
for frame_index in frame_indexes:
|
|
580
|
-
if 1
|
|
581
|
+
if 1 < frame_index - self.prev_idx < 20:
|
|
581
582
|
while self.prev_idx < frame_index - 1:
|
|
582
|
-
self.cap.read()
|
|
583
|
+
ok, _ = self.cap.read()
|
|
584
|
+
if not ok:
|
|
585
|
+
break
|
|
586
|
+
self.prev_idx += 1
|
|
583
587
|
if frame_index != self.prev_idx + 1:
|
|
584
588
|
self.cap.set(cv2.CAP_PROP_POS_FRAMES, frame_index)
|
|
585
589
|
ret, frame = self.cap.read()
|
|
@@ -588,6 +592,17 @@ class VideoFrameReader:
|
|
|
588
592
|
yield cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
|
589
593
|
self.prev_idx = frame_index
|
|
590
594
|
|
|
595
|
+
def read_batch(self, frame_indexes: List[int]) -> List[np.ndarray]:
|
|
596
|
+
self._ensure_initialized()
|
|
597
|
+
if self.vr is not None:
|
|
598
|
+
batch_nd = self.vr.get_batch(frame_indexes)
|
|
599
|
+
batch_np = batch_nd.asnumpy()
|
|
600
|
+
frames = [batch_np[i].copy() for i in range(batch_np.shape[0])]
|
|
601
|
+
del batch_np
|
|
602
|
+
return frames
|
|
603
|
+
else:
|
|
604
|
+
return list(self.iterate_frames(frame_indexes))
|
|
605
|
+
|
|
591
606
|
def read_frames(self, frame_indexes: List[int] = None) -> List[np.ndarray]:
|
|
592
607
|
return list(self.iterate_frames(frame_indexes))
|
|
593
608
|
|
|
@@ -461,7 +461,7 @@ supervisely/app/widgets/select_dataset/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JC
|
|
|
461
461
|
supervisely/app/widgets/select_dataset/select_dataset.py,sha256=S7zl83lUhquJ1U8GugiViEiGId6a5nVDfyIRRxh_LT4,10295
|
|
462
462
|
supervisely/app/widgets/select_dataset/template.html,sha256=7O_ZgmRs0vOL8tng6QvYbI_0o6A4yMAPB2MlfzWHeHQ,984
|
|
463
463
|
supervisely/app/widgets/select_dataset_tree/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
464
|
-
supervisely/app/widgets/select_dataset_tree/select_dataset_tree.py,sha256=
|
|
464
|
+
supervisely/app/widgets/select_dataset_tree/select_dataset_tree.py,sha256=HQwKXzz5yhmdcS79qfP_AGDUpGgQESNmLcASZx2rv78,25802
|
|
465
465
|
supervisely/app/widgets/select_dataset_tree/template.html,sha256=_uvKCMP0nkpSl3FiTUxqy10JZw3q8-9hXCv22W3BDF0,38
|
|
466
466
|
supervisely/app/widgets/select_item/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
467
467
|
supervisely/app/widgets/select_item/select_item.py,sha256=dcB0UN46rn3nFQybgrGpLRfwB6xnPo-GGrv9rsMeCbA,3833
|
|
@@ -908,7 +908,7 @@ supervisely/nn/inference/__init__.py,sha256=QFukX2ip-U7263aEPCF_UCFwj6EujbMnsgrX
|
|
|
908
908
|
supervisely/nn/inference/cache.py,sha256=Hkxvu70rrB-j7ztQ4TBOxQePAxiKS7Erdb2FmK7aetY,35795
|
|
909
909
|
supervisely/nn/inference/inference.py,sha256=54SXkXYEyswQN1L9hbOn0luSLyWbFOoaSH1qzNfu7HQ,219687
|
|
910
910
|
supervisely/nn/inference/inference_request.py,sha256=yuqEL4BWjC-aKze_raGScEQyhHe8loYb_eNhGPsf2-4,14870
|
|
911
|
-
supervisely/nn/inference/session.py,sha256=
|
|
911
|
+
supervisely/nn/inference/session.py,sha256=WRJKVnmh5GPXnwtuKJn7AO1C7Td39wZo774ZIVQJGYk,36228
|
|
912
912
|
supervisely/nn/inference/uploader.py,sha256=Dn5MfMRq7tclEWpP0B9fJjTiQPBpwumfXxC8-lOYgnM,5659
|
|
913
913
|
supervisely/nn/inference/video_inference.py,sha256=8Bshjr6rDyLay5Za8IB8Dr6FURMO2R_v7aELasO8pR4,5746
|
|
914
914
|
supervisely/nn/inference/gui/__init__.py,sha256=wCxd-lF5Zhcwsis-wScDA8n1Gk_1O00PKgDviUZ3F1U,221
|
|
@@ -1090,8 +1090,8 @@ supervisely/user/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,
|
|
|
1090
1090
|
supervisely/user/user.py,sha256=4GSVIupPAxWjIxZmUtH3Dtms_vGV82-49kM_aaR2gBI,319
|
|
1091
1091
|
supervisely/video/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1092
1092
|
supervisely/video/import_utils.py,sha256=b1Nl0gscNsV0iB9nWPeqt8GrkhOeuTZsN1p-d3gDUmE,544
|
|
1093
|
-
supervisely/video/sampling.py,sha256=
|
|
1094
|
-
supervisely/video/video.py,sha256=
|
|
1093
|
+
supervisely/video/sampling.py,sha256=SA1HeS1yK0-w7oHrojuCQJIAO5UAJuO6zrdOgeE1Twc,20979
|
|
1094
|
+
supervisely/video/video.py,sha256=ufwyec2d9ekV3_CLy4VhOj3Ni0gcXIerIBHtC1KGzTQ,21400
|
|
1095
1095
|
supervisely/video_annotation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1096
1096
|
supervisely/video_annotation/constants.py,sha256=_gW9iMhVk1w_dUaFiaiyXn66mt13S6bkxC64xpjP-CU,529
|
|
1097
1097
|
supervisely/video_annotation/frame.py,sha256=np21FqavJ3xW9VbLbohifDwZQtF5dWIsNSGVSjn-NnY,10574
|
|
@@ -1129,9 +1129,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
1129
1129
|
supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
|
|
1130
1130
|
supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
|
|
1131
1131
|
supervisely_lib/__init__.py,sha256=yRwzEQmVwSd6lUQoAUdBngKEOlnoQ6hA9ZcoZGJRNC4,331
|
|
1132
|
-
supervisely-6.73.
|
|
1133
|
-
supervisely-6.73.
|
|
1134
|
-
supervisely-6.73.
|
|
1135
|
-
supervisely-6.73.
|
|
1136
|
-
supervisely-6.73.
|
|
1137
|
-
supervisely-6.73.
|
|
1132
|
+
supervisely-6.73.463.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
1133
|
+
supervisely-6.73.463.dist-info/METADATA,sha256=xOtl8l6e5EUS_V-ZuFKjRPc5yb6IwKpjCfqkOvplIcE,35604
|
|
1134
|
+
supervisely-6.73.463.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
1135
|
+
supervisely-6.73.463.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
|
|
1136
|
+
supervisely-6.73.463.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
|
|
1137
|
+
supervisely-6.73.463.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|