supervisely 6.73.454__py3-none-any.whl → 6.73.455__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.
- supervisely/nn/inference/cache.py +29 -15
- {supervisely-6.73.454.dist-info → supervisely-6.73.455.dist-info}/METADATA +1 -1
- {supervisely-6.73.454.dist-info → supervisely-6.73.455.dist-info}/RECORD +7 -7
- {supervisely-6.73.454.dist-info → supervisely-6.73.455.dist-info}/LICENSE +0 -0
- {supervisely-6.73.454.dist-info → supervisely-6.73.455.dist-info}/WHEEL +0 -0
- {supervisely-6.73.454.dist-info → supervisely-6.73.455.dist-info}/entry_points.txt +0 -0
- {supervisely-6.73.454.dist-info → supervisely-6.73.455.dist-info}/top_level.txt +0 -0
@@ -771,7 +771,7 @@ class InferenceImageCache:
|
|
771
771
|
def _download_many(
|
772
772
|
self,
|
773
773
|
indexes: List[Union[int, str]],
|
774
|
-
|
774
|
+
name_constructor: Callable[[int], str],
|
775
775
|
load_generator: Callable[
|
776
776
|
[List[int]],
|
777
777
|
Generator[Tuple[Union[int, str], np.ndarray], None, None],
|
@@ -785,23 +785,35 @@ class InferenceImageCache:
|
|
785
785
|
all_frames = [None for _ in range(len(indexes))]
|
786
786
|
|
787
787
|
def get_one_image(item):
|
788
|
-
pos,
|
788
|
+
pos, hash_or_id = item
|
789
789
|
if video_id in self._cache:
|
790
|
-
|
791
|
-
|
790
|
+
try:
|
791
|
+
frame = self.get_frame_from_cache(video_id, hash_or_id)
|
792
|
+
except Exception as e:
|
793
|
+
logger.error(f"Error retrieving frame from cache: {e}", exc_info=True)
|
794
|
+
ids_to_load.append(hash_or_id)
|
795
|
+
return pos, None
|
796
|
+
return pos, frame
|
797
|
+
try:
|
798
|
+
image = self._cache.get_image(name_constructor(hash_or_id))
|
799
|
+
except Exception as e:
|
800
|
+
logger.error(f"Error retrieving image from cache: {e}", exc_info=True)
|
801
|
+
ids_to_load.append(hash_or_id)
|
802
|
+
return pos, None
|
803
|
+
return pos, image
|
792
804
|
|
793
805
|
position = 0
|
794
806
|
batch_size = 4
|
795
807
|
for batch in batched(indexes, batch_size):
|
796
|
-
|
808
|
+
ids_to_load = []
|
797
809
|
items = []
|
798
810
|
for hash_or_id in batch:
|
799
|
-
name =
|
811
|
+
name = name_constructor(hash_or_id)
|
800
812
|
self._wait_if_in_queue(name, logger)
|
801
813
|
|
802
814
|
if name not in self._cache and video_id not in self._cache:
|
803
815
|
self._load_queue.set(name, hash_or_id)
|
804
|
-
|
816
|
+
ids_to_load.append(hash_or_id)
|
805
817
|
pos_by_name[name] = position
|
806
818
|
elif return_images is True:
|
807
819
|
items.append((position, hash_or_id))
|
@@ -810,14 +822,16 @@ class InferenceImageCache:
|
|
810
822
|
if len(items) > 0:
|
811
823
|
with ThreadPoolExecutor(min(64, len(items))) as executor:
|
812
824
|
for pos, image in executor.map(get_one_image, items):
|
825
|
+
if image is None:
|
826
|
+
continue
|
813
827
|
all_frames[pos] = image
|
814
828
|
if progress_cb is not None:
|
815
829
|
progress_cb()
|
816
830
|
|
817
831
|
download_time = time.monotonic()
|
818
|
-
if len(
|
819
|
-
for id_or_hash, image in load_generator(
|
820
|
-
name =
|
832
|
+
if len(ids_to_load) > 0:
|
833
|
+
for id_or_hash, image in load_generator(ids_to_load):
|
834
|
+
name = name_constructor(id_or_hash)
|
821
835
|
self._add_to_cache(name, image)
|
822
836
|
|
823
837
|
if return_images:
|
@@ -828,13 +842,13 @@ class InferenceImageCache:
|
|
828
842
|
download_time = time.monotonic() - download_time
|
829
843
|
|
830
844
|
# logger.debug(f"All stored files: {sorted(os.listdir(self.tmp_path))}")
|
831
|
-
if
|
832
|
-
|
845
|
+
if ids_to_load:
|
846
|
+
ids_to_load = list(ids_to_load)
|
833
847
|
logger.debug(
|
834
|
-
f"Images/Frames added to cache: {
|
835
|
-
extra={"indexes":
|
848
|
+
f"Images/Frames added to cache: {ids_to_load} in {download_time:.2f} sec",
|
849
|
+
extra={"indexes": ids_to_load, "download_time": download_time},
|
836
850
|
)
|
837
|
-
found = set(batch).difference(
|
851
|
+
found = set(batch).difference(ids_to_load)
|
838
852
|
if found:
|
839
853
|
logger.debug(f"Images/Frames found in cache: {list(found)}")
|
840
854
|
|
@@ -905,7 +905,7 @@ supervisely/nn/benchmark/visualization/widgets/sidebar/sidebar.py,sha256=tKPURRS
|
|
905
905
|
supervisely/nn/benchmark/visualization/widgets/table/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
906
906
|
supervisely/nn/benchmark/visualization/widgets/table/table.py,sha256=atmDnF1Af6qLQBUjLhK18RMDKAYlxnsuVHMSEa5a-e8,4319
|
907
907
|
supervisely/nn/inference/__init__.py,sha256=QFukX2ip-U7263aEPCF_UCFwj6EujbMnsgrXp5Bbt8I,1623
|
908
|
-
supervisely/nn/inference/cache.py,sha256=
|
908
|
+
supervisely/nn/inference/cache.py,sha256=Gdpdfo61j5lxhMVR6YyqXjazJxQxihtKwLPqwVwzFRM,35599
|
909
909
|
supervisely/nn/inference/inference.py,sha256=71E5_DG5He2y9TWu2YN8P9MWz0EwldGJa_7pK6pVp7E,207512
|
910
910
|
supervisely/nn/inference/inference_request.py,sha256=1Tq-OV7bYtr0bKDqvBXh72wpR5Misgk-iQn5waCxtqo,14830
|
911
911
|
supervisely/nn/inference/session.py,sha256=f2Tyvj21oO9AKxqr6_yHZ81Ol-wXC-h5cweTHEoljkg,35796
|
@@ -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.455.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
1133
|
+
supervisely-6.73.455.dist-info/METADATA,sha256=K-GHALSmc3eZrjE6ekVhuaMf8cRf-2Zj7ebGcFP3nsE,35480
|
1134
|
+
supervisely-6.73.455.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
1135
|
+
supervisely-6.73.455.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
|
1136
|
+
supervisely-6.73.455.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
|
1137
|
+
supervisely-6.73.455.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|