supervisely 6.73.259__py3-none-any.whl → 6.73.260__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.

@@ -2,12 +2,14 @@
2
2
  """General information about :class:`Tag<supervisely.annotation.tag.Tag>`"""
3
3
 
4
4
  from __future__ import annotations
5
- from typing import List, Optional, Dict
5
+
6
6
  from copy import deepcopy
7
- from supervisely.imaging.color import random_rgb, rgb2hex, hex2rgb, _validate_color
8
- from supervisely.io.json import JsonSerializable
9
- from supervisely.collection.key_indexed_collection import KeyObject
7
+ from typing import Dict, List, Optional
8
+
10
9
  from supervisely._utils import take_with_default
10
+ from supervisely.collection.key_indexed_collection import KeyObject
11
+ from supervisely.imaging.color import _validate_color, hex2rgb, random_rgb, rgb2hex
12
+ from supervisely.io.json import JsonSerializable
11
13
 
12
14
 
13
15
  class TagValueType:
@@ -47,6 +49,7 @@ class TagMetaJsonFields:
47
49
  """"""
48
50
  APPLICABLE_CLASSES = "classes"
49
51
  """"""
52
+ TARGET_TYPE = "target_type" # "Scope"
50
53
 
51
54
 
52
55
  class TagApplicableTo:
@@ -62,6 +65,19 @@ class TagApplicableTo:
62
65
  """"""
63
66
 
64
67
 
