supervisely 6.73.450__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.
- supervisely/convert/image/csv/csv_converter.py +24 -15
- {supervisely-6.73.450.dist-info → supervisely-6.73.451.dist-info}/METADATA +2 -2
- {supervisely-6.73.450.dist-info → supervisely-6.73.451.dist-info}/RECORD +7 -7
- {supervisely-6.73.450.dist-info → supervisely-6.73.451.dist-info}/LICENSE +0 -0
- {supervisely-6.73.450.dist-info → supervisely-6.73.451.dist-info}/WHEEL +0 -0
- {supervisely-6.73.450.dist-info → supervisely-6.73.451.dist-info}/entry_points.txt +0 -0
- {supervisely-6.73.450.dist-info → supervisely-6.73.451.dist-info}/top_level.txt +0 -0
@@ -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
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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.
|
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.
|
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.
|
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.
|
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.
|
231
|
+
logger.warning(f"FYI: Image [{image_path}] doesn't have extension.")
|
223
232
|
elif extension.lower() not in SUPPORTED_IMG_EXTS:
|
224
|
-
logger.
|
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.
|
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.
|
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.
|
351
|
+
logger.warning(f"Dataset ID:'{dataset_id}' has been uploaded.")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: supervisely
|
3
|
-
Version: 6.73.
|
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.
|
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
|
@@ -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=
|
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
|
@@ -1128,9 +1128,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
1128
1128
|
supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
|
1129
1129
|
supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
|
1130
1130
|
supervisely_lib/__init__.py,sha256=yRwzEQmVwSd6lUQoAUdBngKEOlnoQ6hA9ZcoZGJRNC4,331
|
1131
|
-
supervisely-6.73.
|
1132
|
-
supervisely-6.73.
|
1133
|
-
supervisely-6.73.
|
1134
|
-
supervisely-6.73.
|
1135
|
-
supervisely-6.73.
|
1136
|
-
supervisely-6.73.
|
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,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|