Skip to content

Commit

Permalink
LoadStreams() frame loss bug fix (#2222)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Feb 15, 2021
1 parent 3ff783c commit 7b833e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ def update(self, index, cap):
# _, self.imgs[index] = cap.read()
cap.grab()
if n == 4: # read every 4th frame
_, self.imgs[index] = cap.retrieve()
success, im = cap.retrieve()
self.imgs[index] = im if success else self.imgs[index] * 0
n = 0
time.sleep(0.01) # wait time

Expand Down

0 comments on commit 7b833e3

Please sign in to comment.