I encountered a bug where demo_inference.py sometimes was stuck for a few videos (usually at 99%).
It looks like this can happen because det_loader.length is not always accurate. It uses int(stream.get(cv2.CAP_PROP_FRAME_COUNT)) but CAP_PROP_FRAME_COUNT might not be accurate. So DetectionLoader can get stuck at det_loader.read() when the underlying queue.Queue is empty.
I think you can "reproduce" this e.g. by setting data_len = det_loader.length + 15 for any video.
For now I fixed this by replacing DetectionLoader with a patched class
class MyDetectionLoader(DetectionLoader):
def read(self):
# raises queue.Empty Exception after timeout!
return self.pose_queue.get(timeout=5)
I encountered a bug where
demo_inference.py
sometimes was stuck for a few videos (usually at 99%).It looks like this can happen because
det_loader.length
is not always accurate. It usesint(stream.get(cv2.CAP_PROP_FRAME_COUNT))
butCAP_PROP_FRAME_COUNT
might not be accurate. SoDetectionLoader
can get stuck atdet_loader.read()
when the underlyingqueue.Queue
is empty.I think you can "reproduce" this e.g. by setting
data_len = det_loader.length + 15
for any video.For now I fixed this by replacing
DetectionLoader
with a patched classand catching the possible exception
but there is probably a better way to handle this
(I'm also using the `--sp`` flag)