PointcloudEpisodeTag¶
- class PointcloudEpisodeTag[source]¶
Bases:
supervisely.video_annotation.video_tag.VideoTag
PointcloudEpisodeTag object for
PointcloudEpisodeAnnotation
.PointcloudEpisodeTag
object is immutable.- Parameters
- meta : TagMeta
General information about point cloud episodes Tag.
- value : Optional[Union[str, int, float]]
point cloud episodes Tag value. Depends on
TagValueType
ofTagMeta
.- frame_range : Tuple[int, int] or List[int, int], optional
point cloud episodes Tag frame range.
- key : uuid.UUID, optional
uuid.UUID object.
- sly_id : int, optional
PointcloudEpisodeTag ID in Supervisely.
- labeler_login : str, optional
Login of user who created PointcloudEpisodeTag.
- updated_at : str, optional
Date and Time when PointcloudEpisodeTag was modified last. Date Format: Year:Month:Day:Hour:Minute:Seconds. Example: ‘2021-01-22T19:37:50.158Z’.
- created_at : str, optional
Date and Time when PointcloudEpisodeTag was created. Date Format is the same as in “updated_at” parameter.
- Usage example
import supervisely as sly meta_car = sly.TagMeta('car', sly.TagValueType.NONE) # Now we can create a VideoTag using our TagMeta tag_car = sly.PointcloudEpisodeTag(meta_car) # When you are creating a new Tag # Tag.value is automatically cross-checked against your TagMeta value type to make sure the value is valid. # If we now try to add a value to our newly created Tag, we receive "ValueError", because our TagMeta value type is "NONE" tag_car = sly.PointcloudEpisodeTag(meta_car, value="Bus") # Output: ValueError: Tag car can not have value Bus # Let's create another Tag with a string value type and frame range meta_car = sly.TagMeta('cat', sly.TagValueType.ANY_STRING) tag_car = sly.PointcloudEpisodeTag(meta_car, value="red", frame_range=(5, 10)) # Now let's create a Tag using TagMeta with "ONEOF_STRING" value type # In order to use "oneof_string value type", you must initialize a variable with possible values(see class TagMeta for more information) colors = ["brown", "white", "black", "red", "chocolate", "gold", "grey"] meta_car_color = sly.TagMeta('car color', sly.TagValueType.ONEOF_STRING, possible_values=colors) tag_car_color = sly.PointcloudEpisodeTag(meta_car_color, value="white", frame_range=(15, 20)) # If given value is not in a list of possible Tags, ValueError will be raised tag_car_color = sly.PointcloudEpisodeTag(meta_car_color, value="yellow") # Output: ValueError: Tag car color can not have value yellow
Methods
Makes a copy of PointcloudEpisodeTag with new fields, if fields are given, otherwise it will use fields of the original PointcloudEpisodeTag.
Convert a json dict to PointcloudEpisodeTag.
Get string with information about VideoTag: name, value and range of frames.
get_header_ptable
get_row_ptable
key
- rtype
Convert the VideoTag to a json dict.
Attributes
VideoTag frame range.
VideoTag is finished or not (applicable for range tags).
General information about Tag.
Name property.
VideoTag value is final or not.
Tag value.
-
clone(meta=
None
, value=None
, frame_range=None
, key=None
, sly_id=None
, labeler_login=None
, updated_at=None
, created_at=None
)[source]¶ Makes a copy of PointcloudEpisodeTag with new fields, if fields are given, otherwise it will use fields of the original PointcloudEpisodeTag.
- Parameters
- meta : TagMeta, optional
General information about PointcloudEpisodeTag.
- value : Optional[Union[str, int, float]]
PointcloudEpisodeTag value. Depends on
TagValueType
ofTagMeta
.- frame_range : Optional[Union[Tuple[int, int], List[int, int]]]
PointcloudEpisodeTag frame range.
- key : uuid.UUID, optional
uuid.UUID object.
- sly_id : int, optional
PointcloudEpisodeTag ID in Supervisely.
- labeler_login : str, optional
Login of user who created PointcloudEpisodeTag.
- updated_at : str, optional
Date and Time when PointcloudEpisodeTag was modified last. Date Format: Year:Month:Day:Hour:Minute:Seconds. Example: ‘2021-01-22T19:37:50.158Z’.
- created_at : str, optional
Date and Time when PointcloudEpisodeTag was created. Date Format is the same as in “updated_at” parameter.
- Usage example
import supervisely as sly colors = ["brown", "white", "black", "red", "chocolate", "gold", "grey"] meta_car_color = sly.TagMeta('car color', sly.TagValueType.ONEOF_STRING, possible_values=colors) tag_car_color = sly.PointcloudEpisodeTag(meta_car_color, value="white", frame_range=(15, 20)) meta_bus = sly.TagMeta('bus', sly.TagValueType.ANY_STRING) new_tag = tag_car_color.clone(meta=meta_bus, frame_range=(15, 30), key=tag_car_color.key()) print(new_tag.to_json()) # Output: { # "frameRange": [15, 30], # "key": "4360b25778144141aa4f1a0d775a0a7a", # "name": "bus", # "value": "white" # }
- Return type
-
classmethod from_json(data, tag_meta_collection, key_id_map=
None
)[source]¶ Convert a json dict to PointcloudEpisodeTag. Read more about Supervisely format.
- Parameters
- data : dict
PointcloudEpisodeTag in json format as a dict.
- tag_meta_collection : TagMetaCollection
TagMetaCollection
object.- key_id_map : KeyIdMap, optional
Key ID Map object.
- Returns
PointcloudEpisodeTag object
- Return type
- Usage example
import supervisely as sly tag_car_color_json = { "frameRange": [15, 20], "key": "da9ca75e97744fc5aaf24d6be2eb2832", "name": "car color", "value": "white" } colors = ["brown", "white", "black", "red", "chocolate", "gold", "grey"] meta_car_color = sly.TagMeta('car color', sly.TagValueType.ONEOF_STRING, possible_values=colors) meta_car_collection = sly.TagMetaCollection([meta_car_color]) tag_car_color = sly.PointcloudEpisodeTag.from_json(tag_car_color_json, meta_car_collection)
- get_compact_str()¶
Get string with information about VideoTag: name, value and range of frames.
- Returns
Information about VideoTag object
- Return type
- Usage example
import supervisely as sly from supervisely.video_annotation.video_tag import VideoTag meta_cat = sly.TagMeta('cat', sly.TagValueType.ANY_STRING) tag_cat = VideoTag(meta_cat, value="Fluffy", frame_range=(5, 10)) compact_tag_cat = tag_cat.get_compact_str() print(compact_tag_cat) # cat:Fluffy[5 - 10]
-
to_json(key_id_map=
None
)¶ Convert the VideoTag to a json dict. Read more about Supervisely format.
- Parameters
- key_id_map : KeyIdMap, optional
Key ID Map object.
- Returns
Json format as a dict
- Return type
- Usage example
import supervisely as sly from supervisely.video_annotation.video_tag import VideoTag meta_dog = sly.TagMeta('dog', sly.TagValueType.NONE) tag_dog = VideoTag(meta_dog) tag_dog_json = tag_dog.to_json() print(tag_dog_json) # Output: { # "name": "dog", # "key": "058ad7993a534082b4d94cc52542a97d" # }
- property frame_range¶
VideoTag frame range.
- Returns
Range of frames for current VideoTag
- Return type
Tuple[int, int]
- Usage example
cat_range = tag_cat.frame_range # [5, 10]
- property is_finished¶
VideoTag is finished or not (applicable for range tags).
- Returns
True if VideoTag is finished, otherwise False
- Return type
- Usage example
is_finished = tag_cat.is_finished
- property meta¶
General information about Tag. When creating a new Tag, it’s value is automatically cross-checked against
TagValueType
to make sure that value is valid.- Returns
TagMeta object
- Return type
- Usage example
meta_dog = sly.TagMeta('dog', sly.TagValueType.NONE) tag_dog = sly.Tag(meta_dog) # Our TagMeta has value type 'NONE', if we try to add value to our Tag, "ValueError" error will be raised tag_dog = sly.Tag(meta_dog, value="Husky") # Output: ValueError: Tag dog can not have value Husky
- property name¶
Name property.
- Returns
Name
- Return type
- Usage example
meta_dog = sly.TagMeta('dog', sly.TagValueType.ANY_STRING) tag_dog = sly.Tag(meta_dog, value="Husky") print(tag_dog.name) # Output: "dog"
- property non_final_value¶
VideoTag value is final or not.
- Returns
True if VideoTag value is final, otherwise False
- Return type
- Usage example
non_final_value = tag_cat.non_final_value
- property value¶
Tag value. Return type depends on
TagValueType
.- Returns
Tag value
- Return type
- Usage example
meta_dog = sly.TagMeta('dog', sly.TagValueType.ANY_STRING) tag_dog = sly.Tag(meta_dog, value="Husky") meta_age = sly.TagMeta('age', sly.TagValueType.ANY_NUMBER) tag_age = sly.Tag(meta_age, value=9) colors = ["Black", "White", "Golden", "Brown"] meta_color = sly.TagMeta('coat color', sly.TagValueType.ONEOF_STRING, possible_values=colors) tag_color = sly.Tag(meta_color, value="White") type(tag_dog.value) # 'str' type(tag_age.value) # 'int' type(tag_color.value) # 'str'