Node

class Node(location=None, disabled=False, label=None, row=None, col=None)[source]

Bases: JsonSerializable

Single vertex in a keypoint graph: a labeled point (row, col) used as a building block for GraphNodes (e.g. pose keypoints, skeleton joints).

Node for a single GraphNodes.

Parameters:
location=None

Location of Node.

disabled : bool, optional

Determines whether to display the Node when drawing or not.

label=None

str

row=None

int

col=None

int

Usage Example:
import supervisely as sly
from supervisely.geometry.graph import Node

vertex = Node(sly.PointLocation(5, 5))

Methods

from_json

Convert a json dict to Node.

to_json

Convert the Node to a json dict.

transform_location

Attributes

disabled

Display the Node when drawing or not.

location

Location of Node.

classmethod from_json(data)[source]

Convert a json dict to Node. Read more about Supervisely format.

Parameters:
data : dict

Node in json format as a dict.

Returns:

Node from json.

Return type:

Node

Usage Example:
vertex_json = {"loc": [5, 5]}
vertex = Node.from_json(vertex_json)
to_json()[source]

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

Returns:

Node in json format as a dict.

Return type:

dict

Usage Example:
import supervisely as sly
from supervisely.geometry.graph import Node

vertex = Node(sly.PointLocation(5, 5))
vertex_json = vertex.to_json()
print(vertex_json)
# Output: {
#    "loc": [5, 5]
# }
transform_location(transform_fn)[source]
Parameters:
transform_fn

function to convert location

Returns:

Node after transformation.

Return type:

Node

property disabled : bool

Display the Node when drawing or not.

Returns:

Boolean

Return type:

bool

property location : supervisely.geometry.point_location.PointLocation

Location of Node.

Returns:

Location of Node.

Return type:

PointLocation