configure_source_for_ntp_sync¶
- pyds.configure_source_for_ntp_sync(src_elem: int) None ¶
Configure the source to generate NTP sync values for RTSP sources.
These values are used by the DeepStream GStreamer element NvStreamMux to calculate the NTP time of the frames at the source.
This functionality is dependent on the RTSP sending the RTCP Sender Reports. source.
This function only works for RTSP sources i.e. GStreamer elements “rtspsrc” or “uridecodebin” with an RTSP uri.
- Parameters:
src_elem – GStreamer source element to be configured.
alloc_custom_struct¶
- pyds.alloc_custom_struct(arg0: pyds.NvDsUserMeta) pyds.CustomDataStruct ¶
Allocate an
CustomDataStruct
.- Returns:
Allocated
CustomDataStruct
gst_element_send_nvevent_new_stream_reset¶
- pyds.gst_element_send_nvevent_new_stream_reset(arg0: int, arg1: int) int ¶
Sends a “custom reset” event on the given element for the specified source. This nvevent_new_stream_reset event is propogated downstream.
This function, along with other reset events, can be used to reset the source in case RTSP reconnection is required.
- Parameters:
gst_element – element for to which the generated event needs to be sent.
source_id – source id for which this event needs to be generated
- Returns:
True for success.
gst_element_send_nvevent_interval_update¶
- pyds.gst_element_send_nvevent_interval_update(arg0: int, arg1: str, arg2: int) bool ¶
Sends a “nv-infer-interval-update” event to nvinfer.
This function is used to update the value of the interval property of nvinfer
- Parameters:
gst_element – nvinfer for to which the interval-update event needs to be sent.
source_id – Stream ID of the stream for which infer-interval-update is to be sent
interval – The infer interval obtained corresponding to stream ID for the event.
- Returns:
True for success.
get_segmentation_masks¶
- pyds.get_segmentation_masks(data: capsule) numpy.ndarray ¶
This function returns the inferred masks in Numpy format in the height X width shape, these height and width are obtained from the
NvDsInferSegmentationMeta
.- Parameters:
data – An object of type
NvDsInferSegmentationMeta
get_optical_flow_vectors¶
- pyds.get_optical_flow_vectors(data: capsule) numpy.ndarray[numpy.float32] ¶
- Parameters:
of_meta – An object of type
NvDsOpticalFlowMeta
- Returns:
Interleaved x, y directed optical flow vectors for a block of pixels in numpy format with shape (rows,cols,2), where rows and cols are the Optical flow outputs. These rows and cols are not equivalent to input resolution.
get_nvds_buf_surface¶
- pyds.get_nvds_buf_surface(gst_buffer: int, batchID: int) numpy.ndarray ¶
This function returns the frame in NumPy format. Only RGBA format is supported. For x86_64, only unified memory is supported. For Jetson, the buffer is mapped to CPU memory. Changes to the frame image will be preserved and seen in downstream elements, with the following restrictions. 1. No change to image color format or resolution 2. No transpose operation on the array.
For Jetson, a matching call to
unmap_nvds_buf_surface()
must be made.- Parameters:
gst_buffer – address of the Gstbuffer which contains NvBufSurface
batchID – batch_id of the frame to be processed. This indicates the frame’s index within
NvBufSurface
- Returns:
NumPy array containing the frame image buffer.
get_nvds_buf_surface_gpu¶
- pyds.get_nvds_buf_surface_gpu(gst_buffer: int, batchID: int) tuple ¶
This function returns the dtype, shape of the array, strides, pointer to the GPU buffer, and size of the allocated memory for the buffer. Only x86 and RGBA format is supported. This information can be used to create a CuPy array (see deepstream-imagedata-multistream-cupy). Changes to the frame image will be preserved and seen in downstream elements, with the following restrictions. 1. No change to image color format or resolution 2. No transpose operation on the array.
- Parameters:
gst_buffer – address of the Gstbuffer which contains NvBufSurface
batchID – batch_id of the frame to be processed. This indicates the frame’s index within
NvBufSurface
- Returns:
dtype, shape, strides, pointer to buffer, size of allocated memory of the GPU buffer
unmap_nvds_buf_surface¶
- pyds.unmap_nvds_buf_surface(gst_buffer: int, batchID: int) None ¶
This function unmaps the NvBufSurface of the given Gst buffer and batch id, if previously mapped. For Jetson, a matching call to this function must be made for every call to
get_nvds_buf_surface()
.The array can no longer be accessed after this call, as the memory is released.
- Parameters:
gst_buffer – address of the Gstbuffer which contains NvBufSurface
batchID – batch_id of the frame to be processed. This indicates the frame’s index within
NvBufSurface
nvds_acquire_meta_lock¶
- pyds.nvds_acquire_meta_lock(batch_meta: pyds.NvDsBatchMeta) None ¶
Acquire the lock before updating metadata.
- Parameters:
batch_meta – An object of type
NvDsBatchMeta
nvds_release_meta_lock¶
- pyds.nvds_release_meta_lock(batch_meta: pyds.NvDsBatchMeta) None ¶
Release lock after updating metadata.
- Parameters:
batch_meta – An object of type
NvDsBatchMeta
nvds_create_batch_meta¶
- pyds.nvds_create_batch_meta(max_batch_size: int) pyds.NvDsBatchMeta ¶
Creates a
NvDsBatchMeta
of given batch size.- Parameters:
max_batch_size – maximum number of frames those can be present in the batch
- Returns:
Allocated
NvDsBatchMeta
object
nvds_destroy_batch_meta¶
- pyds.nvds_destroy_batch_meta(batch_meta: pyds.NvDsBatchMeta) int ¶
Deletes/Releases given
NvDsBatchMeta
batch_meta object.- Parameters:
batch_meta – An object of type
NvDsBatchMeta
to be deleted/destroyed after use
nvds_acquire_frame_meta_from_pool¶
- pyds.nvds_acquire_frame_meta_from_pool(batch_meta: pyds.NvDsBatchMeta) pyds.NvDsFrameMeta ¶
Acquires
NvDsFrameMeta
from frame_meta pool. User must acquire the frame_meta from frame_meta pool to fill frame metadata.- Parameters:
batch_meta – An object of type
NvDsBatchMeta
from whichNvDsFrameMeta
will be acquired- Returns:
Acquired
NvDsFrameMeta
object from frame meta pool
nvds_add_frame_meta_to_batch¶
- pyds.nvds_add_frame_meta_to_batch(batch_meta: pyds.NvDsBatchMeta, frame_meta: pyds.NvDsFrameMeta) None ¶
After acquiring and filling frame metadata, user must add it to the batch metadata with this API.
- Parameters:
batch_meta – An object of type
NvDsBatchMeta
to which frame_meta will be attached.frame_meta – An object of type
NvDsFrameMeta
acquired from frame_meta_pool present inNvDsBatchMeta
nvds_remove_frame_meta_from_batch¶
- pyds.nvds_remove_frame_meta_from_batch(batch_meta: pyds.NvDsBatchMeta, frame_meta: pyds.NvDsFrameMeta) None ¶
Removes given frame meta from the batch metadata.
- Parameters:
batch_meta – An object of type
NvDsBatchMeta
from which frame_meta is to be removed.frame_meta – A object of type
NvDsFrameMeta
to be removed from batch_meta.
nvds_acquire_obj_meta_from_pool¶
- pyds.nvds_acquire_obj_meta_from_pool(batch_meta: pyds.NvDsBatchMeta) pyds.NvDsObjectMeta ¶
Acquires
NvDsObjectMeta
from the object meta pool. User must acquire the object meta from the object meta pool to fill object metadata.- Parameters:
batch_meta – An object of type
NvDsBatchMeta
from whichNvDsObjectMeta
will be acquired- Returns:
Acquired
NvDsObjectMeta
object from object meta pool
nvds_remove_obj_meta_from_frame¶
- pyds.nvds_remove_obj_meta_from_frame(frame_meta: pyds.NvDsFrameMeta, obj_meta: pyds.NvDsObjectMeta) None ¶
Removes given object meta from the frame metadata.
- Parameters:
frame_meta – An object of type
NvDsFrameMeta
from which obj_meta is to be removed.obj_meta – An object of type
NvDsObjectMeta
to be removed from frame_meta.
nvds_acquire_classifier_meta_from_pool¶
- pyds.nvds_acquire_classifier_meta_from_pool(batch_meta: pyds.NvDsBatchMeta) pyds.NvDsClassifierMeta ¶
Acquires
NvDsClassifierMeta
from the classifier meta pool. User must acquire the classifier meta from the classifier meta pool to fill classifier metadata.- Parameters:
batch_meta – An object of type
NvDsBatchMeta
from whichNvDsClassifierMeta
will be acquired- Returns:
Acquired
NvDsClassifierMeta
object from classifier meta pool
nvds_add_classifier_meta_to_object¶
- pyds.nvds_add_classifier_meta_to_object(obj_meta: pyds.NvDsObjectMeta, classifier_meta: pyds.NvDsClassifierMeta) None ¶
After acquiring and filling classifier metadata user must add it to the object metadata with this API.
- Parameters:
obj_meta – An object of type
NvDsObjectMeta
to which classifier_meta will be attached.classifier_meta – An object of type
NvDsClassifierMeta
acquired from classifier_meta_pool present inNvDsBatchMeta
.
nvds_remove_classifier_meta_from_obj¶
- pyds.nvds_remove_classifier_meta_from_obj(obj_meta: pyds.NvDsObjectMeta, classifier_meta: pyds.NvDsClassifierMeta) None ¶
Removes given classifier meta from object metadata.
- Parameters:
obj_meta – An object of type
NvDsObjectMeta
from which classifier_meta is to be removed.classifier_meta – An object of type
NvDsClassifierMeta
to be removed from obj_meta.
nvds_acquire_display_meta_from_pool¶
- pyds.nvds_acquire_display_meta_from_pool(batch_meta: pyds.NvDsBatchMeta) pyds.NvDsDisplayMeta ¶
Acquires NvDsDisplayMeta from the display meta pool. User must acquire the display meta from the display meta pool to fill display metadata.
- Parameters:
batch_meta – An object of type
NvDsBatchMeta
from whichNvDsDisplayMeta
will be acquired.- Returns:
Acquired
NvDsDisplayMeta
object from display meta pool
nvds_add_display_meta_to_frame¶
- pyds.nvds_add_display_meta_to_frame(frame_meta: pyds.NvDsFrameMeta, display_meta: pyds.NvDsDisplayMeta) None ¶
After acquiring and filling classifier metadata user must add it to the frame metadata with this API.
- Parameters:
frame_meta – An object of type
NvDsFrameMeta
to which display_meta will be attached.display_meta – An object of type
NvDsDisplayMeta
acquired from display_meta_pool present inNvDsBatchMeta
.
nvds_remove_display_meta_from_frame¶
- pyds.nvds_remove_display_meta_from_frame(frame_meta: pyds.NvDsFrameMeta, display_meta: pyds.NvDsDisplayMeta) None ¶
Removes given display meta from frame metadata.
- Parameters:
frame_meta – An object of type
NvDsFrameMeta
from which display_meta is to be removed.display_meta – An object of type
NvDsDisplayMeta
to be removed from frame_meta.
nvds_acquire_label_info_meta_from_pool¶
- pyds.nvds_acquire_label_info_meta_from_pool(batch_meta: pyds.NvDsBatchMeta) pyds.NvDsLabelInfo ¶
Acquires
NvDsLabelInfo
from the labelinfo meta pool of givenNvDsBatchMeta
. User must acquire the labelinfo meta from the labelinfo meta pool to fill labelinfo metadata.- Parameters:
batch_meta – An object of type
NvDsBatchMeta
from whichNvDsLabelInfo
will be acquired- Returns:
An object of type
NvDsLabelInfo
object from label info meta pool
nvds_add_label_info_meta_to_classifier¶
- pyds.nvds_add_label_info_meta_to_classifier(classifier_meta: pyds.NvDsClassifierMeta, label_info_meta: pyds.NvDsLabelInfo) None ¶
After acquiring and filling labelinfo metadata user must add it to the classifier metadata with this API.
- Parameters:
classifier_meta – An object of type
NvDsClassifierMeta
to which label_info_meta will be attached.label_info_meta – An object of type
NvDsLabelInfo
acquired from label_info_meta_pool present inNvDsBatchMeta
.
nvds_remove_label_info_meta_from_classifier¶
- pyds.nvds_remove_label_info_meta_from_classifier(classifier_meta: pyds.NvDsClassifierMeta, label_info_meta: pyds.NvDsLabelInfo) None ¶
Removes given labelinfo meta from the classifier metadata
- Parameters:
classifier_meta – An object of type
NvDsClassifierMeta
from which label_info_meta is to be removed.label_info_meta – An object of type
NvDsLabelInfo
to be removed from classifier_meta.
nvds_add_user_meta_to_batch¶
- pyds.nvds_add_user_meta_to_batch(batch_meta: pyds.NvDsBatchMeta, user_meta: pyds.NvDsUserMeta) None ¶
After acquiring and filling user metadata user must add it to batch metadata if required at batch level with this API.
- Parameters:
batch_meta – An object of type
NvDsBatchMeta
to which user_meta will be attached.user_meta – An object of type
NvDsUserMeta
acquired from user_meta_pool present inNvDsBatchMeta
.
nvds_add_user_meta_to_frame¶
- pyds.nvds_add_user_meta_to_frame(frame_meta: pyds.NvDsFrameMeta, user_meta: pyds.NvDsUserMeta) None ¶
After acquiring and filling user metadata user must add it to frame metadata if required at frame level with this API.
- Parameters:
frame_meta – An object of type
NvDsFrameMeta
to which user_meta will be attached.user_meta – An object of type
NvDsUserMeta
acquired from user_meta_pool present inNvDsBatchMeta
.
nvds_add_user_meta_to_obj¶
- pyds.nvds_add_user_meta_to_obj(obj_meta: pyds.NvDsObjectMeta, user_meta: pyds.NvDsUserMeta) None ¶
After acquiring and filling user metadata user must add it to object metadata if required at object level with this API.
- Parameters:
obj_meta – An object of type
NvDsObjectMeta
to which user_meta will be attached.user_meta – An object of type
NvDsUserMeta
acquired from user_meta_pool presentNvDsBatchMeta
.
nvds_acquire_user_meta_from_pool¶
- pyds.nvds_acquire_user_meta_from_pool(batch_meta: pyds.NvDsBatchMeta) pyds.NvDsUserMeta ¶
Acquires NvDsUserMeta from the user meta pool. User must acquire the user meta from the user meta pool to fill user metadata.
- Parameters:
batch_meta – An object of type
NvDsBatchMeta
from whichNvDsUserMeta
will be acquired
nvds_remove_user_meta_from_batch¶
- pyds.nvds_remove_user_meta_from_batch(batch_meta: pyds.NvDsBatchMeta, user_meta: pyds.NvDsUserMeta) None ¶
Removes given user metadata from the batch metadata.
- Parameters:
batch_meta – An object of type
NvDsBatchMeta
from which user_meta is to be removed.user_meta – An object of type
NvDsUserMeta
to be removed from batch_meta.
- Returns:
Acquired
NvDsUserMeta
object from user meta pool
nvds_remove_user_meta_from_frame¶
- pyds.nvds_remove_user_meta_from_frame(frame_meta: pyds.NvDsFrameMeta, user_meta: pyds.NvDsUserMeta) None ¶
Removes given user metadata from the frame metadata.
- Parameters:
frame_meta – An object of type
NvDsFrameMeta
from which user_meta is to be removed.user_meta – An object of type
NvDsUserMeta
to be removed from frame_meta.
nvds_remove_user_meta_from_object¶
- pyds.nvds_remove_user_meta_from_object(obj_meta: pyds.NvDsObjectMeta, user_meta: pyds.NvDsUserMeta) None ¶
Removes given user metadata from the object metadata.
- Parameters:
obj_meta – An object of type
NvDsObjectMeta
from which user_meta s to be removed.user_meta – An object of type
NvDsUserMeta
to be removed from obj_meta.
nvds_get_current_metadata_info¶
- pyds.nvds_get_current_metadata_info(batch_meta: pyds.NvDsBatchMeta) int ¶
Debug function to get current metadata info.
- Parameters:
batch_meta – An object of type
NvDsBatchMeta
nvds_batch_meta_copy_func¶
- pyds.nvds_batch_meta_copy_func(data: capsule, user_meta: capsule) capsule ¶
Copy function to copy batch_meta. It is called when meta_data needs to copied / transformed from one buffer to other. meta_data and user_data are passed as arguments.
- Parameters:
data – An object of type
NvDsBatchMeta
user_data – An object of user specific data
- Returns:
An object that can be typecasted tot
NvDsBatchMeta
nvds_batch_meta_release_func¶
- pyds.nvds_batch_meta_release_func(data: capsule, user_data: capsule) None ¶
batch_meta release function called when meta_data is going to be released.
- Parameters:
data – An object of type
NvDsBatchMeta
user_data – An object of user specific data
nvds_get_nth_frame_meta¶
- pyds.nvds_get_nth_frame_meta(frame_meta_list: pyds.GList, index: int) pyds.NvDsFrameMeta ¶
Retrieve the
NvDsFrameMeta
object of the frame at index.- Parameters:
frame_meta_list – A list of objects of type
NvDsFrameMeta
index – index at which
NvDsFrameMeta
object needs to be accessed.
- Returns:
An object of type
NvDsFrameMeta
from frame_meta_list
nvds_clear_frame_meta_list¶
nvds_clear_obj_meta_list¶
- pyds.nvds_clear_obj_meta_list(frame_meta: pyds.NvDsFrameMeta, meta_list: pyds.GList) None ¶
Removes all the object metadata present in the frame metadata.
- Parameters:
frame_meta – An object of type
NvDsFrameMeta
from whichNvDsObjectMetaList
needs to be clearedmeta_list – An object of type
NvDsObjectMetaList
which needs to be cleared
nvds_clear_display_meta_list¶
- pyds.nvds_clear_display_meta_list(frame_meta: pyds.NvDsFrameMeta, meta_list: pyds.GList) None ¶
Removes all the display metadata present in the frame metadata.
- Parameters:
frame_meta – An object of type
NvDsFrameMeta
from whichNvDisplayMetaList
needs to be clearedmeta_list – An object of type
NvDisplayMetaList
which needs to be cleared
nvds_clear_batch_user_meta_list¶
- pyds.nvds_clear_batch_user_meta_list(batch_meta: pyds.NvDsBatchMeta, meta_list: pyds.GList) None ¶
Removes all the user metadata present in the batch metadata
- Parameters:
batch_meta – An object of type
NvDsBatchMeta
from whichNvDsUserMetaList
needs to be clearedmeta_list – An object of type
NvDsUserMetaList
which needs to be cleared
nvds_clear_frame_user_meta_list¶
- pyds.nvds_clear_frame_user_meta_list(frame_meta: pyds.NvDsFrameMeta, meta_list: pyds.GList) None ¶
Removes all the user metadata present in the frame metadata
- Parameters:
frame_meta – An object of type
NvDsFrameMeta
from whichNvDsUserMetaList
needs to be clearedmeta_list – An object of type
NvDsUserMetaList
which needs to be cleared
nvds_clear_obj_user_meta_list¶
- pyds.nvds_clear_obj_user_meta_list(object_meta: pyds.NvDsObjectMeta, meta_list: pyds.GList) None ¶
Removes all the user metadata present in the object metadata
- Parameters:
object_meta – An object of type
NvDsObjectMeta
from whichNvDsUserMetaList
needs to be clearedmeta_list – An object of type
NvDsUserMetaList
which needs to be cleared
nvds_clear_meta_list¶
- pyds.nvds_clear_meta_list(batch_meta: pyds.NvDsBatchMeta, meta_list: pyds.GList, meta_pool: pyds.NvDsMetaPool) pyds.GList ¶
Removes all the metadata elements present in the given metadata list
- Parameters:
batch_meta – An object of type
NvDsBatchMeta
meta_list – An object of type
NvDsMetaList
which needs to be clearedmeta_pool – An object of type
NvDsMetaPool
to which list belongs to
- Returns:
An object of updated meta list
nvds_copy_batch_user_meta_list¶
- pyds.nvds_copy_batch_user_meta_list(src_user_meta_list: pyds.GList, dst_batch_meta: pyds.NvDsBatchMeta) None ¶
Deep copy of src_user_meta_list to user meta list present in the dst_batch_meta.
- Parameters:
src_user_meta_list – An obect of type
NvDsUserMetaList
dst_batch_meta – An object of type
NvDsBatchMeta
nvds_copy_frame_user_meta_list¶
- pyds.nvds_copy_frame_user_meta_list(src_user_meta_list: pyds.GList, dst_frame_meta: pyds.NvDsFrameMeta) None ¶
Deep copy of src_user_meta_list to user meta list present in the dst_frame_meta.
- Parameters:
src_user_meta_list – An object of type
NvDsUserMetaList
dst_frame_meta – An object of type
NvDsFrameMeta
nvds_copy_display_meta_list¶
- pyds.nvds_copy_display_meta_list(src_display_meta: pyds.GList, dst_frame_meta: pyds.NvDsFrameMeta) None ¶
Deep copy of src_display_meta_list to display meta list present in the dst_frame_meta.
- Parameters:
src_display_meta_list – An object of type
NvDisplayMetaList
dst_frame_meta – An object of type
NvDsFrameMeta
nvds_copy_frame_meta_list¶
- pyds.nvds_copy_frame_meta_list(src_frame_meta_list: pyds.GList, dst_batch_meta: pyds.NvDsBatchMeta) None ¶
Deep copy of src_frame_meta_list to frame meta list present in the dst_batch_meta.
- Parameters:
src_frame_meta_list – An object of type
NvDsFrameMetaList
dst_batch_meta – An object of type
NvDsBatchMeta
nvds_get_user_meta_type¶
- pyds.nvds_get_user_meta_type(meta_descriptor: str) int ¶
Generates a unique user metadata type from the given string describing user specific metadata.
- Parameters:
meta_descriptor – A string object describing metadata.
- The format of the string should be specified as below:
ORG_NAME.COMPONENT_NAME.METADATA_DESCRIPTION.
e.g. (NVIDIA.NVINFER.TENSOR_METADATA)
nvds_copy_obj_meta_list¶
- pyds.nvds_copy_obj_meta_list(src_obj_meta_list: pyds.GList, dst_object_meta: pyds.NvDsFrameMeta) None ¶
Deep copy of src_obj_meta_list to frame meta list present in the dst_frame_meta.
- Parameters:
src_obj_meta_list – An object of type
NvDsObjectMetaList
dst_frame_meta – An object of type
NvDsFrameMeta
nvds_get_user_meta_type¶
- pyds.nvds_get_user_meta_type(meta_descriptor: str) int ¶
Generates a unique user metadata type from the given string describing user specific metadata.
- Parameters:
meta_descriptor – A string object describing metadata.
- The format of the string should be specified as below:
ORG_NAME.COMPONENT_NAME.METADATA_DESCRIPTION.
e.g. (NVIDIA.NVINFER.TENSOR_METADATA)
gst_buffer_add_nvds_meta¶
- pyds.gst_buffer_add_nvds_meta(buffer: _GstBuffer, meta_data: capsule, user_data: capsule, copy_func: void* (void*, void*), release_func: void (void*, void*)) _NvDsMeta ¶
Adds GstMeta of type
NvDsMeta
to the GstBuffer and sets the meta_data member ofNvDsMeta
.- Parameters:
buffer – GstBuffer to which the function adds metadata.
meta_data – The object to which the function sets the meta_data member of
NvDsMeta
.user_data – A user specific data object
copy_func – The NvDsMetaCopyFunc function to be called when NvDsMeta is to be copied. The function is called with meta_data and user_data as parameters. NvDsMeta is to be destroyed. The function is called with meta_data and user_data as parameters.
- Returns:
An object to the attached
NvDsMeta
object; or NONE in case failure
gst_buffer_get_nvds_batch_meta¶
- pyds.gst_buffer_get_nvds_batch_meta(buffer: int) pyds.NvDsBatchMeta ¶
Gets the
NvDsBatchMeta
added to the GstBuffer.- Parameters:
buffer – GstBuffer from which to retrieve the
NvDsBatchMeta
- Returns:
NvDsBatchMeta
object retrieved from the buffer
For example:
batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
user_copyfunc¶
- pyds.user_copyfunc(meta: pyds.NvDsUserMeta, func: Callable[[capsule, capsule], capsule]) None ¶
Set copy callback function of given
NvDsUserMeta
object.- Parameters:
meta –
NvDsUserMeta
of which to set copy functionfunc – User-written copy function
user_releasefunc¶
- pyds.user_releasefunc(meta: pyds.NvDsUserMeta, func: Callable[[capsule, capsule], None]) None ¶
Set release callback function of given
NvDsUserMeta
object.- Parameters:
meta –
NvDsUserMeta
of which to set release functionfunc – User-written release function
alloc_buffer¶
- pyds.alloc_buffer(size: int) int ¶
Allocate buffer of given size.
- Parameters:
size – Size of memory to be allocated
- Returns:
C address of allocated buffer
free_buffer¶
- pyds.free_buffer(buffer: int) None ¶
Frees memory of given buffer.
- Parameters:
buffer – C address of the buffer to be freed
free_gbuffer¶
- pyds.free_gbuffer(buffer: capsule) None ¶
Frees memory of given gbuffer.
- Parameters:
buffer – gpointer to the buffer to be freed
get_string¶
- pyds.get_string(ptr: int) str ¶
Cast given pointer to string.
- Parameters:
ptr – C address of the string
- Returns:
Reference to the string object
get_ptr¶
- pyds.get_ptr(ptr: capsule) int ¶
Gets the C address of given object.
- Parameters:
ptr – Object of which to retrieve C address “pointer”
- Returns:
C address of given data
alloc_nvds_vehicle_object¶
- pyds.alloc_nvds_vehicle_object() pyds.NvDsVehicleObject ¶
Allocate an
NvDsVehicleObject
.- Returns:
Allocated
NvDsVehicleObject
alloc_nvds_person_object¶
- pyds.alloc_nvds_person_object() pyds.NvDsPersonObject ¶
Allocate an
NvDsPersonObject
.- Returns:
Allocated
NvDsPersonObject
alloc_nvds_face_object¶
- pyds.alloc_nvds_face_object() pyds.NvDsFaceObject ¶
Allocate an
NvDsFaceObject
.- Returns:
Allocated
NvDsFaceObject
alloc_nvds_event_msg_meta¶
- pyds.alloc_nvds_event_msg_meta(arg0: pyds.NvDsUserMeta) pyds.NvDsEventMsgMeta ¶
Allocate an
NvDsEventMsgMeta
.- Parameters:
user_meta – An object of type
NvDsUserMeta
acquired from user_meta_pool present inNvDsBatchMeta
- Returns:
Allocated
NvDsEventMsgMeta
alloc_nvds_event¶
- pyds.alloc_nvds_event() pyds.NvDsEvent ¶
Allocate an
NvDsEvent
.- Returns:
Allocated
NvDsEvent
generate_ts_rfc3339¶
- pyds.generate_ts_rfc3339(buffer: int, size: int) None ¶
Generate RFC3339 timestamp.
- Parameters:
buffer – Buffer into which timestamp content is copied
size – Maximum timestamp length
alloc_nvds_payload¶
- pyds.alloc_nvds_payload() pyds.NvDsPayload ¶
Allocate an
NvDsPayload
.- Returns:
Allocated
NvDsPayload
NvBufSurfaceCreate¶
- pyds.NvBufSurfaceCreate(surf: NvBufSurface, batchSize: int, params: NvBufSurfaceCreateParams) int ¶
Allocate batch of buffers.
Allocates memory for batchSize buffers and returns in surf object allocated
NvBufSurface
. params object should have allocation parameters of single object. If size field in params is set, buffer of that size will be allocated and all other parameters (w, h, color format etc.) will be ignored.Use
NvBufSurfaceDestroy()
to free all the resources.- Parameters:
surf – pointer to allocated batched buffers.
batchSize – batch size of buffers.
params – pointer to
NvBufSurfaceCreateParams
structure.
- Returns:
0 for success, -1 for failure.
NvBufSurfaceDestroy¶
- pyds.NvBufSurfaceDestroy(surf: NvBufSurface) int ¶
Free the batched buffers previously allocated through NvBufSurfaceCreate.
- Parameters:
surf – An object to
NvBufSurface
to free.- Returns:
0 for success, -1 for failure.
NvBufSurfaceMap¶
- pyds.NvBufSurfaceMap(surf: NvBufSurface, index: int, plane: int, type: NvBufSurfaceMemMapFlags) int ¶
Map HW batched buffers to HOST CPU address space.
Valid for NVBUF_MEM_CUDA_UNIFIED type of memory for dGPU and NVBUF_MEM_SURFACE_ARRAY and NVBUF_MEM_HANDLE type of memory for Jetson.
This function will fill addr array of
NvBufSurfaceMappedAddr
field ofNvBufSurfaceParams
with the CPU mapped memory pointers.The client must call
NvBufSurfaceSyncForCpu()
with the virtual address populated by this function before accessing the mapped memory in CPU.- After memory mapping is complete, mapped memory modification must be coordinated between the CPU and hardware device as follows:
CPU: If the CPU modifies any mapped memory, the client must call
NvBufSurfaceSyncForDevice()
before any hardware device accesses the memory.Hardware device: If the mapped memory is modified by any hardware device, the client must call
NvBufSurfaceSyncForCpu()
before CPU accesses the memory.
Use
NvBufSurfaceUnMap()
to unmap buffer(s) and release any resource.- Parameters:
surf – pointer to
NvBufSurface
structure.index – index of buffer in the batch. -1 for all buffers in batch.
plane – index of plane in buffer. -1 for all planes in buffer.
type – flag for mapping type.
- Returns:
0 for success, -1 for failure.
NvBufSurfaceUnMap¶
- pyds.NvBufSurfaceUnMap(surf: NvBufSurface, index: int, plane: int) int ¶
Unmap the previously mapped buffer(s).
- Parameters:
surf – pointer to
NvBufSurface
structure.index – index of buffer in the batch. -1 for all buffers in batch.
plane – index of plane in buffer. -1 for all planes in buffer.
- Returns:
0 for success, -1 for failure.
NvBufSurfaceCopy¶
- pyds.NvBufSurfaceCopy(srcSurf: NvBufSurface, dstSurf: NvBufSurface) int ¶
Copy the memory content of source batched buffer(s) to memory of destination batched buffer(s).
This function can be used to copy source buffer(s) of one memory type to destination buffer(s) of different memory type. e.g. CUDA Host to CUDA Device or malloced memory to CUDA device etc.
Both source and destination
NvBufSurface
must have same buffer and batch size.- Parameters:
srcSurf – pointer to source
NvBufSurface
structure.dstSurf – pointer to destination
NvBufSurface
structure.
- Returns:
0 for success, -1 for failure.
NvBufSurfaceSyncForCpu¶
- pyds.NvBufSurfaceSyncForCpu(surf: NvBufSurface, index: int, plane: int) int ¶
Syncs the HW memory cache for the CPU.
Valid only for NVBUF_MEM_SURFACE_ARRAY and NVBUF_MEM_HANDLE memory types.
- Parameters:
surf – pointer to
NvBufSurface
structure.index – index of buffer in the batch. -1 for all buffers in batch.
plane – index of plane in buffer. -1 for all planes in buffer.
- Returns:
0 for success, -1 for failure.
NvBufSurfaceSyncForDevice¶
- pyds.NvBufSurfaceSyncForDevice(surf: NvBufSurface, index: int, plane: int) int ¶
Syncs the HW memory cache for the device.
Valid only for NVBUF_MEM_SURFACE_ARRAY and NVBUF_MEM_HANDLE memory types.
- Parameters:
surf – pointer to
NvBufSurface
structure.index – index of buffer in the batch. -1 for all buffers in batch.
plane – index of plane in buffer. -1 for all planes in buffer.
- Returns:
0 for success, -1 for failure.
NvBufSurfaceFromFd¶
- pyds.NvBufSurfaceFromFd(dmabuf: int, buffer: capsule) int ¶
Get the
NvBufSurface
from the dmabuf fd.- Parameters:
dmabuf_fd – dmabuf fd of the buffer.
buffer – pointer to
NvBufSurface
.
- Returns:
0 for success, -1 for failure.
NvBufSurfaceMemSet¶
- pyds.NvBufSurfaceMemSet(surf: NvBufSurface, index: int, plane: int, value: int) int ¶
Fill each byte of buffer(s) in
NvBufSurface
with provided value.This function can also be used to reset the buffer(s) in the batch.
- Parameters:
surf – pointer to
NvBufSurface
structure.index – index of buffer in the batch. -1 for all buffers in batch.
plane – index of plane in buffer. -1 for all planes in buffer.
value – value to be set.
- Returns:
0 for success, -1 for failure.
NvBufSurfaceMapEglImage¶
- pyds.NvBufSurfaceMapEglImage(surf: NvBufSurface, index: int) int ¶
Creates an EGLImage from memory of
NvBufSurface
buffer(s).Only memory type NVBUF_MEM_SURFACE_ARRAY is supported. This function will set eglImage pointer of
NvBufSurfaceMappedAddr
field ofNvBufSurfaceParams
with EGLImageKHR.This function can be used in scenarios where CUDA operation on Jetson HW memory (NVBUF_MEM_SURFACE_ARRAY) is required. EGLImageKHR provided by this function can then be register with CUDA for further CUDA operations.
- Parameters:
surf – pointer to NvBufSurface structure.
index – index of buffer in the batch. -1 for all buffers in batch.
- Returns:
0 for success, -1 for failure.
nvds_measure_buffer_latency¶
- pyds.nvds_measure_buffer_latency(gst_buffer: int) int ¶
Measures the latency of all frames present in the current batch.
- Parameters:
buffer – GstBuffer from which to retrieve the
NvDsBatchMeta
- Returns:
sources number in batch.
Example usage:
#enable pipeline latency measurement export NVDS_ENABLE_LATENCY_MEASUREMENT=1 #enable compoment latency measurement export NVDS_ENABLE_COMPONENT_LATENCY_MEASUREMENT=1 #add this code in plugin probe function. num_sources_in_batch = pyds.nvds_measure_buffer_latency(hash(gst_buffer));
nvds_obj_enc_create_context¶
- pyds.nvds_obj_enc_create_context(arg0: int) int ¶
Create context and return a handle to NvObjEncCtx.
- Parameters:
gpu_id – gpu id.
- Returns:
handle to NvObjEncCtx.
nvds_obj_enc_process¶
- pyds.nvds_obj_enc_process(ctx: int, args: _NvDsObjEncUsrArgs, gst_buffer: int, obj_meta: pyds.NvDsObjectMeta, frame_meta: pyds.NvDsFrameMeta) bool ¶
Enqueue an object crop for JPEG encode. This is a non-blocking call and user should call nvds_obj_enc_finish() to make sure all enqueued object crops have been processed.
- Parameters:
context – handle to NvObjEncCtx.
args – An object of type
NvDsObjEncUsrArgs
.buffer – GstBuffer from which to retrieve the
NvBufSurface
obj_meta – An object of type
NvDsOjbectMeta
.frame_meta – An object of type
NvDsFrameMeta
.
- Returns:
0 for success, -1 for failure.
nvds_obj_enc_finish¶
- pyds.nvds_obj_enc_finish(ctx: int) None ¶
Wait for all enqueued crops to be encoded.
- Parameters:
context – handle to NvObjEncCtx.
nvds_obj_enc_destroy_context¶
- pyds.nvds_obj_enc_destroy_context(ctx: int) None ¶
Destroy NvObjEncCtx context.
- Parameters:
context – handle to NvObjEncCtx.