aisingapore / PeekingDuck

A modular framework built to simplify Computer Vision inference workloads.
Apache License 2.0
163 stars 39 forks source link

[h264 @ 0x25313bb0] error while decoding MB 17 16, bytestream -10 #739

Closed Markos-Vasalos closed 1 year ago

Markos-Vasalos commented 1 year ago

I was trying to use yolox-m model on a raspberry pi with a 64bit raspbian OS (headless) and aarch64 architecture.

Unfortunately I receive these errors ([h264 @ 0x25313bb0] error while decoding MB 17 16, bytestream -10) and almost always after 6 minutes the script terminates with an exception.

I haven't faced the same issue with v4tiny model or yolox-tiny

Any ideas why?

Below I am attaching the script I run along with the logs with the error

script_and_logs.zip

gao-hongnan commented 1 year ago

Hi Markos, this seems like an out-of-memory (OOM) issue. You can use htop command to monitor memory.

Markos-Vasalos commented 1 year ago

Hello Gao!

Unfortunately this is not the issue.

I am attaching here a link with a zip file that contains two videos.

  1. Is the script run in real time along with htop metrics for the yolox-m model ( the same script i've posted above) with the name yolox_m_memory_reproduce.mp4
  2. The second one is the same script in real time but with the yolo v4 model. I've used it because this is the one that can deplete the memory and does not produce a similar error. This file is the yolo_v4_memory_reproduce.mp4

As you can see in the videos also, the system memory when using the yolox-m model doesn't exceed 525MB (total available memory is 3.9GB) while the yolo v4 model consumed it all and as a result the process gets killed from the OS.

Hope it helps!

https://drive.google.com/file/d/1ZmHf6GaXpDBsMiRwVYOf4kn4TOpzp8m2/view?usp=share_link

liyier90 commented 1 year ago

Hi @Markos-Vasalos , looking at the logs, it appears the program is killed because the frame passed in to the model is not a Numpy array. We initially suspected that an OOM issue may have caused a cv2.VideoCapture decoding error.

Could you please verfiy the type and the dimensions of frame returned by camera.read()? If the type is None then perhaps a connectivity issue is causing the decoding error. You can then try to either double check the connection to your video feeds or implement a try/except or if/else feature to skip these invalid frames.

Markos-Vasalos commented 1 year ago

Hello @liyier90

In the video using the yolo v4 model version, the program was killed because it maxed out all of the available memory in the Raspberry pi (all 3.9GB). Not due to problematic frame. At least that's what I saw with htop.

In the second one (the one using the yolox-m model) I started checking the type and indeed after almost 6 - 7 minutes of running the script, my cameras, one by one (i'm using 5) started giving me non nupmy array frames. And also the result variable that VideoCapture returns (along with frame) was false as well, which means it wasn't able to take the frame successfully.

I'm puzzled as why this happens. When I just change the model to yolo v4tiny this doesn't happen. With the exact same code. As soon as I change this to yolox-m I get unsuccessful frames from VideoCapture and almost always after 6-7 minutes but without changing anything else regarding connection of cameras, etc... how can this be? :-/ Also after monitoring with htop (as in the videos i've posted above) I can't believe that this is an OutOfMemory issue, since the yolox-m only consumes 529MB from totaly 3.9GB available. Any ideas? Any suggestion would be highly appreciated.

Markos-Vasalos commented 1 year ago

Actually I've found a workaround. Every time I get an invalid frame, I reconnect all the cameras and the script continues to work. But again that happens every 6-7 minutes when using yolox-m model compared to v4tiny without any changes in the code or the hardware setup of the ip cameras. I'm attaching the updated script here:

yoloxErrorReproduceUpdated.txt

liyier90 commented 1 year ago

Hi @Markos-Vasalos , I tried your updated script with the following url: rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4 but was unable to reproduce your error; the warning message about updating camera rtsp did not show up.

May I know if you are able to trigger the error on a publicly available rtsp stream so I can try and reproduce the error on my device?

Markos-Vasalos commented 1 year ago

I've tried various links myself but couldn't reproduce it as well. Maybe it's indeed a connection issue with my specific rtsp cameras or something specific in my setup. I'm just curious why it was happening with yolox-m model every time at around 6 minutes while with v4 tiny might have happened once every few days.

Nonetheless since this is not a reproduceable issue and might affect only my setup you may close the issue if nothing else is pending.