DrawFunc

Inheritance diagram of DrawFunc

DrawFunc inheritance diagram

class savant.config.schema.DrawFunc(module='savant.deepstream.drawfunc', class_name='NvDsDrawFunc', kwargs=None, dev_mode=False, element='pyfunc', element_type=None, version='v1', name=None, properties=<factory>, rendered_objects=None, condition=<factory>)

A pipeline element that will use an object implementing BaseNvDsDrawFunc to draw metadata on frames.

Note

Default values for module and class_name attributes are set to use NvDsDrawFunc drawfunc implementation.

__call__(*args, **kwargs)

Calls resolved PyFunc implementation if its a subclass of BasePyFuncCallableImpl, otherwise no-op.

check_reload()

Checks if reload is needed and reloads in case it is.

dev_mode: bool = False

Whether the pyfunc is in dev mode.

element: str = 'pyfunc'

"pyfunc" is the fixed gstreamer element class for PyFuncElement.

element_type: str | None = None

Element type/subtype, can be defined as a substring of the element.

For example, detector in

- element: nvinfer@detector
property full_name

Full element name.

property instance: BasePyFuncImpl

Returns resolved PyFunc implementation.

kwargs: Dict[str, Any] | None = None

Class initialization keyword arguments.

load_user_code()

Load (or reload) the user module/class specified in the PyFunc fields. It’s necessary to call this at least once before starting the pipeline.

name: str | None = None

GstElement instance name. Arbitrary string, useful for identifying pipeline elements.

version: str = 'v1'

Element version, can be defined as a substring of the element.

For example, v1 in

- element: nvinfer@detector:v1
properties: Dict[str, Any]

GstElement properties.

module: str = 'savant.deepstream.drawfunc'

Module name to import.

class_name: str = 'NvDsDrawFunc'

Python class name to instantiate.

rendered_objects: Dict[str, Dict[str, Any]] | None = None

A specification of objects to be rendered by the default draw function.

For more details, look at Declarative Configuration.

condition: FrameProcessingCondition

Conditions for filtering frames to be processed by the draw function.

The draw function will be applied only to frames when all conditions are met.