Skip to content
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

Re-open IP-camera videostream if disconnected #5074

Merged
merged 3 commits into from
Oct 8, 2021

Conversation

EgOrlukha
Copy link
Contributor

@EgOrlukha EgOrlukha commented Oct 7, 2021

Streaming from IP-cameras via rtsp was freezing when signal lost. I added an option to re-open cv2.Videocapture in case of video-stream disconnection.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Enhanced error handling for unresponsive video streams in YOLOv5.

📊 Key Changes

  • The update function in utils/datasets.py now takes an additional stream parameter.
  • Improved error reporting with a warning message if a video stream is unresponsive.
  • Added functionality to attempt to re-open the video stream automatically if the connection is lost.

🎯 Purpose & Impact

  • Helps users to debug issues with IP camera connections by printing a warning when a video feed is lost.
  • Increases robustness by trying to reconnect to the video stream, potentially reducing interruptions during stream processing.
  • Facilitates continuity in video frame capture for YOLOv5, which is crucial for applications that rely on consistent real-time video analysis. 💪📹🔄

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Hello @EgOrlukha, thank you for submitting a 🚀 PR! To allow your work to be integrated as seamlessly as possible, we advise you to:

  • ✅ Verify your PR is up-to-date with origin/master. If your PR is behind origin/master an automatic GitHub actions rebase may be attempted by including the /rebase command in a comment body, or by running the following code, replacing 'feature' with the name of your local branch:
git remote add upstream https://github.com/ultralytics/yolov5.git
git fetch upstream
git checkout feature  # <----- replace 'feature' with local branch name
git merge upstream/master
git push -u origin -f
  • ✅ Verify all Continuous Integration (CI) checks are passing.
  • ✅ Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." -Bruce Lee

@glenn-jocher
Copy link
Member

@EgOrlukha this seems really useful, thanks for the PR!

Have you been able to see some streams reconnect when they drop due to the PR code?

@glenn-jocher glenn-jocher changed the title Re-open IP-camera videostream if disconnected. Re-open IP-camera videostream if disconnected Oct 8, 2021
@glenn-jocher glenn-jocher merged commit 48b00db into ultralytics:master Oct 8, 2021
@glenn-jocher
Copy link
Member

@EgOrlukha PR is merged. Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐

@EgOrlukha
Copy link
Contributor Author

@EgOrlukha this seems really useful, thanks for the PR!

Have you been able to see some streams reconnect when they drop due to the PR code?

@glenn-jocher Yes, I changed the code for my needs and it works stable even if a videostream is lost for some reason. These are OpenCV issues, I just re-open cv2.Videocapture() in case it was disconnected.

@glenn-jocher
Copy link
Member

@EgOrlukha great, good to know!

BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* Re-open IP-camera videostream if disconnected. Provide IP-streaming analysis stability

* Re-open IP-camera videostream if disconnected. Provide IP-streaming analysis stability

* `self.imgs[i] *= 0` bug fix and cleanup

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants