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

workaround when reading broken video frames #5726

Closed

Conversation

breunigs
Copy link

@breunigs breunigs commented Nov 19, 2021

Some videos are being read with additional fake/broken frames that may
cause an unexpected early exit. This attempts to skip over these broken
frames if more were expected, based on the initally acquired frame
count.

According to other reports upstream, the number of broken frames read
varies. To avoid getting stuck in an endless loop, e.g. when the video
is actually broken, this gives up after 1000 reads.

see #2064
see opencv/opencv#15352

πŸ› οΈ PR Summary

Made with ❀️ by Ultralytics Actions

🌟 Summary

Improving video stream handling in YOLOv5's dataset utility.

πŸ“Š Key Changes

  • Added a check to see if a video frame is not received despite the video not having ended.
  • Attempt to skip up to 1000 frames if a frame is not properly read, rather than failing immediately.
  • Raise an exception with a helpful error message linking to an existing GitHub issue if video reading issues persist.

🎯 Purpose & Impact

  • πŸ› οΈ Prevents premature video stream interruption: Helps to ensure that video streams are processed entirely, only raising an error if frames continue to be unreadable.
  • πŸ”„ Introduces retries for reading frames: Decreases the likelihood of an entire video stream failing due to intermittent read errors.
  • πŸ“š Provides better error information: Users encountering video stream issues will have a reference to a GitHub issue for more context and potential solutions.

The changes should make YOLOv5 more robust in handling video data, leading to a smoother user experience and less time troubleshooting video input issues.

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 @breunigs, 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 upstream/master. If your PR is behind upstream/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

@breunigs breunigs marked this pull request as ready for review November 19, 2021 21:01
@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions YOLOv5 πŸš€ and Vision AI ⭐.

Some videos are being read with additional fake/broken frames that may
cause an unexpected early exit. This attempts to skip over these broken
frames if more were expected, based on the initally acquired frame
count.

According to other reports upstream, the number of broken frames read
varies. To avoid getting stuck in an endless loop, e.g. when the video
is actually broken, this gives up after 1000 reads.

see ultralytics#2064
see opencv/opencv#15352
@breunigs
Copy link
Author

oops! I might've force-pushed over your changes after manual rebase. There were no real conflicts as far as I could tell, though.

@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions YOLOv5 πŸš€ and Vision AI ⭐.

@github-actions github-actions bot added the Stale label Jan 23, 2022
@github-actions github-actions bot closed this Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants