Enabling optimization options for Raspberry Pi 3 with OpenCV 4.0.0

asked 2018-11-20 22:12:30 -0600

charlesrwest gravatar image

Hello!

I'm trying to get my ONNX based neural net working on the Raspberry Pi 3 with OpenCV's DNN module (which I love, by the way). The issue I am running into is that 4.0.0 on the master branch and the head on the 3.4 branch are the only versions which have an ONNX loader which can load my model, but I am not able to build these with the RPi specific options.

If I just build normal release with 4.0.0, the squeezenet reference code from this tutorial (https://www.pyimagesearch.com/2017/10...) takes 1.6 seconds per frame.

However, if I build the master branch's 3.4.1 with the optimizations from this guide (http://www.ebenezertechs.com/optimizi...), that time drops to .33 seconds per frame.

The crux of the issue is that the library seems to have moved to a more advanced cmake build system which tests and sets properties in a more advance way (which unfortunately doesn't seem to be picking up the optimizations I need). It really needs to add the GCC options -mcpu=cortex-a53 -mfpu=neon-fp-armv8 when it is building, but it doesn't seem to pick up on that. At the same time, the old tricks to add those flags don't seem to be working anymore.

If I may ask, does anyone know how I could get the tricks from (http://www.ebenezertechs.com/optimizi...) to work with 4.0.0? Alternatively, do you know how to add extra compiler flags without the new cmake setup ignoring them?

Thanks.

edit retag flag offensive close merge delete