MVIG-SJTU / AlphaPose

Real-Time and Accurate Full-Body Multi-Person Pose Estimation&Tracking System
http://mvig.org/research/alphapose.html
Other
8.06k stars 1.98k forks source link

Inaccurate datalen value in DetectionLoader class #1131

Open danekpilar01 opened 1 year ago

danekpilar01 commented 1 year ago

I was trying to use the model on some .mp4 videos. For most of them, it worked perfectly, but there was one video, that always got stuck at 99% of completion. I tried it many times, but always got the same result. When I interrupted the process (when it was stuck at 99%), I found out that the script was waiting for some data in the queue in the DetectionLoader class, in method image_postprocess. It could never get the data because there weren't any. The problem was most certainly with the value of self.datalen in the mentioned DetectionLoader class. Its value is the result of cv2.CAP_PROP_FRAME_COUNT, which is not always accurate, for example, when some of the frames in the video are corrupted. That was probably the case with my video, because the difference between the number of frames that could be read and value of self.datalen was 4 frames. More about this problem here. So replacing this approach with a safer method could prevent similar problems. Only thing, that I came up with, was reading every frame from the VideoCapture and incrementing a counter, which obviously doesn't seem like the best approach, but it fixed my problem.

https://github.com/MVIG-SJTU/AlphaPose/blob/c60106d19afb443e964df6f06ed1842962f5f1f7/alphapose/utils/detector.py#L30