Tested on:RPi3, Raspbian Jessie, Python 2
Prerequisites:Raspberry Pi with Raspbian Jessie and internet connection (see steps 1-7 in the Introduction)
Internet connection
Hardware:Raspberry Pi camera module

DeepDream on the Raspberry Pi 3 with Raspbian Jessie

DeepDream is a Google software that makes an pattern detection algorithm overinterpret patterns.
The result are beautiful hallucinations like the one below. DeepDream can be run on the Raspberry Pi 3
and Raspbian Jessie; find out how in this tutorial. Special thanks to the users chinlock and Ralf, who gave very good tips in their comments!

Setup the camera
Attach the camera and enable it with

(see tutorial camera module for more info on the camera module)

Install the dependencies
Open a terminal, then enter all of this. Yes, this will take a while…

Install caffe

In the now open file, replace the lines


Save, then enter in the terminal

and add at the end of the file the line

Protobuf installation
Enter in the terminal

In the now-open .bashrc add at the end of the file

Save, then type in the terminal

(google_test produces some errors, but runs through)

Boot the Raspberry Pi into the terminal (the graphical Desktop would take too much RAM), then install and run the PsyCam by entering

This will make a single snapshot. Add a -c and the camera will make snapshots repeatedly.

camera module tutorial: http://www.knight-of-pi.org/raspberry-pi-camera-and-night-vision-with-pinoir
DeepDream Wiki: https://en.wikipedia.org/wiki/DeepDream

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.


  1. How can I use deep dream on a raspberry pi without a camera? I should be able to manually supply an image.

    • Hi,

      you simply have to enter
      python psycam.py -i FILE.jpg
      to create a dream from FILE.jpg

  2. When I put this ” ./scripts/download_model_binary.py models/bvlc_googlenet ” in the terminal it tells me that there is no module named yaml.

    Any ideas how to fix that??

    • Hi,
      that repository had some permanence issues, so retrying might help.
      On the other hand, you could try my new installer which i made for the MagPi:
      (page 58)

  3. Any chance in heck that Deep Dream or PsyCam can run on a Zero W? The form factor of the Zero W with the official red/white case (w/ camera-friendly lid) is fantastic for photography projects, so DD/PsyCam would be awesome for it. I know they were compatible with RPi 2, but the Zero W’s specs are just below that. Is it worth spending a day trying to give it a shot, or is it just wasted energy?

    • I’m pretty sure it would be wasted energy! DD runs barely on a Raspberry Pi 2, and even on the RPi3 it only allows low image sizes.
      But you could flatten a Pi3 by desoldering the GPIO and the other connectors…

      • I figured it was probably a pipe dream! Thanks for the response!

        • You’re welcome!
          Btw, major problem is the RAM. Lesser CPU would just mean more computation time, but the RAM just crashes for bigger image sizes. In one of my earlier tutorials about deepdream, i restrict the max RAM intake manually:
          You could try halving that, but max image size would be in the range of 250*200.

  4. Excellent, well-polished tutorial and program! Very awesome concept! Finished the installation just now. Bought my first Pi for this.

    • Sam, that’s great!

      I wish you plenty of fun with the Raspberry Pi.
      Feel free to drop me a message if you build something cool.

  5. Also if you add the switch -j you can select the number of cores used by make. example make all -j4. if you are over clocking or are running a damageed/not to speck cpu it might fail…

  6. why are we expected to compile such a tool train it on infections deficiency it will make the sighs easier to see. this will help doctors and farmers learn from AI findings.

    • Yes! DeepDream is a result of experiments for examining neural network behaviour/learning. The concept has many potential uses.


Time limit is exhausted. Please reload CAPTCHA.