68
+ class TagTargetType:
69
+ """
70
+ Defines Tag target type (scope) - entities, frames or both.
71
+ """
72
+
73
+ ALL = "all" # both entities and frames
74
+ """"""
75
+ FRAME_BASED = "framesOnly"
76
+ """"""
77
+ GLOBAL = "entitiesOnly"
78
+ """"""
79
+
80
+
65
81
  SUPPORTED_TAG_VALUE_TYPES = [
66
82
  TagValueType.NONE,
67
83
  TagValueType.ANY_NUMBER,
@@ -74,6 +90,12 @@ SUPPORTED_APPLICABLE_TO = [
74
90
  TagApplicableTo.OBJECTS_ONLY,
75
91
  ]
76
92
 
93
+ SUPPORTED_TARGET_TYPES = [
94
+ TagTargetType.ALL,
95
+ TagTargetType.FRAME_BASED,
96
+ TagTargetType.GLOBAL,
97
+ ]
98
+
77
99
 
78
100
  class TagMeta(KeyObject, JsonSerializable):
79
101
  """
@@ -95,6 +117,8 @@ class TagMeta(KeyObject, JsonSerializable):
95
117
  :type applicable_to: str, optional
96
118
  :param applicable_classes: Defines applicability of Tag only to certain classes.
97
119
  :type applicable_classes: List[str], optional
120
+ :param target_type: Defines Tag target type (scope) - entities, frames or both.
121
+ :type target_type: str, optional
98
122
  :raises: :class:`ValueError`, if color is not list, or doesn't have exactly 3 values
99
123
  :Usage example:
100
124
 
@@ -128,6 +152,7 @@ class TagMeta(KeyObject, JsonSerializable):
128
152
  hotkey: Optional[str] = None,
129
153
  applicable_to: Optional[str] = None,
130
154
  applicable_classes: Optional[List[str]] = None,
155
+ target_type: Optional[str] = None,
131
156
  ):
132
157
  if value_type not in SUPPORTED_TAG_VALUE_TYPES:
133
158
  raise ValueError(
@@ -144,12 +169,20 @@ class TagMeta(KeyObject, JsonSerializable):
144
169
  self._hotkey = take_with_default(hotkey, "")
145
170
  self._applicable_to = take_with_default(applicable_to, TagApplicableTo.ALL)
146
171
  self._applicable_classes = take_with_default(applicable_classes, [])
172
+ self._target_type = take_with_default(target_type, TagTargetType.ALL)
147
173
  if self._applicable_to not in SUPPORTED_APPLICABLE_TO:
148
174
  raise ValueError(
149
175
  "applicable_to = {!r} is unknown, should be one of {}".format(
150
176
  self._applicable_to, SUPPORTED_APPLICABLE_TO
151
177
  )
152
178
  )
179
+
180
+ if self._target_type not in SUPPORTED_TARGET_TYPES:
181
+ raise ValueError(
182
+ "target_type = {!r} is unknown, should be one of {}".format(
183
+ self._target_type, SUPPORTED_TARGET_TYPES
184
+ )
185
+ )
153
186
 
154
187
  if self._value_type == TagValueType.ONEOF_STRING:
155
188
  if self._possible_values is None:
@@ -329,6 +362,24 @@ class TagMeta(KeyObject, JsonSerializable):
329
362
  # Output: ['car', 'bicycle']
330
363
  """
331
364
  return self._applicable_classes
365
+
366
+ @property
367
+ def target_type(self) -> str:
368
+ """
369
+ Tag target type (scope) - entities, frames or both.
370
+
371
+ :return: Target type
372
+ :rtype: :class:`str`
373
+ :Usage example:
374
+
375
+ .. code-block:: python
376
+
377
+ meta_dog = sly.TagMeta('dog', sly.TagValueType.NONE, target_type=TagTargetType.FRAME_BASED)
378
+
379
+ print(meta_dog.target_type)
380
+ # Output: 'framesOnly'
381
+ """
382
+ return self._target_type
332
383
 
333
384
  def to_json(self) -> Dict:
334
385
  """
@@ -390,6 +441,8 @@ class TagMeta(KeyObject, JsonSerializable):
390
441
  jdict[TagMetaJsonFields.APPLICABLE_TYPE] = self.applicable_to
391
442
  if self._applicable_classes is not None:
392
443
  jdict[TagMetaJsonFields.APPLICABLE_CLASSES] = self.applicable_classes
444
+ if self._target_type is not None:
445
+ jdict[TagMetaJsonFields.TARGET_TYPE] = self.target_type
393
446
 
394
447
  return jdict
395
448
 
@@ -445,6 +498,7 @@ class TagMeta(KeyObject, JsonSerializable):
445
498
  hotkey = data.get(TagMetaJsonFields.HOTKEY, "")
446
499
  applicable_to = data.get(TagMetaJsonFields.APPLICABLE_TYPE, TagApplicableTo.ALL)
447
500
  applicable_classes = data.get(TagMetaJsonFields.APPLICABLE_CLASSES, [])
501
+ target_type = data.get(TagMetaJsonFields.TARGET_TYPE, TagTargetType.ALL)
448
502
 
449
503
  return cls(
450
504
  name=name,
@@ -455,6 +509,7 @@ class TagMeta(KeyObject, JsonSerializable):
455
509
  hotkey=hotkey,
456
510
  applicable_to=applicable_to,
457
511
  applicable_classes=applicable_classes,
512
+ target_type=target_type,
458
513
  )
459
514
  else:
460
515
  raise ValueError("Tags must be dict or str types.")
@@ -632,6 +687,7 @@ class TagMeta(KeyObject, JsonSerializable):
632
687
  hotkey: Optional[str] = None,
633
688
  applicable_to: Optional[str] = None,
634
689
  applicable_classes: Optional[List[str]] = None,
690
+ target_type: Optional[str] = None,
635
691
  ) -> TagMeta:
636
692
  """
637
693
  Clone makes a copy of TagMeta with new fields, if fields are given, otherwise it will use original TagMeta fields.
@@ -683,6 +739,7 @@ class TagMeta(KeyObject, JsonSerializable):
683
739
  hotkey=take_with_default(hotkey, self.hotkey),
684
740
  applicable_to=take_with_default(applicable_to, self.applicable_to),
685
741
  applicable_classes=take_with_default(applicable_classes, self.applicable_classes),
742
+ target_type=take_with_default(target_type, self.target_type),
686
743
  )
687
744
 
688
745
  def __str__(self):
@@ -713,6 +770,7 @@ class TagMeta(KeyObject, JsonSerializable):
713
770
  "Hotkey",
