# Sample code execution crashes on error

**URL:** <https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524>\
**Category:** Python\
**Tags:** jetson\
**Created:** [July 26, 2025, 7:19am UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524 "2025-07-26T07:19:41Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![izidorg](https://community.stereolabs.com/user_avatar/community.stereolabs.com/izidorg/32/569_2.png) [@izidorg](https://community.stereolabs.com/u/izidorg)\
**Post date:** [July 26, 2025, 7:19am UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/1 "2025-07-26T07:19:41Z")

</div>

Setup:  
SDK: ZED\_SDK\_Tegra\_L4T36.4\_v5.0.4.zstd  
HW: Jetson AGX Orin development kit  
source file: /usr/local/zed/samples/camera control/python/  
execution script: python camera\_control.py  
Jet Pack: 6.2

/usr/local/zed/samples/camera control/python/camera\_control.py", line 75, in main  
if err \<= sl.ERROR\_CODE.SUCCESS:

TypeError: ‘\<=’ not supported between instances of ‘ERROR\_CODE’ and ‘ERROR\_CODE’

Note:  
The same error can be observed in /usr/local/zed/samples/object detection/custom detector/python/pytorch\_yolov8\_seg/detector.py source line 193, in main\_  
if zed.grab(runtime\_params) \<= sl.ERROR\_CODE.SUCCESS

---

<div class="post-metadata">

**Author:** ![LuckyJ](https://community.stereolabs.com/user_avatar/community.stereolabs.com/luckyj/32/4631_2.png) [@LuckyJ](https://community.stereolabs.com/u/LuckyJ)\
**Post date:** [July 28, 2025, 1:55pm UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/2 "2025-07-28T13:55:15Z")

</div>

Hi @izidorg,

Thank you for the report!

It seems that we are missing some operators implementation (`<`, `<=`, `>` and `>=`) and they will be added in the next patch.

In the meantime, you can replace `<=` with `==`

```auto
if err == sl.ERROR_CODE.SUCCESS:

```

Be aware that doing so (using a `==`), your sample will not continue on WARNING-level `grab` results (negative `ERROR_CODE`). While actually, a WARNING-level `grab` could happen when the image degradation detected by `enable_image_validity_check` occur but the ZED SDK remains functional.

I’ll let you know once `5.0.5` gets released and that you can use `<=` instead 🙂

* * *

Please let us know if you encounter any other related issues or have further questions!

---

<div class="post-metadata">

**Author:** ![izidorg](https://community.stereolabs.com/user_avatar/community.stereolabs.com/izidorg/32/569_2.png) [@izidorg](https://community.stereolabs.com/u/izidorg)\
**Post date:** [July 29, 2025, 5:55am UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/3 "2025-07-29T05:55:44Z")

</div>

Hi @LuckyJ,

Thank you for the update.  
The fix resolved the TypeError: ‘\<=’ not supported between instances of ‘ERROR\_CODE’ and ‘ERROR\_CODE’.  
However, the detector.py script execution freezes after:  
SUCCESS  
Network Initialized…  
and nothing happens; no errors or warnings are displayed.  
Pls. Note that, in the meantime, I’ve updated the Torch and TorchVision binaries, which execute object detection in under 30ms.  
I’m in a rush now, and I will update the camera\_control.py file later today.

---

<div class="post-metadata">

**Author:** ![LuckyJ](https://community.stereolabs.com/user_avatar/community.stereolabs.com/luckyj/32/4631_2.png) [@LuckyJ](https://community.stereolabs.com/u/LuckyJ)\
**Post date:** [July 29, 2025, 7:21am UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/4 "2025-07-29T07:21:51Z")

</div>

Hi @izidorg,

For us to be able to efficiently support you, can you provide:

1. The output of `ZEDDiagnostic` to ensure everything is fine with your installation.
2. Meaningfull log information and confirming the setup you are working with (since you are using Python, please also share relevant package versions).
3. The exact steps and script you’re using to reproduce the issue.

With these details, we’ll be able to provide more targeted feedback and help you resolve the problem faster.

Thanks!

---

<div class="post-metadata">

**Author:** ![LuckyJ](https://community.stereolabs.com/user_avatar/community.stereolabs.com/luckyj/32/4631_2.png) [@LuckyJ](https://community.stereolabs.com/u/LuckyJ)\
**Post date:** [July 29, 2025, 9:19am UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/5 "2025-07-29T09:19:05Z")

</div>

Hi again @izidorg,

> [@izidorg](#):
>
> /usr/local/zed/samples/camera control/python/camera\_control.py", line 75, in main  
> if err \<= sl.ERROR\_CODE.SUCCESS:
> 
> TypeError: ‘\<=’ not supported between instances of ‘ERROR\_CODE’ and ‘ERROR\_CODE’

We’ve released 5.0.5 a few minutes ago (cf our website [ZED SDK 5.0 - Download | Stereolabs](https://www.stereolabs.com/en-fr/developers/release/5.0#505-b1c25d6cde63b9ff6afa80f4e2d1fc33) and our github [Release ZED SDK 5.0.5 · stereolabs/zed-sdk · GitHub](https://github.com/stereolabs/zed-sdk/releases/tag/5.0.5)).

It contains the fix of the bug you reported

---

<div class="post-metadata">

**Author:** ![izidorg](https://community.stereolabs.com/user_avatar/community.stereolabs.com/izidorg/32/569_2.png) [@izidorg](https://community.stereolabs.com/u/izidorg)\
**Post date:** [July 30, 2025, 5:59am UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/6 "2025-07-30T05:59:43Z")

</div>

Hi @LuckyJ ,  
Thank you for the update!

Some good news, some new issues/recommendations were observed:  
Good news 👏: ZED SDK 5.0.5 resolves the TypeError: ‘\<=’ not supported between instances of ‘ERROR\_CODE’ and ‘ERROR\_CODE’.

New issues:

1. Objects are detected but wrongly displayed in the widow.  
 ![Screenshot from 2025-07-30 08-18-33](https://community.stereolabs.com/uploads/default/original/2X/7/720206fc5b99083d4f66127213c23fb4b9458c30.jpeg)
2. There were occasions where opencv had to be uninstall and reinstalled in order to properly display the GUI. (I believe this is an old phenomena related to the Linux distributions).
3. Ultalytics and NVIDIA both recommend use of pip install more effective torch/torchvision binaries combination, which reduce detection in less than 30msec obviously faster zed app execution as of today of about 80-90msec taken by Yolo + ZED detector overhead, but the default numpy version 2.2.6 shall be downgraded to numpy 1.23.5. Related wheels are torch-2.5.0a0+872d972e41.nv24.08-cp310-cp310-linux\_aarch64.whl  
torchvision-0.20.0a0+afc54f7-cp310-cp310-linux\_aarch64.whl  
reference link: [Quick Start Guide: NVIDIA Jetson with Ultralytics YOLO11](https://docs.ultralytics.com/guides/nvidia-jetson/#install-pytorch-and-torchvision)
4. (detector.py script execution instructions) yoloV11 gets installed by default, the ZED README.md suggests yolov8s-seg.pt rather than for example: yolo11n-seg.pt.

---

<div class="post-metadata">

**Author:** ![LuckyJ](https://community.stereolabs.com/user_avatar/community.stereolabs.com/luckyj/32/4631_2.png) [@LuckyJ](https://community.stereolabs.com/u/LuckyJ)\
**Post date:** [July 30, 2025, 6:58am UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/7 "2025-07-30T06:58:04Z")

</div>

Hi @izidorg,

Thank you for the feedback!  
Nice to read that your first issue is solved 👏

To better track follow-ups issues and help future users find solution to there problem (if you have more), it would be a good practice to create a new forum post

* * *

> [@izidorg](#):
>
> 1. Objects are detected but wrongly displayed in the widow.  
> ![Screenshot from 2025-07-30 08-18-33](https://community.stereolabs.com/uploads/default/original/2X/7/720206fc5b99083d4f66127213c23fb4b9458c30.jpeg)

Could you detail what you mean by “_wrongly displayed_”? Looking at the windows, I guess you are using the sample [zed-sdk/object detection/custom detector/python/pytorch\_yolov8\_seg at master · stereolabs/zed-sdk · GitHub](https://github.com/stereolabs/zed-sdk/tree/master/object%20detection/custom%20detector/python/pytorch_yolov8_seg). It uses a model external to the SDK (e.g. yolov8-seg) and ingests its detection into the SDK.

- On the left you can see the 2D detection with the detected objects and the associated masks
- On the right you can see the BEV of the tracked objects, for demo purposes. You can press `I` / `O` to zoom in and out in this view. Now that I’m looking at it, we didn’t write display the possible commands in this sample (we’ll add that in a following release)

* * *

> [@izidorg](#):
>
> 1. There were occasions where opencv had to be uninstall and reinstalled in order to properly display the GUI. (I believe this is an old phenomena related to the Linux distributions).

Good to know! If you face the issue again, feel free to log the steps so that we can smooth the installation process for others. OpenCV 4.10 is known to have issue with the `cv2.imshow` but it’s the first time I read something about uninstalling and re-installing.

* * *

> [@izidorg](#):
>
> 1. Ultalytics and NVIDIA both recommend use of pip install more effective torch/torchvision binaries combination, which reduce detection in less than 30msec obviously faster zed app execution as of today of about 80-90msec taken by Yolo + ZED detector overhead, but the default numpy version 2.2.6 shall be downgraded to numpy 1.23.5. Related wheels are torch-2.5.0a0+872d972e41.nv24.08-cp310-cp310-linux\_aarch64.whl  
> torchvision-0.20.0a0+afc54f7-cp310-cp310-linux\_aarch64.whl  
> reference link: [Quick Start Guide: NVIDIA Jetson with Ultralytics YOLO11](https://docs.ultralytics.com/guides/nvidia-jetson/#install-pytorch-and-torchvision)

I’ve installed `python -m pip install torch==2.5.0 torchvision==0.20.0` and had no conflicts with `numpy 2.x`. The command `python -c "import numpy; print(numpy. __version__ )"` shows `2.2.6` and the sample runs without issue.

But **if you want to use a combination of wheels requiring `numpy 1.x` and want to use `pyzed`** , I guess a solution would be to downgrade your python version to 3.8, since our 3.8 wheels are compiled against `numpy 1.x`.

**For performance improvements** using external inference and the ZED SDK, I’d suggest to have a look at the sample [zed-sdk/object detection/custom detector/python/pytorch\_yolov8\_async at master · stereolabs/zed-sdk · GitHub](https://github.com/stereolabs/zed-sdk/tree/master/object%20detection/custom%20detector/python/pytorch_yolov8_async) where we showcase how to run asynchronously external inference and the ZED SDK.  
If you only need to run OD, no instance segmentation and your custom model is a YOLO-like model, I’d suggest to have a look at the sample [zed-sdk/object detection/custom detector/python/yolov5-v6-v8\_onnx\_internal at master · stereolabs/zed-sdk · GitHub](https://github.com/stereolabs/zed-sdk/tree/master/object%20detection/custom%20detector/python/yolov5-v6-v8_onnx_internal) where we showcase how to pass a `onnx` file to the ZED SDK and let it being optimized and ran internally (we’ll handle the asynchronism and optimization internally)

* * *

> [@izidorg](#):
>
> 1. (detector.py script execution instructions) yoloV11 gets installed by default, the ZED README.md suggests yolov8s-seg.pt rather than for example: yolo11n-seg.pt.

Here [zed-sdk/object detection/custom detector/python/pytorch\_yolov8\_seg/detector.py at master · stereolabs/zed-sdk · GitHub](https://github.com/stereolabs/zed-sdk/blob/master/object%20detection/custom%20detector/python/pytorch_yolov8_seg/detector.py#L244) we take as a default `v8m`, but feel free to change it to e.g. `v11n` by doing `python3 detector.py --weights yolo11n-seg.pt`

* * *

Please let us know if you encounter any other related issues or have further questions!

---

<div class="post-metadata">

**Author:** ![izidorg](https://community.stereolabs.com/user_avatar/community.stereolabs.com/izidorg/32/569_2.png) [@izidorg](https://community.stereolabs.com/u/izidorg)\
**Post date:** [July 31, 2025, 6:16am UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/8 "2025-07-31T06:16:04Z")

</div>

Hi @LuckyJ ,  
Thank you for the update.

1. _wrongly displayed_: I was expected to see the CLASS ID or CLASS NAME of the detected object based on yolov8/11 pretrained dataset, as it was in all previous releases. The both releases “ZED sdk” and “Ultralytics YoloV8/11” are baselines for my development project in which from time-to-time I’m doing catch-ups test and verification of the baseline. BTW, I’m using the copy of sample folders at /usr/local/zed/samples… Please find a screen copy of my project. You can observe that in each detected object I’m using CLASS ID designated by “o” and distance to object designated by “d” and location of the object designated by “c”, where the data of CLASS ID and distance are provided by the modified detector.py design of ZED SDK releases. In the below particular screenshot there were detected CLASS IDs as following: 63 for laptop, 62 for tv, 66 for keyboard, 41 for cup and 0 for person as referenced in [A list of all 80 YOLO classes and its index in JSON format. · GitHub](https://gist.github.com/rcland12/dc48e1963268ff98c8b2c4543e7a9be8)

 ![ZED 2D View and Birds View_screenshot_31.07.2025](https://community.stereolabs.com/uploads/default/original/2X/7/7b9b8ad3cac3e19e37a34a4e2a14f826c737eb13.jpeg)

1. I can not remember the details of GTK-related error which was displayed in CLI , and was resolved by work-around uninstall/reinstall OpenCV. I will update in a new issue with all the related details when it will occur next time.
2. pip install ultralytics command also installs torch and torchvision binaries if they are not installed, and they are compatible with numpy 2.2.6 and they do not conflict with the current official SDK release. On the other hand, during the runtime execution, these binaries are less efficient (80msec vs 30msec) than the recommended ones by NVIDIA and Utralytics releases of JetPack 6.2 and YoloV8/11 for Jetson Orin sdk/modules. Please be noticed, In the efficiency of the runtime execution I rely on already optimised pre-trained dataset and torch/torvision binaries.

---

<div class="post-metadata">

**Author:** ![izidorg](https://community.stereolabs.com/user_avatar/community.stereolabs.com/izidorg/32/569_2.png) [@izidorg](https://community.stereolabs.com/u/izidorg)\
**Post date:** [August 11, 2025, 6:50pm UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/9 "2025-08-11T18:50:04Z")

</div>

I will check on next stable release, meanwhile I will close this conversation.

---

<div class="post-metadata">

**Author:** ![izidorg](https://community.stereolabs.com/user_avatar/community.stereolabs.com/izidorg/32/569_2.png) [@izidorg](https://community.stereolabs.com/u/izidorg)\
**Post date:** [August 15, 2025, 7:24am UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/10 "2025-08-15T07:24:33Z")

</div>

Hello @LuckyJ ,

This may give some more clue where the issue is located.

I’ve re-flashed the board from scratch and used the released sample script in …/pytorch\_yolov8/detector.py, which produced an expected result. I wander if the problem is related to the sdk sample code of the object segmentation detection script …/pytorch\_yolov8\_seg/detector.py. I have used ZED\_SDK\_Tegra\_L4T36.4\_v5.0.5.zstd.run

 ![Screenshot from 2025-08-15 10-06-32](https://community.stereolabs.com/uploads/default/original/2X/5/5379348f471b055aec7c5ac039d7f8af4afecfe7.jpeg)

---

<div class="post-metadata">

**Author:** ![LuckyJ](https://community.stereolabs.com/user_avatar/community.stereolabs.com/luckyj/32/4631_2.png) [@LuckyJ](https://community.stereolabs.com/u/LuckyJ)\
**Post date:** [August 18, 2025, 10:06am UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/11 "2025-08-18T10:06:05Z")

</div>

Hello @izidorg,

Thank you for getting back to us!

I understand now the remaining visualization issue that you are describing:

- the `pytorch_yolov8_seg` displays:
  - the _tracking ID_
  - the _name_ of the detected object (unknown since it’s a custom model and the ZED SDK has no knowledge about what it represents)
  - the _distance_

- while the `pytorch_yolov8` displays:
  - the _class idx_ (an integer)
  - the _distance_

We’ll uniform that in the next release, by having as before the class idx + the distance and still add the track id when the tracking is enabled.

In the meantime, **If you want to replace the `UNKNOWN` with class idx in the `pytorch_yolov8_seg` sample** , you can replace `str(obj.label)` with `f"class {obj.raw_label}"` in [pytorch\_yolov8\_seg/cv\_viewer/tracking\_viewer.py#L127](https://github.com/stereolabs/zed-sdk/blob/master/object%20detection/custom%20detector/python/pytorch_yolov8_seg/cv_viewer/tracking_viewer.py#L127).

---

<div class="post-metadata">

**Author:** ![izidorg](https://community.stereolabs.com/user_avatar/community.stereolabs.com/izidorg/32/569_2.png) [@izidorg](https://community.stereolabs.com/u/izidorg)\
**Post date:** [September 2, 2025, 11:46am UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/12 "2025-09-02T11:46:36Z")

</div>

Hi, Thank you! Will get back soon with my verification on the above.

---

<div class="post-metadata">

**Author:** ![izidorg](https://community.stereolabs.com/user_avatar/community.stereolabs.com/izidorg/32/569_2.png) [@izidorg](https://community.stereolabs.com/u/izidorg)\
**Post date:** [September 4, 2025, 2:41pm UTC](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/14 "2025-09-04T14:41:49Z")

</div>

Hello [LuckyJ](https://community.stereolabs.com/t/sample-code-execution-crashes-on-error/9524/11)

This is it! The fix worked as expected!!!

Thank you very much for the help.

Best Regards,

Izidor

 ![Screenshot from 2025-09-04 17-38-37](https://community.stereolabs.com/uploads/default/original/2X/1/11f5e54384f5576bebe02238ff0887722bd0741a.jpeg)
