Object Detection Module

Classes

class  AI_MODELS
 Lists available AI models. More...
 
class  OBJECT_DETECTION_MODEL
 Lists available models for the object detection module. More...
 
class  OBJECT_FILTERING_MODE
 Lists supported bounding box preprocessing. More...
 
class  OBJECT_ACCELERATION_PRESET
 Lists supported presets for maximum acceleration allowed for a given tracked object. More...
 
class  OBJECT_CLASS
 Lists available object classes. More...
 
class  OBJECT_SUBCLASS
 List available object subclasses. More...
 
class  OBJECT_TRACKING_STATE
 Lists the different states of object tracking. More...
 
class  OBJECT_ACTION_STATE
 Lists the different states of an object's actions. More...
 
class  ObjectData
 Class containing data of a detected object such as its bounding_box, label, id and its 3D position. More...
 
class  CustomBoxObjectData
 Class that store externally detected objects. More...
 
class  CustomMaskObjectData
 Class storing externally detected objects. More...
 
class  ObjectsBatch
 Class containing batched data of a detected objects from the object detection module. More...
 
class  Objects
 Class containing the results of the object detection module. More...
 
class  BatchParameters
 Class containing a set of parameters for batch object detection. More...
 
class  ObjectDetectionParameters
 Class containing a set of parameters for the object detection module. More...
 
class  ObjectTrackingParameters
 Class containing tracking parameters for object detection. More...
 
class  ObjectDetectionRuntimeParameters
 Class containing a set of runtime parameters for the object detection module. More...
 
class  ObjectTrackingParametersProxy
 Class containing a set of runtime properties of a certain class ID for the object detection module using a custom model. More...
 
class  CustomObjectDetectionRuntimeParameters
 Class containing a set of runtime parameters for the object detection module using your own model ran by the SDK. More...
 

Functions

def generate_unique_id ()
 Generate a UUID like unique id to help identify and track AI detections.
 
def optimize_custom_ai_model (str custom_onnx_file, Resolution custom_onnx_dynamic_input_shape=Resolution(512, 512), int, gpu_id=0)
 Optimizes a custom object detection model ahead of time, so that Camera.enable_object_detection() can start using it right away. More...
 

Function Documentation

◆ optimize_custom_ai_model()

def pyzed.sl.optimize_custom_ai_model ( str  custom_onnx_file,
Resolution   custom_onnx_dynamic_input_shape = Resolution(512, 512),
  int,
  gpu_id = 0 
)

Optimizes a custom object detection model ahead of time, so that Camera.enable_object_detection() can start using it right away.

This optimizes the given ONNX file exactly as Camera.enable_object_detection() does when ObjectDetectionParameters.detection_model is set to OBJECT_DETECTION_MODEL.CUSTOM_YOLOLIKE_BOX_OBJECTS, OBJECT_DETECTION_MODEL.CUSTOM_RFDETRLIKE_BOX_OBJECTS or OBJECT_DETECTION_MODEL.CUSTOM_BOX_OBJECTS_AUTODETECT, and saves the result for re-use. Optimizing a model can take several minutes, so this is meant to be called once when installing or deploying your application, rather than on its critical path.

Parameters
custom_onnx_file: Path to the ONNX file to optimize. Use the same value as ObjectDetectionParameters.custom_onnx_file.
custom_onnx_dynamic_input_shape: Input resolution to optimize the model for. Use the same value as ObjectDetectionParameters.custom_onnx_dynamic_input_shape, otherwise the optimized model cannot be re-used and the model is optimized again at runtime.
gpu_id: ID of the GPU on which the model will run. The optimized model is specific to it.
Returns
sl.ERROR_CODE.SUCCESS if the model is optimized and ready to be used.
sl.ERROR_CODE.INVALID_FUNCTION_PARAMETERS if no ONNX file was given, or if it cannot be found.
Note
A model with a fixed input resolution keeps its own: custom_onnx_dynamic_input_shape is then only used to identify the optimized model.

Referenced by InitParametersOne.set_from_holoscan_port().