Machine Learning With Raspberry Pi





Introduction: Machine Learning With Raspberry Pi


This is my first Instructable and moreover my English is not good. So please don't mind if it is not well written.


Deep learning is a new hot topic in the area of Machine Learning, that shows promising results to achieve artificial intelligence. These days we hear a lot about Machine Learning algorithms from big companies like Google and facebook. But recently a startup called Jetpac brought an iphone app that makes even lay person to use Machine learning. Now the same startup has ported their Deep Learning algorithm called Deep Belief to Raspberry Pi. Although, Pete Warden, the CTO of Jetpac, has given instructions on Github, there are some small changes required to adopt to install it on Raspberry Pi. Therefore, I am writing this instructable.

Step 1: Allocating RAM to GPU

This deep belief software requires, at least 128 MB of RAM. In order to allocate that memory, edit the config file of Pi, by using the following command.


sudo nano /boot/config.txt


Add the following line at the end of the file




Now reboot the Pi.


sudo reboot


In case. if you did not install git before, install it


sudo apt-get install git


Step 2: Install Deep Belief Image Recognition SDK on Raspberry Pi

Now we can install the Deep Belief SDK, by following the below instructions


git clone

cd DeepBeliefSDK/RaspberryPiLibrary

sudo ./


Step 3:

Inorder to check whether it is installed correctly or not, follow the below instructions:


cd ../examples/SimpleLinux/


sudo ./deepbelief


That should give the following out put


0.016994 wool

0.016418 cardigan

0.010924 kimono

0.010713 miniskirt

0.014307 crayfish

0.015663 brassiere

0.014216 harp

0.017052 sandal

0.024082 holster

0.013580 velvet

0.057286 bonnet

0.018848 stole

0.028298 maillot

0.010915 gown

0.073035 wig

0.012413 hand blower

0.031052 stage

0.027875 umbrella

0.012592 sarong


This is basically telling that the algorithm is analyzing the default image in the library and giving the probability of it being sarong and umbrella. This algorithm is very useful in robotics. I am trying to implement this on my Raspberry Pi Robot soon. You can find more details on my blog.


Pete Warden



    • Epilog Challenge 9

      Epilog Challenge 9
    • Paper Contest 2018

      Paper Contest 2018
    • Pro Tips Challenge

      Pro Tips Challenge

    We have a be nice policy.
    Please be positive and constructive.




    Hi, great instructable !

    I followed all the instructions but when I entered “sudo ./deepbelief” for the last command it gave me the error,

    “Can’t open device file: /var/lib/jpcnn/char_dev”.

    Any assistance on how to fix it would be greatly appreciated!

    cd ~/DeepBeliefSDK/source/src/lib/pi/
    vi mailbox.cpp
    (change #define MAJOR_NUM 100 to #define MAJOR_NUM 249) / save
    sudo rm -rf /var/lib/jpcnn/
    cd ~/DeepBeliefSDK/source/
    make clean
    make TARGET=pi2
    sudo cp /usr/lib/
    sudo cp src/include/libjpcnn.h /usr/include/
    cd ~/DeepBeliefSDK/examples/SimpleLinux/
    sudo ./deepbelief

    Hi, nice set of directions; I'm falling into a different hole; when making the SimpleLinux directory for the "deepbelief" executable, I get the error:

    /usr/lib/ file not recognized: File format not recognized

    Seems to be ELF 64-bit library, not the 32-bit for the other libraries. Any ideas??


    I have the same issue as posted below/above. I'm using a fresh copy of Raspbian and a Pi 3. Please advise.