The problem of using ‘custom detector’ module with python, the 'Zed Object Detection' window is blank

Hi,
I am trying to use the ‘custom detector’ module in zed-examples/tutorials/tutorial 6 - object detection/ as shown in [zed-examples/tutorials/tutorial 6 - object detection at master · stereolabs/zed-examples · GitHub]
There are two windows, one is the birds view, which shows the 2D image of the left eye. It works well while another one called ‘Zed Object Detection’ window is blank, as follows:


This window is used to show the point cloud and I guess if it’s caused by the problem of OpenGL. The terminal shows:
UserWarning: A NumPy version >=1.16.5 and <1.23.0 is required for this version of SciPy (detected version 1.24.2 warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at …/aten/src/ATen/native/TensorShape.cpp:2894.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
QObject::moveToThread: Current thread (0x56519a0afbe0) is not the object’s thread (0x565191cceab0).
Cannot move to target thread (0x56519a0afbe0)

I wonder what can I do to solve this problem.By the way, I tried the ‘image viewer’ module with python(object_detection_image_viewer.py). It worked well and can detect person. So, I am also doubt that my detection of the other class(trepang) may cause this problem. Also, the YOLOv5 works well and can detect the class of trepang.

I look forward your help and reply, thank you!

Hi,

We provide a custom detector sample that show you how to input custom detections into ZED SDK : zed-examples/object detection/custom detector/python/pytorch_yolov5 at master · stereolabs/zed-examples · GitHub

You should probably start from there instead of the tutorial 6. You can also check out the documentation : Using the Object Detection API with a Custom Detector | Stereolabs

Antoine

I also see that you have an error that relates to threading. Please note that python threading is kind of tricky to use, because of the GIL (What Is the Python Global Interpreter Lock (GIL)? – Real Python)
You should avoid using threads in python because one of them can very easily block the others.

Thank you for your reply. Honestly, I did try the way of zed examples and the picture showed the problem I came across. You metioned the problem of the threading, but I didn’t do any change in the program and I just used the program in the link you provide.
[zed-examples/object detection/custom detector/python/pytorch_yolov5 at master · stereolabs/zed-examples · GitHub]

Hi,

Can you try this from stackoverflow ? qt - How to fix the error "QObject::moveToThread:" in opencv in python? - Stack Overflow