supervisely 6.73.449__py3-none-any.whl → 6.73.451__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.
@@ -15,6 +15,7 @@ from supervisely.geometry.multichannel_bitmap import MultichannelBitmap
15
15
  from supervisely.geometry.closed_surface_mesh import ClosedSurfaceMesh
16
16
  from supervisely.geometry.alpha_mask import AlphaMask
17
17
  from supervisely.geometry.cuboid_2d import Cuboid2d
18
+ from supervisely.geometry.polyline_3d import Polyline3D
18
19
 
19
20
 
20
21
  _INPUT_GEOMETRIES = [
@@ -34,6 +35,7 @@ _INPUT_GEOMETRIES = [
34
35
  ClosedSurfaceMesh,
35
36
  AlphaMask,
36
37
  Cuboid2d,
38
+ Polyline3D,
37
39
  ]
38
40
  _JSON_SHAPE_TO_GEOMETRY_TYPE = {
39
41
  geometry.geometry_name(): geometry for geometry in _INPUT_GEOMETRIES
@@ -24,6 +24,7 @@ from supervisely.io.fs import (
24
24
  get_file_name_with_ext,
25
25
  list_files_recursively,
26
26
  )
27
+ from supervisely.io.env import team_id
27
28
  from supervisely.io.json import load_json_file
28
29
  from supervisely.project.project_settings import LabelingInterface
29
30
 
@@ -78,16 +79,16 @@ class CSVConverter(ImageConverter):
78
79
  }
79
80
 
80
81
  def __init__(
81
- self,
82
- input_data: str,
83
- labeling_interface: Optional[Union[LabelingInterface, str]],
84
- upload_as_links: bool,
85
- remote_files_map: Optional[Dict[str, str]] = None,
82
+ self,
83
+ input_data: str,
84
+ labeling_interface: Optional[Union[LabelingInterface, str]],
85
+ upload_as_links: bool,
86
+ remote_files_map: Optional[Dict[str, str]] = None,
86
87
  ):
87
88
  super().__init__(input_data, labeling_interface, upload_as_links, remote_files_map)
88
89
 
90
+ self._supports_links = True
89
91
  self._csv_reader = None
90
- self._team_id = None
91
92
 
92
93
  def __str__(self):
93
94
  return AvailableImageConverters.CSV
@@ -121,6 +122,12 @@ class CSVConverter(ImageConverter):
121
122
 
122
123
  full_path = valid_files[0]
123
124
 
125
+ if self.upload_as_links and self._supports_links:
126
+ for local_path, remote_path in self._remote_files_map.items():
127
+ if local_path.endswith(full_path):
128
+ self._api.storage.download(self._team_id, remote_path, local_path)
129
+ break
130
+
124
131
  file_ext = get_file_ext(full_path)
125
132
  if file_ext in self.conversion_functions:
126
133
  csv_full_path = os.path.splitext(full_path)[0] + ".csv"
@@ -147,7 +154,7 @@ class CSVConverter(ImageConverter):
147
154
  team_files = False
148
155
  break
149
156
  if item_path is None:
150
- logger.warn(f"Failed to find image path in row: {row}. Skipping.")
157
+ logger.warning(f"Failed to find image path in row: {row}. Skipping.")
151
158
  continue
152
159
  ann_data = row.get("tag")
153
160
  item = CSVConverter.Item(
@@ -192,7 +199,7 @@ class CSVConverter(ImageConverter):
192
199
  ann_json = csv_helper.rename_in_json(ann_json, renamed_classes, renamed_tags)
193
200
  return Annotation.from_json(ann_json, meta)
194
201
  except Exception as e:
195
- logger.warn(f"Failed to convert annotation: {repr(e)}")
202
+ logger.warning(f"Failed to convert annotation: {repr(e)}")
196
203
  return item.create_empty_annotation()
197
204
 
198
205
  def process_remote_image(
@@ -209,19 +216,21 @@ class CSVConverter(ImageConverter):
209
216
  image_path = image_path.strip()
210
217
  if is_team_file:
211
218
  if not api.file.exists(team_id, image_path):
212
- logger.warn(f"File {image_path} not found in Team Files. Skipping...")
219
+ logger.warning(f"File {image_path} not found in Team Files. Skipping...")
213
220
  return None
214
221
  team_file_image_info = api.file.list(team_id, image_path)
215
222
  image_path = team_file_image_info[0]["fullStorageUrl"]
216
223
  if not image_path:
217
- logger.warn(f"Failed to get full storage URL for file '{image_path}'. Skipping...")
224
+ logger.warning(
225
+ f"Failed to get full storage URL for file '{image_path}'. Skipping..."
226
+ )
218
227
  return None
219
228
 
220
229
  extension = os.path.splitext(image_path)[1]
221
230
  if not extension:
222
- logger.warn(f"FYI: Image [{image_path}] doesn't have extension.")
231
+ logger.warning(f"FYI: Image [{image_path}] doesn't have extension.")
223
232
  elif extension.lower() not in SUPPORTED_IMG_EXTS:
224
- logger.warn(
233
+ logger.warning(
225
234
  f"Image [{image_path}] has unsupported extension [{extension}]. Skipping..."
226
235
  )
227
236
  return None
@@ -234,7 +243,7 @@ class CSVConverter(ImageConverter):
234
243
  force_metadata_for_links=force_metadata,
235
244
  )
236
245
  except Exception:
237
- logger.warn(f"Failed to upload image {image_name}. Skipping...")
246
+ logger.warning(f"Failed to link image {image_name}. Skipping...")
238
247
  return None
239
248
  if progress_cb is not None:
240
249
  progress_cb(1)
@@ -312,7 +321,7 @@ class CSVConverter(ImageConverter):
312
321
  success = False
313
322
  continue
314
323
  if item.name not in info.name:
315
- logger.warn(
324
+ logger.warning(
316
325
  f"Batched image with name '{item.name}' doesn't match uploaded image name '{info.name}'"
317
326
  )
318
327
  success = False
@@ -339,4 +348,4 @@ class CSVConverter(ImageConverter):
339
348
  if success:
340
349
  logger.info(f"Dataset ID:'{dataset_id}' has been successfully uploaded.")
341
350
  else:
342
- logger.warn(f"Dataset ID:'{dataset_id}' has been uploaded.")
351
+ logger.warning(f"Dataset ID:'{dataset_id}' has been uploaded.")
@@ -0,0 +1,110 @@
1
+ from supervisely.geometry.geometry import Geometry
2
+ from supervisely.geometry.constants import LABELER_LOGIN, UPDATED_AT, CREATED_AT, ID, CLASS_ID
3
+ from supervisely.geometry.cuboid_3d import Vector3d
4
+ from typing import List, Union
5
+
6
+
7
+ class Polyline3D(Geometry):
8
+ """
9
+ Polyline3D geometry
10
+
11
+ :param points: List of 3D point coordinates which define the polyline in 3D space.
12
+ :type points: List[List[int, int, int]]
13
+ :param sly_id: Polyline ID in Supervisely server.
14
+ :type sly_id: int, optional
15
+ :param class_id: ID of :class:`ObjClass<supervisely.annotation.obj_class.ObjClass>` to which Polyline belongs.
16
+ :type class_id: int, optional
17
+ :param labeler_login: Login of the user who created Polyline.
18
+ :type labeler_login: str, optional
19
+ :param updated_at: Date and Time when Polyline was modified last. Date Format: Year:Month:Day:Hour:Minute:Seconds. Example: '2021-01-22T19:37:50.158Z'.
20
+ :type updated_at: str, optional
21
+ :param created_at: Date and Time when Polyline was created. Date Format is the same as in "updated_at" parameter.
22
+ :type created_at: str, optional
23
+
24
+ :Usage example:
25
+
26
+ .. code-block:: python
27
+
28
+ import supervisely as sly
29
+
30
+ points = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
31
+ figure = sly.Polyline(points)
32
+ """
33
+
34
+ @staticmethod
35
+ def geometry_name():
36
+ return "polyline_3d"
37
+
38
+ def __init__(
39
+ self,
40
+ points: Union[List[float], List[Vector3d]],
41
+ sly_id=None,
42
+ class_id=None,
43
+ labeler_login=None,
44
+ updated_at=None,
45
+ created_at=None,
46
+ ):
47
+ if not isinstance(points[0], Vector3d):
48
+ points = [Vector3d(point[0], point[1], point[2]) for point in points]
49
+ super().__init__(
50
+ sly_id=sly_id,
51
+ class_id=class_id,
52
+ labeler_login=labeler_login,
53
+ updated_at=updated_at,
54
+ created_at=created_at,
55
+ )
56
+
57
+ self._points = points
58
+
59
+ @property
60
+ def points(self):
61
+ return self._points
62
+
63
+ def to_json(self):
64
+ points = [[point.x, point.y, point.z] for point in self._points]
65
+ res = {"points": points}
66
+ self._add_creation_info(res)
67
+ return res
68
+
69
+ @classmethod
70
+ def from_json(cls, data):
71
+ """
72
+ Convert a json dict to Polyline3D.
73
+
74
+ :param data: Polyline3D in json format as a dict.
75
+ :type data: dict
76
+ :return: Polyline3D object
77
+ :rtype: :class:`Polyline3D<Polyline3D>`
78
+ :Usage example:
79
+
80
+ .. code-block:: python
81
+
82
+ import supervisely as sly
83
+
84
+ figure_json = {
85
+ "points": {
86
+ [
87
+ [1, 2, 3],
88
+ [4, 5, 6],
89
+ [7, 8, 9]
90
+ ],
91
+ }
92
+ }
93
+ figure = sly.Polyline3D.from_json(figure_json)
94
+ """
95
+ if not data.get("points"):
96
+ raise ValueError("Data dict must contain 'points' field!")
97
+ points = data["points"]
98
+ labeler_login = data.get(LABELER_LOGIN, None)
99
+ updated_at = data.get(UPDATED_AT, None)
100
+ created_at = data.get(CREATED_AT, None)
101
+ sly_id = data.get(ID, None)
102
+ class_id = data.get(CLASS_ID, None)
103
+ return cls(
104
+ points,
105
+ sly_id=sly_id,
106
+ class_id=class_id,
107
+ labeler_login=labeler_login,
108
+ updated_at=updated_at,
109
+ created_at=created_at,
110
+ )
@@ -3,6 +3,7 @@ from typing import List, Optional
3
3
  import numpy as np
4
4
 
5
5
  from supervisely.geometry.cuboid_3d import Cuboid3d
6
+ from supervisely.geometry.polyline_3d import Polyline3D
6
7
 
7
8
 
8
9
  class Prediction:
@@ -81,3 +82,9 @@ class PredictionCuboid3d(Prediction):
81
82
  super(PredictionCuboid3d, self).__init__(class_name=class_name)
82
83
  self.cuboid_3d = cuboid_3d
83
84
  self.score = score
85
+
86
+
87
+ class PredictionPolyline3D(Prediction):
88
+ def __init__(self, class_name: str, polyline_3d: Polyline3D):
89
+ super(PredictionPolyline3D, self).__init__(class_name=class_name)
90
+ self.polyline_3d = polyline_3d
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.449
3
+ Version: 6.73.451
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -24,7 +24,7 @@ Requires-Dist: cachetools<=5.5.0,>=4.2.3
24
24
  Requires-Dist: numpy<2.0.0,>=1.19
25
25
  Requires-Dist: opencv-python<5.0.0.0,>=4.6.0.66
26
26
  Requires-Dist: PTable<1.0.0,>=0.9.2
27
- Requires-Dist: pillow<=10.2.0,>=5.4.1
27
+ Requires-Dist: pillow<=10.4.0,>=5.4.1
28
28
  Requires-Dist: protobuf<=3.20.3,>=3.19.5
29
29
  Requires-Dist: python-json-logger<3.0.0,>=0.1.11
30
30
  Requires-Dist: requests<3.0.0,>=2.27.1
@@ -8,7 +8,7 @@ supervisely/versions.json,sha256=J7V7XPpDno0fvmNaAXXcxNksXqpRFaYRrG4POC0UDKQ,608
8
8
  supervisely/annotation/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  supervisely/annotation/annotation.py,sha256=th4gsIU-LNGcMRohHrtupmjxDwdzx1g4_0xIAa6NyJU,114717
10
10
  supervisely/annotation/annotation_transforms.py,sha256=TlVy_gUbM-XH6GbLpZPrAi6pMIGTr7Ow02iSKOSTa-I,9582
11
- supervisely/annotation/json_geometries_map.py,sha256=nL6AmMhFy02fw9ryBm75plKyOkDh61QdOToSuLAcz_Q,1659
11
+ supervisely/annotation/json_geometries_map.py,sha256=2MaOklrooKc6QUGXEEEhatPsNxRodp2cPsaiYENlv98,1731
12
12
  supervisely/annotation/label.py,sha256=sOK6lGDa-uSNCb7o4F9BJwnPia-Qp36OmFOU8oHyHPA,40601
13
13
  supervisely/annotation/obj_class.py,sha256=W7-958-E9TfsL7eKAI3bbOvfAVxd3Unq-7F3lc2Gxjg,16672
14
14
  supervisely/annotation/obj_class_collection.py,sha256=lsBJ8mElvwMHky2vsj4GfZ9_Uq186eS-o4ldoNeUJnw,12416
@@ -599,7 +599,7 @@ supervisely/convert/image/coco/coco_anntotation_converter.py,sha256=O1PQbwrbnpQB
599
599
  supervisely/convert/image/coco/coco_converter.py,sha256=7dW7vE6yTRz7O31vTVSnEA4MDCc_UXTqc2UFEqaKorI,5650
600
600
  supervisely/convert/image/coco/coco_helper.py,sha256=gkSLgLPUQh-xFN1A7Nh41nZE7rwHvdZSzcPG_C1dh8I,39473
601
601
  supervisely/convert/image/csv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
602
- supervisely/convert/image/csv/csv_converter.py,sha256=iLyc2PAVtlsAq7blnGH4iS1_D7Ai6-4UsdI_RlDVB9Q,11677
602
+ supervisely/convert/image/csv/csv_converter.py,sha256=FNuNKOdNWp0JoXAvUlCp8JWXVJ7uJbBgeFFb8Wbyo_k,12064
603
603
  supervisely/convert/image/csv/csv_helper.py,sha256=-nR192IfMU0vTlNRoKXu5FS6tTs9fENqySyeKKyemRs,8409
604
604
  supervisely/convert/image/high_color/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
605
605
  supervisely/convert/image/high_color/high_color_depth.py,sha256=t1LsOnEwhSmXUWxs2K7e_EHit5H0132_UibtFIt1P_w,5276
@@ -721,6 +721,7 @@ supervisely/geometry/point_location.py,sha256=ufGPj5BShL3QbE1eAMlnKpSSnb1S23Gfsk
721
721
  supervisely/geometry/pointcloud.py,sha256=cc4P_UNLGx5dWah3caRJytW7_mAi8UnYsJOa20mUy8s,1472
722
722
  supervisely/geometry/polygon.py,sha256=lqXS8xkBay8UhkVsB7eG_gRhwP1lBqyPaEri85ZMK8c,11597
723
723
  supervisely/geometry/polyline.py,sha256=r6KKJhJT8Au9Ds94Oa7saKdz2IPaEtR4SuVJBc4-uiA,8191
724
+ supervisely/geometry/polyline_3d.py,sha256=3uG-SszDH2iZPo2ES9ibMxvAjO2gEmr2PZIqN53Q2Hs,3458
724
725
  supervisely/geometry/rectangle.py,sha256=hWYNcVLzFTFf0WiDNhNFi9ktrgLPYxcow3QKltaQOiI,33875
725
726
  supervisely/geometry/sliding_windows.py,sha256=VWtE3DS9AaIlS0ch0PY6wwtWU89J82icDRZ-F0LFrjM,1700
726
727
  supervisely/geometry/sliding_windows_fuzzy.py,sha256=InvJlH6MEW55DM1IdoMHP2MLFLieTDZfHrZZEINLQOc,3626
@@ -759,7 +760,7 @@ supervisely/metric/precision_recall_metric.py,sha256=4AQCkcB84mpYQS94yJ-wkG1LBuX
759
760
  supervisely/metric/projects_applier.py,sha256=ORtgLQHYtNi4KYsSGaGPPWiZPexTJF9IWqX_RuLRxPk,3415
760
761
  supervisely/nn/__init__.py,sha256=ZGCDjx_cGIW8CxIWNCzVDRVfAzt7QzlkcvKvLBE8wMc,669
761
762
  supervisely/nn/experiments.py,sha256=1m5qq7LbHEVzI6nS4dFZg1zwJvjmhIvUoQ3iFhD8GBc,10387
762
- supervisely/nn/prediction_dto.py,sha256=oi146DJpUUBDbR-b-vYkL5WAhCZQYOGomqBDEQGbPdY,2700
763
+ supervisely/nn/prediction_dto.py,sha256=Z0WDcSnz5tEVTZ-eyDvD1CpIXlM7OYSZhK2A1TVZTEY,2977
763
764
  supervisely/nn/task_type.py,sha256=UJvSJ4L3I08j_e6sU6Ptu7kS5p1H09rfhfoDUSZ2iys,522
764
765
  supervisely/nn/utils.py,sha256=WoEidpLo5__R6eXsvEFH7VRxb4MtXCr9H-kchg25FDY,2965
765
766
  supervisely/nn/artifacts/__init__.py,sha256=DOkRrpvwQoTMH1GaAGHxwgYWshORAhxpeyvzmXt_F50,588
@@ -1127,9 +1128,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1127
1128
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1128
1129
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1129
1130
  supervisely_lib/__init__.py,sha256=yRwzEQmVwSd6lUQoAUdBngKEOlnoQ6hA9ZcoZGJRNC4,331
1130
- supervisely-6.73.449.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1131
- supervisely-6.73.449.dist-info/METADATA,sha256=d65TCju-7Q_u75UWtDWAgTcIRszBoX5r8KPONLcp0Bo,35480
1132
- supervisely-6.73.449.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1133
- supervisely-6.73.449.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1134
- supervisely-6.73.449.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1135
- supervisely-6.73.449.dist-info/RECORD,,
1131
+ supervisely-6.73.451.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1132
+ supervisely-6.73.451.dist-info/METADATA,sha256=UDSRIdFR3U9VbWpLqzckQ9YqL2IsB0wdyP_4Ny3asac,35480
1133
+ supervisely-6.73.451.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
1134
+ supervisely-6.73.451.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1135
+ supervisely-6.73.451.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1136
+ supervisely-6.73.451.dist-info/RECORD,,