Enhancing CNN Performance on Raspberry Pi 4 Model B

Hi everyone,

I’m facing a performance issue with my Raspberry Pi 4 Model B (4GB, 64-bit, Legacy OS). I’m running a Convolutional Neural Network (CNN) for my graduation project, and while the model runs, the results are very laggy and not processed in real-time. For example, there’s a noticeable delay of around 10 seconds, causing it to skip frames.

I need advice on how to enhance the performance. Would buying an AI accelerator be a good solution? If so, which one would you recommend? Are there any software optimizations I should consider to improve speed?

Any help would be greatly appreciated!

Hey @Rafa288102,

Would you be able to tell us more about the CNN you are using and how it is running on the Pi?

It’s a bit hard to tell how to improve its performance without a good idea of the exact software you are running but with more information we should be able to help out! :slight_smile:

Hey Rafa,

Just on the option of using the HAT:

The AI HAT will definitely run faster, but it’s not as simple as writing a line of code to do the processing on the HAT. The AI HAT has to have the model converted to its specific format (.HEF) to run the model. This is quite a process and not every model can be converted so before looking at using the HAT, check out the process of converting it to the needed format and see if it’s feasible for your Project.

The HAT is also not compatible with the Pi 4, it uses a PCIe connector which is only on the Pi 5.

A Pi 5 may also be another option, we found it to be 2-3 times faster when it comes to processing.