Skip to content

detect.py crashed with multiple video sources specified in list.treams #13607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 2 tasks
regall00 opened this issue May 27, 2025 · 3 comments
Open
1 of 2 tasks
Labels
bug Something isn't working detect Object Detection issues, PR's

Comments

@regall00
Copy link

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

No response

Bug

I run detect.py with single/multiple video sources: perfectly works with single video, failed with 2+ video sources. Could you please help to debug? Thank you

-----------cmd:
python3 ./detect.py --weight yolov5s.pt --source list.streams --nosave

-----------list.streams
/yolov5/videos/video1.mp4
/yolov5/videos/video1_cloned.mp4

----------- Log
0: 384x640 4 persons, 3 suitcases, 1 chair, 1 tv, 1: 384x640 3 persons, 1 dog, 1 chair, 2 tvs, 23.2ms
0: 384x640 5 persons, 3 suitcases, 1 chair, 1 tv, 1: 384x640 3 persons, 1 chair, 2 tvs, 23.3ms
0: 384x640 5 persons, 4 suitcases, 1 chair, 1 tv, 1: 384x640 3 persons, 1 chair, 1 tv, 23.4ms
0: 384x640 4 persons, 5 suitcases, 1 chair, 1 tv, 1: 384x640 3 persons, 1 chair, 1 tv, 23.1ms
WARNING ⚠️ Video stream unresponsive, please check your IP camera connection.
0: 384x640 5 persons, 4 suitcases, 1 chair, 1 tv, 1 cell phone, 1: 384x640 3 persons, 1 chair, 1 tv, 23.2ms
0: 384x640 1: 384x640 3 persons, 1 chair, 23.7ms
Speed: 0.8ms pre-process, 13.5ms inference, 3.4ms NMS per image at shape (1, 3, 640, 640)
FATAL: exception not rethrown
Fatal Python error: Aborted

Thread 0x0000ffff99e06ca0 (most recent call first):

Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, torch._C, torch._C._fft, torch._C._linalg, torch._C._nested, torch._C._nn, torch._C._sparse,
...,
scipy.stats._mvn, scipy.stats._rcont.rcont, scipy.ndimage._nd_image, scipy.ndimage._rank_filter_1d, _ni_label, scipy.ndimage._ni_label, scipy.cluster._vq, scipy.cluster._hierarchy, scipy.cluster._optimal_leaf_ordering (total: 157)
Aborted (core dumped)

Environment

  • YOLO: YOLOv5 🚀 2025-5-27 Python-3.10.12 torch-2.2.0 CUDA:0 (Orin, 62841MiB)
  • OS: Ubuntu 22.04.4 LTS
  • Python: Python 3.10.12

Minimal Reproducible Example

#### file: list.streams
/yolov5/videos/video1.mp4

#### cmd:
python3 ./detect.py --weight yolov5s.pt --source list.streams --nosave

#### file: list.streams
/yolov5/videos/video1.mp4
/yolov5/videos/video1_cloned.mp4

#### cmd:
python3 ./detect.py --weight yolov5s.pt --source list.streams --nosave

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@regall00 regall00 added the bug Something isn't working label May 27, 2025
@UltralyticsAssistant UltralyticsAssistant added the detect Object Detection issues, PR's label May 27, 2025
@UltralyticsAssistant
Copy link
Member

👋 Hello @regall00, thank you for reporting this issue with YOLOv5 🚀! This is an automated response to help you get the most relevant support as quickly as possible. An Ultralytics engineer will also review your report and assist you soon.

If this is a 🐛 Bug Report, please ensure you have provided a minimum reproducible example (MRE). From your description and logs, it looks like you've included the key files and commands—thank you! If you can further narrow down the problem or provide any additional error output, it would be helpful.

To help us debug and assist you more efficiently, please also verify:

Quickstart

git clone https://github.com/ultralytics/yolov5  # clone
cd yolov5
pip install -r requirements.txt  # install

Verified Environments

YOLOv5 can be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python, and PyTorch preinstalled):

Status

YOLOv5 CI
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

For more information, please check our Tutorials, including guides for Custom Data Training and Hyperparameter Evolution.

Thank you for your detailed report and for helping to improve YOLOv5! 🛠️

@pderrenger
Copy link
Member

The crash with multiple video sources appears to be related to memory or threading issues when processing concurrent video streams. Please ensure you're using the latest YOLOv5 version by running git pull or reinstalling with pip install -U ultralytics.

You can try these workarounds: reduce the image size with --imgsz 320, limit threads with --max-det 100, or process videos sequentially by running detect.py separately for each video source instead of using the list.streams file.

@regall00
Copy link
Author

I suspect that the crash is not due to concurrent situation, but threads are not cleanly ended/handled: error happens when finishing read one video, the other video still has frames to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working detect Object Detection issues, PR's
Projects
None yet
Development

No branches or pull requests

3 participants