supervisely 6.73.350__py3-none-any.whl → 6.73.352__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.
@@ -369,6 +369,8 @@ class PointTracking(BaseTracking):
369
369
  if video_interface.global_stop_indicatior:
370
370
  return
371
371
 
372
+ geometries = [video_interface._crop_geometry(g) for g in geometries]
373
+ geometries = [g for g in geometries if g is not None]
372
374
  geometries = [{"type": g.geometry_name(), "data": g.to_json()} for g in geometries]
373
375
  predictions.append(geometries)
374
376
 
@@ -18,6 +18,7 @@ from supervisely.geometry.helpers import deserialize_geometry
18
18
  from supervisely.geometry.point import Point
19
19
  from supervisely.geometry.polygon import Polygon
20
20
  from supervisely.geometry.polyline import Polyline
21
+ from supervisely.geometry.rectangle import Rectangle
21
22
  from supervisely.nn.inference.cache import InferenceImageCache
22
23
  from supervisely.sly_logger import logger
23
24
  from supervisely.video_annotation.key_id_map import KeyIdMap
@@ -42,6 +43,9 @@ class TrackerInterface:
42
43
 
43
44
  self.track_id = context["trackId"]
44
45
  self.video_id = context["videoId"]
46
+ self.frame_width = context.get("frameWidth", None)
47
+ self.frame_height = context.get("frameHeight", None)
48
+ self._video_info = None
45
49
  self.object_ids = list(context["objectIds"])
46
50
  self.figure_ids = list(context["figureIds"])
47
51
  self.direction = context["direction"]
@@ -75,6 +79,12 @@ class TrackerInterface:
75
79
  self._load_frames_to_hot_cache()
76
80
  self._load_frames()
77
81
 
82
+ @property
83
+ def video_info(self):
84
+ if self._video_info is None:
85
+ self._video_info = self.api.video.get_info_by_id(self.video_id)
86
+ return self._video_info
87
+
78
88
  def add_object_geometries(self, geometries: List[Geometry], object_id: int, start_fig: int):
79
89
  for frame, geometry in zip(self._cur_frames_indexes[1:], geometries):
80
90
  if self.global_stop_indicatior:
@@ -115,6 +125,17 @@ class TrackerInterface:
115
125
  self.clear_cache()
116
126
  return
117
127
 
128
+ def _crop_geometry(self, geometry: Geometry):
129
+ h, w = self.frame_height, self.frame_width
130
+ if h is None or w is None:
131
+ h = self.video_info.frame_height
132
+ w = self.video_info.frame_width
133
+ rect = Rectangle.from_size((h, w))
134
+ cropped = geometry.crop(rect)
135
+ if len(cropped) == 0:
136
+ return None
137
+ return cropped[0]
138
+
118
139
  def add_object_geometries_on_frames(
119
140
  self,
120
141
  geometries: List[Geometry],
@@ -131,6 +152,13 @@ class TrackerInterface:
131
152
  geometries_by_object = _split(geometries, object_ids, frame_indexes)
132
153
 
133
154
  for object_id, geometries_frame_indexes in geometries_by_object.items():
155
+ for i, (geometry, frame_index) in enumerate(geometries_frame_indexes):
156
+ geometries_frame_indexes[i] = (self._crop_geometry(geometry), frame_index)
157
+ geometries_frame_indexes = [
158
+ (geometry, frame_index)
159
+ for geometry, frame_index in geometries_frame_indexes
160
+ if geometry is not None
161
+ ]
134
162
  figures_json = [
135
163
  {
136
164
  ApiField.OBJECT_ID: object_id,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.350
3
+ Version: 6.73.352
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -40,7 +40,7 @@ Requires-Dist: stringcase<2.0.0,>=1.2.0
40
40
  Requires-Dist: python-magic<1.0.0,>=0.4.25
41
41
  Requires-Dist: trimesh<=4.5.0,>=3.11.2
42
42
  Requires-Dist: uvicorn[standard]<1.0.0,>=0.18.2
43
- Requires-Dist: pydantic<=2.8.2,>=1.7.4
43
+ Requires-Dist: pydantic<=2.11.3,>=1.7.4
44
44
  Requires-Dist: anyio<=4.2.0,>=3.7.1
45
45
  Requires-Dist: fastapi<=0.109.0,>=0.79.0
46
46
  Requires-Dist: websockets<=13.1,>=10.3
@@ -922,9 +922,9 @@ supervisely/nn/inference/tracking/bbox_tracking.py,sha256=sPE-jZjSKf5QuMXmYUOkP1
922
922
  supervisely/nn/inference/tracking/functional.py,sha256=LpVu2gvOOpr9D_uvwTPZey1wUCAhV-E20RPKmCSIrK4,1774
923
923
  supervisely/nn/inference/tracking/mask_tracking.py,sha256=1G0yHMw5BSzDGD4Ps-yRhr50ZeB88pMY6b-rmg2FFHw,25576
924
924
  supervisely/nn/inference/tracking/object_tracking_3d.py,sha256=Kqvx1qe1G8F1VtdBiy2HJ251rJU6s3LWhj0ZedhrmUw,4327
925
- supervisely/nn/inference/tracking/point_tracking.py,sha256=I0kT_YGqOudyX4LMSZfnWkB1UnUQ9ucawTyR-tFonc8,24644
925
+ supervisely/nn/inference/tracking/point_tracking.py,sha256=jQduMpFrntITDRCNb2q93TwSfkge4T_2nMJ71iJtzqM,24799
926
926
  supervisely/nn/inference/tracking/tracker3d_interface.py,sha256=7yIkNO9rgkzQuyXUUccLwqlv5k7RPbxTqz9uI4FylLE,2781
927
- supervisely/nn/inference/tracking/tracker_interface.py,sha256=lrIo6ULa4GYd_QclALt82k5d9cLpH0Ss3--XFhPBgUQ,21913
927
+ supervisely/nn/inference/tracking/tracker_interface.py,sha256=BrzddovTBxSsVt6eVa-v-6J7qYttK7S0JgJfd83M_eI,23070
928
928
  supervisely/nn/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
929
929
  supervisely/nn/legacy/config.py,sha256=TKdyGtURJKzKoyydCZAfujoUnbC0SO8GeVLTSnoyS_w,2994
930
930
  supervisely/nn/legacy/dataset.py,sha256=-56EI6OYbkTWx4y8hOgD76y47zUoJNjGFyZ6JaP8iqg,6055
@@ -1083,9 +1083,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1083
1083
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1084
1084
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1085
1085
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1086
- supervisely-6.73.350.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1087
- supervisely-6.73.350.dist-info/METADATA,sha256=2hZYrEUmL3RyDgh_rG9RU5RdHEfNB7aRGMhQysvHAk4,33596
1088
- supervisely-6.73.350.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1089
- supervisely-6.73.350.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1090
- supervisely-6.73.350.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1091
- supervisely-6.73.350.dist-info/RECORD,,
1086
+ supervisely-6.73.352.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1087
+ supervisely-6.73.352.dist-info/METADATA,sha256=Q3pBWWa63vwMk_BsKXdWp4bteVop0nTx0Gp0fOu6Uhg,33597
1088
+ supervisely-6.73.352.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1089
+ supervisely-6.73.352.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1090
+ supervisely-6.73.352.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1091
+ supervisely-6.73.352.dist-info/RECORD,,