PointcloudObject

class PointcloudObject(obj_class, tags=None, key=None, class_id=None, labeler_login=None, updated_at=None, created_at=None)[source]

Bases: VideoObject

Object in point cloud annotation (obj_class + tags). Uses VideoObject constructor. Immutable.

Parameters:
obj_class

Object class (e.g. ‘car’ with Rectangle geometry).

tags=None

Tags for this object.

key : uuid.UUID, optional

UUID key. Auto-generated if not provided.

class_id : int, optional

Server-side class ID.

labeler_login : str, optional

Login of user who created the object.

updated_at : str, optional

Last modification timestamp.

created_at : str, optional

Creation timestamp.

Usage Example:
import supervisely as sly

obj_class_car = sly.ObjClass('car', sly.Rectangle)
video_obj_car = sly.VideoObject(obj_class_car)
video_obj_car_json = video_obj_car.to_json()
print(video_obj_car_json)

Methods

add_tag

Adds VideoTag to the current VideoObject.

add_tags

Adds VideoTags to the current VideoObject.

clone

Makes a copy of VideoObject with new fields, if fields are given, otherwise it will use fields of the original VideoObject.

from_json

Convert PointcloudObject from json format to PointcloudObject class object.

key

Object key.

to_json

Convert the VideoObject to a json dict.

Attributes

class_id

Object class ID.

obj_class

ObjClass of the current VideoObject.

tags

VideoTagCollection of the current VideoObject.

tag_collection_type

alias of PointcloudTagCollection

classmethod from_json(data, project_meta, key_id_map=None)[source]

Convert PointcloudObject from json format to PointcloudObject class object. Raise error if object class name is not found in the given project meta.

Parameters:
data : dict

PointcloudObject in json format.

project_meta

Project metadata.

key_id_map=None

Key ID map.

Returns:

Pointcloud object.

Return type:

PointcloudObject

Usage Example:
import supervisely as sly
from supervisely.geometry.cuboid_3d import Cuboid3d, Vector3d

key_id_map = KeyIdMap()
project_id = 19441
obj_class_car = sly.ObjClass('car', Cuboid3d)
project_meta = sly.ProjectMeta([obj_class_car])
api.project.update_meta(id=project_id, meta=project_meta)
pointcloud_obj_car = sly.PointcloudObject(obj_class_car)
pointcloud_obj_car_json = pointcloud_obj_car.to_json()
new_pointcloud_obj_car = sly.PointcloudObject.from_json(
    data=pointcloud_obj_car_json,
    project_meta=project_meta,
    key_id_map=key_id_map
)
print(new_pointcloud_obj_car)
# <supervisely.pointcloud_annotation.pointcloud_object.PointcloudObject object at 0x7f97e0ba8ed0>
add_tag(tag)

Adds VideoTag to the current VideoObject.

Parameters:
tag

VideoTag to be added.

Returns:

VideoObject object

Return type:

VideoObject

Usage Example:
import supervisely as sly

# Create VideoObject
obj_class_car = sly.ObjClass('car', sly.Rectangle)
video_obj_car = sly.VideoObject(obj_class_car)

# Create VideoTag
meta_car = sly.TagMeta('car_tag', sly.TagValueType.ANY_STRING)
from supervisely.video_annotation.video_tag import VideoTag
car_tag = VideoTag(meta_car, value='acura')

# Add VideoTag
new_obj_car = video_obj_car.add_tag(car_tag)
new_obj_car_json = new_obj_car.to_json()
print(new_obj_car_json)
# Output: {
#     "key": "1ab52285ee634c93b724fa655b785eae",
#     "classTitle": "car",
#     "tags": [
#         {
#             "name": "car_tag",
#             "value": "acura",
#             "key": "d9e52b275e074c538f162a6d679aed9e"
#         }
#     ]
# }
add_tags(tags)

Adds VideoTags to the current VideoObject.

Parameters:
tag : List[VideoTag]

List of VideoTags to be added.

Returns:

VideoObject object

Return type:

VideoObject

Usage Example:
import supervisely as sly

# Create VideoObject
obj_class_vehicle = sly.ObjClass('vehicle', sly.Rectangle)
video_obj_vehicle = sly.VideoObject(obj_class_vehicle)

# Create VideoTags
from supervisely.video_annotation.video_tag import VideoTag
meta_car = sly.TagMeta('car_tag', sly.TagValueType.ANY_STRING)
car_tag = VideoTag(meta_car, value='acura')
meta_bus = sly.TagMeta('bus_tag', sly.TagValueType.ANY_STRING)
bus_tag = VideoTag(meta_bus, value='volvo')

# Add VideoTags
new_obj_vehicle = video_obj_vehicle.add_tags([car_tag, bus_tag])
new_obj_vehicle_json = new_obj_vehicle.to_json()
print(new_obj_vehicle_json)
# Output: {
#     "key": "94055c5e8cb146368f627fc608fb6b44",
#     "classTitle": "vehicle",
#     "tags": [
#         {
#             "name": "car_tag",
#             "value": "acura",
#             "key": "6679f47c96734565919fbffc278532a1"
#         },
#         {
#             "name": "bus_tag",
#             "value": "volvo",
#             "key": "d0a60dc929de491a85a09fea59adb818"
#         }
#     ]
# }
clone(obj_class=None, tags=None, key=None, class_id=None, labeler_login=None, updated_at=None, created_at=None)

