supervisely 6.73.217__py3-none-any.whl → 6.73.218__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/api/image_api.py +88 -5
- {supervisely-6.73.217.dist-info → supervisely-6.73.218.dist-info}/METADATA +1 -1
- {supervisely-6.73.217.dist-info → supervisely-6.73.218.dist-info}/RECORD +7 -7
- {supervisely-6.73.217.dist-info → supervisely-6.73.218.dist-info}/WHEEL +1 -1
- {supervisely-6.73.217.dist-info → supervisely-6.73.218.dist-info}/LICENSE +0 -0
- {supervisely-6.73.217.dist-info → supervisely-6.73.218.dist-info}/entry_points.txt +0 -0
- {supervisely-6.73.217.dist-info → supervisely-6.73.218.dist-info}/top_level.txt +0 -0
supervisely/api/image_api.py
CHANGED
|
@@ -2629,7 +2629,7 @@ class ImageApi(RemoveableBulkModuleApi):
|
|
|
2629
2629
|
"""
|
|
2630
2630
|
return resize_image_url(url, ext, method, width, height, quality)
|
|
2631
2631
|
|
|
2632
|
-
def update_meta(self, id: int, meta: Dict) -> Dict:
|
|
2632
|
+
def update_meta(self, id: int, meta: Dict) -> Dict[str, Any]:
|
|
2633
2633
|
"""
|
|
2634
2634
|
It is possible to add custom JSON data to every image for storing some additional information.
|
|
2635
2635
|
Updates Image metadata by ID. Metadata is visible in Labeling Tool.
|
|
@@ -2669,10 +2669,93 @@ class ImageApi(RemoveableBulkModuleApi):
|
|
|
2669
2669
|
# "Focal Length": "16 mm"
|
|
2670
2670
|
# }
|
|
2671
2671
|
"""
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2672
|
+
return self.edit(id=id, meta=meta, return_json=True)
|
|
2673
|
+
|
|
2674
|
+
def edit(
|
|
2675
|
+
self,
|
|
2676
|
+
id: int,
|
|
2677
|
+
name: Optional[str] = None,
|
|
2678
|
+
description: Optional[str] = None,
|
|
2679
|
+
meta: Optional[Dict] = None,
|
|
2680
|
+
return_json: bool = False,
|
|
2681
|
+
) -> Union[ImageInfo, Dict[str, Any]]:
|
|
2682
|
+
"""Updates the information about the image by given ID with provided parameters.
|
|
2683
|
+
At least one parameter must be set, otherwise ValueError will be raised.
|
|
2684
|
+
|
|
2685
|
+
:param id: Image ID in Supervisely.
|
|
2686
|
+
:type id: int
|
|
2687
|
+
:param name: New Image name.
|
|
2688
|
+
:type name: str, optional
|
|
2689
|
+
:param description: New Image description.
|
|
2690
|
+
:type description: str, optional
|
|
2691
|
+
:param meta: New Image metadata.
|
|
2692
|
+
:type meta: dict, optional
|
|
2693
|
+
:return_json: If True, return response in JSON format, otherwise convert it ImageInfo object.
|
|
2694
|
+
This parameter is only added for backward compatibility for update_meta method.
|
|
2695
|
+
It's not recommended to use it in new code.
|
|
2696
|
+
:type return_json: bool, optional
|
|
2697
|
+
:raises: :class:`ValueError` if at least one parameter is not set
|
|
2698
|
+
:raises: :class:`ValueError if meta parameter was set and it is not a dictionary
|
|
2699
|
+
:return: Information about updated image as ImageInfo object or as dict if return_json is True
|
|
2700
|
+
:rtype: :class:`ImageInfo` or :class:`dict`
|
|
2701
|
+
|
|
2702
|
+
:Usage example:
|
|
2703
|
+
|
|
2704
|
+
.. code-block:: python
|
|
2705
|
+
|
|
2706
|
+
import supervisely as sly
|
|
2707
|
+
|
|
2708
|
+
api = sly.Api.from_env()
|
|
2709
|
+
|
|
2710
|
+
image_id = 123456
|
|
2711
|
+
new_image_name = "IMG_3333_new.jpg"
|
|
2712
|
+
|
|
2713
|
+
api.image.edit(id=image_id, name=new_image_name)
|
|
2714
|
+
"""
|
|
2715
|
+
if name is None and description is None and meta is None:
|
|
2716
|
+
raise ValueError("At least one parameter must be set")
|
|
2717
|
+
|
|
2718
|
+
if meta is not None and not isinstance(meta, dict):
|
|
2719
|
+
raise ValueError("meta parameter must be a dictionary")
|
|
2720
|
+
|
|
2721
|
+
data = {
|
|
2722
|
+
ApiField.ID: id,
|
|
2723
|
+
ApiField.NAME: name,
|
|
2724
|
+
ApiField.DESCRIPTION: description,
|
|
2725
|
+
ApiField.META: meta,
|
|
2726
|
+
}
|
|
2727
|
+
data = {k: v for k, v in data.items() if v is not None}
|
|
2728
|
+
|
|
2729
|
+
response = self._api.post("images.editInfo", data)
|
|
2730
|
+
if return_json:
|
|
2731
|
+
return response.json()
|
|
2732
|
+
return self._convert_json_info(response.json(), skip_missing=True)
|
|
2733
|
+
|
|
2734
|
+
def rename(self, id: int, name: str) -> ImageInfo:
|
|
2735
|
+
"""
|
|
2736
|
+
Renames Image with given ID.
|
|
2737
|
+
|
|
2738
|
+
:param id: Image ID in Supervisely.
|
|
2739
|
+
:type id: int
|
|
2740
|
+
:param name: New Image name.
|
|
2741
|
+
:type name: str
|
|
2742
|
+
:return: Information about updated Image.
|
|
2743
|
+
:rtype: :class:`ImageInfo`
|
|
2744
|
+
:Usage example:
|
|
2745
|
+
|
|
2746
|
+
.. code-block:: python
|
|
2747
|
+
|
|
2748
|
+
import supervisely as sly
|
|
2749
|
+
|
|
2750
|
+
os.environ['SERVER_ADDRESS'] = 'https://app.supervisely.com'
|
|
2751
|
+
os.environ['API_TOKEN'] = 'Your Supervisely API Token'
|
|
2752
|
+
api = sly.Api.from_env()
|
|
2753
|
+
|
|
2754
|
+
image_id = 376729
|
|
2755
|
+
new_image_name = 'new_image_name.jpg'
|
|
2756
|
+
img_info = api.image.rename(image_id, new_image_name)
|
|
2757
|
+
"""
|
|
2758
|
+
return self.edit(id=id, name=name)
|
|
2676
2759
|
|
|
2677
2760
|
def add_tag(self, image_id: int, tag_id: int, value: Optional[Union[str, int]] = None) -> None:
|
|
2678
2761
|
"""
|
|
@@ -28,7 +28,7 @@ supervisely/api/dataset_api.py,sha256=7iwAyz3pmzFG2i072gLdXjczfBGbyj-V_rRl7Tx-V3
|
|
|
28
28
|
supervisely/api/file_api.py,sha256=y8FkE-vx1382cbhNo_rTZs7SobrkxmYQAe79CpvStO4,54279
|
|
29
29
|
supervisely/api/github_api.py,sha256=NIexNjEer9H5rf5sw2LEZd7C1WR-tK4t6IZzsgeAAwQ,623
|
|
30
30
|
supervisely/api/image_annotation_tool_api.py,sha256=YcUo78jRDBJYvIjrd-Y6FJAasLta54nnxhyaGyanovA,5237
|
|
31
|
-
supervisely/api/image_api.py,sha256=
|
|
31
|
+
supervisely/api/image_api.py,sha256=wnzoCbD5vV8f8joBQsNCbRjoG0jhyAXHe1ZM8YhbCsc,138727
|
|
32
32
|
supervisely/api/import_storage_api.py,sha256=BDCgmR0Hv6OoiRHLCVPKt3iDxSVlQp1WrnKhAK_Zl84,460
|
|
33
33
|
supervisely/api/issues_api.py,sha256=BqDJXmNoTzwc3xe6_-mA7FDFC5QQ-ahGbXk_HmpkSeQ,17925
|
|
34
34
|
supervisely/api/labeling_job_api.py,sha256=odnzZjp29yM16Gq-FYkv-OA4WFMNJCLFo4qSikW2A7c,56280
|
|
@@ -997,9 +997,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
|
|
|
997
997
|
supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
|
|
998
998
|
supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
|
|
999
999
|
supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
|
|
1000
|
-
supervisely-6.73.
|
|
1001
|
-
supervisely-6.73.
|
|
1002
|
-
supervisely-6.73.
|
|
1003
|
-
supervisely-6.73.
|
|
1004
|
-
supervisely-6.73.
|
|
1005
|
-
supervisely-6.73.
|
|
1000
|
+
supervisely-6.73.218.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
1001
|
+
supervisely-6.73.218.dist-info/METADATA,sha256=EnGwT_zAqgvOytZQYfG8Cc6sTL3MniXkWeNgG-TXZP4,33090
|
|
1002
|
+
supervisely-6.73.218.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
|
|
1003
|
+
supervisely-6.73.218.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
|
|
1004
|
+
supervisely-6.73.218.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
|
|
1005
|
+
supervisely-6.73.218.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|