Question about SDK's object detection model and custom detection model


I’m using the ZED sdk 4.0 and apparently it’s possible to use The ZED SDK’s object detection model with a user-defined custom object detection model at the same time.

My question is whether the Custom Detector and the ZED object detection model should run in a separate thread or whether it is sufficient, as shown here, if only one thread is created where the appropriate functions (e.g. zed.retrieve_objects) are called twice (for custom model and SDK’s model), with the corresponding instance_module_id etc.

Hi @JoeHhuio98
it is not required to have two different threads unless you use the asynchronous mode.

When I run the program either only with the SDK object detection or only with the custom detection, it works and the detections and tracking are shown correctly in both cases. But as soon as I create two (different) instance_model_id for the two detectors and enable both detectors with zed.enable_object_detection(...) and I pass the instance_model_id in zed.retrieve_objects(), only the detections from the SDK object detection are displayed and nothing is shown regarding the costum detector. When I set the image_sync parameter to False, I get the following output: async mode not compatible with external custom model.

Hi @JoeHhuio98
the SDK team is checking the problem to provide a fix if it’s caused by a behavior of the ZED SDK.
Please keep the post updated if you find anything relevant.

EDIT: It works well now with two threads. However, it does not work via one thread in my case (see the error async mode not compatible with external custom model from my last post). Thanks for support.

1 Like

It may not have been the case for you, but while investigating this issue I could replicate a similar behavior. I simply forgot to specify the instance_id in ingestCustomBoxObjects function, defaulting to instance_id 0. It was not the first instance and therefore outputting sl::ERROR_CORE::INVALID_FUNCTION_CALL (silently if not explicitly checked), and the retrieve_objects was empty.