Makes a copy of VideoObject with new fields, if fields are given, otherwise it will use fields of the original VideoObject.

Parameters:
obj_class=None

ObjClass object.

tags=None

VideoTagCollection object.

key : uuid.UUID, optional

UUID key associated with the object.

class_id : int, optional

ID of ObjClass to which VideoObject belongs.

labeler_login : str, optional

Login of the user who created VideoObject.

updated_at : str, optional

Date and Time when VideoObject 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 VideoObject was created. Date Format is the same as in “updated_at” parameter.

Returns:

VideoObject object

Return type:

VideoObject

Usage Example:
import supervisely as sly
from supervisely.video_annotation.video_tag import VideoTag
from supervisely.video_annotation.video_tag_collection import VideoTagCollection

obj_class_car = sly.ObjClass('vehicle', sly.Rectangle)
video_obj_car = sly.VideoObject(obj_class_car)

# New ObjClass to clone
obj_class_bus = sly.ObjClass('bus', sly.Rectangle)

# New VideoTagCollection to clone
meta_car = sly.TagMeta('car_tag', sly.TagValueType.ANY_STRING)
car_tag = VideoTag(meta_car, value='acura')
tags = VideoTagCollection([car_tag])
# Clone
new_obj_vehicle = video_obj_car.clone(obj_class=obj_class_bus, tags=tags)
new_obj_vehicle_json = new_obj_vehicle.to_json()
print(new_obj_vehicle_json)
# Output: {
#     "key": "39ae5b9ce1ca405c9f53544374b3f5be",
#     "classTitle": "bus",
#     "tags": [
#         {
#             "name": "car_tag",
#             "value": "acura",
#             "key": "3119b6e38fe24fe7a220e881154fd9ba"
#         }
#     ]
# }
key()

Object key.

Returns:

Object key

Return type:

KeyIdMap

Return type:

uuid.UUID

Usage Example:
import supervisely as sly

obj_class_car = sly.ObjClass('car', sly.Rectangle)
video_obj_car = sly.VideoObject(obj_class_car)
key = video_obj_car.key()
print(key)
# Output: 158e6cf4f4ac4c639fc6994aad127c16
to_json(key_id_map=None)

Convert the VideoObject to a json dict. Read more about Supervisely format.

Parameters:
key_id_map=None

KeyIdMap object.

Returns:

Json format as a dict

Return type:

dict

Usage Example:
import supervisely as sly

obj_class_car = sly.ObjClass('vehicle', sly.Rectangle)
video_obj_car = sly.VideoObject(obj_class_car)

obj_car_json = video_obj_car.to_json()
print(obj_car_json)
# Output: {
#     "key": "ce26e77a45bc45e88e3e17da1672d01f",
#     "classTitle": "vehicle",
#     "tags": []
# }
property class_id : int

Object class ID.

Returns:

Object class ID.

Return type:

int

Usage Example:
import supervisely as sly

obj_class_car = sly.ObjClass('car', sly.Rectangle)
video_obj_car = sly.VideoObject(obj_class_car)
class_id = video_obj_car.class_id
property obj_class : supervisely.annotation.obj_class.ObjClass

ObjClass of the current VideoObject.

Returns:

ObjClass object

Return type:

ObjClass

Usage Example:
import supervisely as sly

obj_class_car = sly.ObjClass('car', sly.Rectangle)
video_obj_car = sly.VideoObject(obj_class_car)
obj_car_json = video_obj_car.obj_class.to_json()
print(obj_car_json)
# Output: {
#     "title": "car",
#     "shape": "rectangle",
#     "color": "#8A0F7B",
#     "geometry_config": {},
#     "hotkey": ""
# }
property tags : supervisely.video_annotation.video_tag_collection.VideoTagCollection

VideoTagCollection of the current VideoObject.

Returns:

VideoTagCollection object

Return type:

VideoTagCollection

Usage Example:
import supervisely as sly

# Create VideoTagCollection
meta_car = sly.TagMeta('car_tag', sly.TagValueType.ANY_STRING)
from supervisely.video_annotation.video_tag import VideoTag
car_tag = VideoTag(meta_car, value='acura')
from supervisely.video_annotation.video_tag_collection import VideoTagCollection
video_tags = VideoTagCollection([car_tag])

# Create VideoObject
obj_class_car = sly.ObjClass('car', sly.Rectangle)
video_obj_car = sly.VideoObject(obj_class_car, video_tags)

# Get VideoTagCollection
tags = video_obj_car.tags
tags_json = tags.to_json()
print(tags_json)
# Output: [
#     {
#         "name": "car_tag",
#         "value": "acura",
#         "key": "4f82fbcab74c44259d7a0e29d604602e"
#     }
# ]