714
771
  "Applicable to",
715
772
  "Applicable classes",
773
+ "Target type",
716
774
  ]
717
775
 
718
776
  def get_row_ptable(self):
@@ -724,6 +782,7 @@ class TagMeta(KeyObject, JsonSerializable):
724
782
  self.hotkey,
725
783
  self.applicable_to,
726
784
  self.applicable_classes,
785
+ self.target_type,
727
786
  ]
728
787
 
729
788
  def _set_id(self, id: int):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: supervisely
3
- Version: 6.73.259
3
+ Version: 6.73.260
4
4
  Summary: Supervisely Python SDK.
5
5
  Home-page: https://github.com/supervisely/supervisely
6
6
  Author: Supervisely
@@ -15,7 +15,7 @@ supervisely/annotation/obj_class_mapper.py,sha256=aIJDoRULqcAOD2a1CQPk2OOF8k3VPP
15
15
  supervisely/annotation/renamer.py,sha256=rVvNLtpfd1kKUVPgm8VlLmYSDByWjriJ92FobC4buqY,1944
16
16
  supervisely/annotation/tag.py,sha256=m_sPgrr_ZW8HuiK7Fr2-WnHwKwez1WZtGrcdZN2DZuQ,17598
17
17
  supervisely/annotation/tag_collection.py,sha256=MVPTzer9rLpD4O0g2XhYFUheK7-ILgwAXDJd1em3kZ8,10015
18
- supervisely/annotation/tag_meta.py,sha256=7r89qe4UOiI3BQ3TVGrz4kpcrVpteTpFc9-CuiYk3WQ,25759
18
+ supervisely/annotation/tag_meta.py,sha256=2UkgRSMuQ7LXH48Ok2bJNdlK-miX54wXYAoB_as9_a0,27543
19
19
  supervisely/annotation/tag_meta_collection.py,sha256=JY2wAo4dF47UylYeglkJtRtpVOArGjf3dXeEYIHFWP0,14491
20
20
  supervisely/annotation/tag_meta_mapper.py,sha256=RWeTrxJ64syodyhXIRSH007bX6Hr3B45tG14YTcpwSU,1639
21
21
  supervisely/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1057,9 +1057,9 @@ supervisely/worker_proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
1057
1057
  supervisely/worker_proto/worker_api_pb2.py,sha256=VQfi5JRBHs2pFCK1snec3JECgGnua3Xjqw_-b3aFxuM,59142
1058
1058
  supervisely/worker_proto/worker_api_pb2_grpc.py,sha256=3BwQXOaP9qpdi0Dt9EKG--Lm8KGN0C5AgmUfRv77_Jk,28940
1059
1059
  supervisely_lib/__init__.py,sha256=7-3QnN8Zf0wj8NCr2oJmqoQWMKKPKTECvjH9pd2S5vY,159
1060
- supervisely-6.73.259.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1061
- supervisely-6.73.259.dist-info/METADATA,sha256=HIPNQSEj3JiqMJTUJwVoxBUSorGAhnvQ4tXlf1e0Xhk,33573
1062
- supervisely-6.73.259.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1063
- supervisely-6.73.259.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1064
- supervisely-6.73.259.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1065
- supervisely-6.73.259.dist-info/RECORD,,
1060
+ supervisely-6.73.260.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
1061
+ supervisely-6.73.260.dist-info/METADATA,sha256=CPwcqKvIAjMyeGM6DRLQKHF3owWEcixltIqVe4T0x-E,33573
1062
+ supervisely-6.73.260.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
1063
+ supervisely-6.73.260.dist-info/entry_points.txt,sha256=U96-5Hxrp2ApRjnCoUiUhWMqijqh8zLR03sEhWtAcms,102
1064
+ supervisely-6.73.260.dist-info/top_level.txt,sha256=kcFVwb7SXtfqZifrZaSE3owHExX4gcNYe7Q2uoby084,28
1065
+ supervisely-6.73.260.dist-info/RECORD,,