H7 Plus fps + memory issues

Hello :slight_smile:
Once again we (my project partners and I) come to you desperate for help :smiley:

MicroPython: v1.13-r60 OpenMV: v3.9.1 HAL: v1.9.0 BOARD: OPENMV4P-STM32H743

Our scenario is that we are running a video stream (ovcer WiFi shield) off of the H7 Plus, using the example code pretty much. However, we need to do several other things in the same loop due to multithreading not being possible. Those things are checking for MQTT messages, sending UART signals and checking a GPIO pin. If we do everything but the camera stream, everything is fine, however once the camera stream is added, the whole thing crashes with memory allocation errors:
Screenshot 2021-01-27 12.24.29.png
We tried some stuff with periodic garbage collector calls ( gc.collect() ), not sure if that is even the issue though. Also tried micropython-lib alternatives for the mqtt side of things, but couldn’t get past various syntax errors.

Furthermore, our performance seems to be a bit low overall, even when just using the basic camera stream script (mjpeg streamer) with these settings:


cframe = frame.compressed(quality=10)

Which doesn’t exactly provide HD images (see attachment) and still only averages 13-14 fps (as read out by the script):
Screenshot 2021-01-27 124028.png
We’re aware that the speed is reduced when the camera is connected to the IDE, but still that seems low for these settings. With extremely lowered settings (QQVGA), we haven’t been able to get more than 27fps, whilst running nothing else. Should this be the case, even over the IDE?

Also there any adivce on how we could get rid of our memory issues? This has us scratching our heads, for weeks now :smiley:

Appreciate any help,

Hi, I’ll be adding double buffering to the camera driver soon. This will massive boost the FPS beyond 2x for your application.

As for the memory allocation issue. The amount you want allocated seems like -1 was passed to the allocator. What line of code is throwing that error?

Hello, thank you for your response :slight_smile:

That is great news. :slight_smile: However am I correct with my understanding that this means the currect fps are as expected and we have no means of improving them by ourselves? (Asking, because this project needs to get done soon. We are considering moving the other functionality to a Raspberry Pi and just using the camera as a camera, but that would be a shame.)

If I’m reading this right, and am looking at the correct mqtt.py, it should be this line:

msg = self.sock.read(sz)

Screenshot 2021-01-27 201825.png
I’m not sure why any memory allocation would be happening at that particular point though.

Thanks and regards,

The read buffer size variable size is being passed a negative number which is being interpreted as a positive value. So, check how “sz” is generated and check if it’s actually an error value.

As for the triple buffer stuff. Don’t make any decisions based on us getting the feature out. Once it hits our product will become a lot better. But, I can’t say when that will happen.