I am trying to get Theano to run with Keras on a Raspberry Pi 3 (B) without success. I tried Ubuntu MATE and Raspbian as operating systems, without success. To install Theano and Keras, I have taken following steps:
pip
and apt-get
The aforementioned steps work without any issues. In the next step, I built a little test script (test.py) which loads an already built model via
from keras.models import load_model model = load_model('model.hdf5')
When the model is being loaded, I get the following error
Segmentation fault (core dumped)
Then I tried to investigate the issue further, following this answer on SO (What causes a Python segmentation fault?):
gdb python > run test.py
When I run this I get:
Program received SIGSEV, Segmentation fault. 0x76fd9822 in ?? () from /lib/ld-linux-armhf.so.3
In the next step I ran in the gdb shell:
> backtrace
and got
#0 0x76fd9822 in ?? () from /lib/ld-linux-armhf.so.3 #1 0x76fd983a in ?? () from /lib/ld-linux-armhf.so.3
this is the point where I don't know any further and I would like to ask, if anyone could point me into a direction on how to fix this issue and get keras + theano to run on a Raspberry Pi.
(I have also tried TensorFlow as an alternative, but getting the same issue)
Thanks a lot.
EDIT
I have done some more investigations. If I run Keras with TensorFlow the problem seems to change a little bit. I ran gdb again, but the error happens now in numpy, especially in libopenblas.so.0
Program received signal SIGSEV, Segmentation fault. 0x75ead7cc in inner_thread() from /home/<path>/numpy/core/../../../../libopenblas.so.0
Does this help?
EDIT 2
I have installed everything without using Miniconda and Keras works now with TensorFlow (but not with Theano yet).
Configure your Raspberry Pi for deep learning. Install Keras and TensorFlow on your Raspberry Pi. Deploy a pre-trained Convolutional Neural Network (with Keras) to your Raspberry Pi. Perform a given action once a positive detection has occurred.
Being the fact that Keras runs on the top of Keras. You need to install TensorFlow first. After typing this command, you will see many functions executing. Tensorboard, termcolor, numpy, wheel, etc are the functions that will be executed.
If you had provided the version of python it would have been useful. If you are using python3.7 try reverting back to python3.6 because keras has not yet caught up to the development and there are a lot of problems installing tensorflow with keras on python3.7. I am putting emphasis on version here because I recently faced same problem installing using conda and I realised the issue was python version.
But I also had problems getting tensorflow to work on PI. But I used direct installation using pip from ubuntu and not miniconda and it worked. The way that Google Tensorflow team itself mentions is best is to actually build tensorflow from source by following instructions from this link. https://www.tensorflow.org/install/source_rpi
So try to downgrade the version of python to 3.6 or less if you can and try to install using pip or build from source using python3.6 or 3.7.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With