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
9

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!

dream_013 dream_012 dream_011 dream_010 dream_009 dream_008 dream_007 dream_006 dream_005 dream_004 dream_002 dream_001

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
Enter

In the now open file, replace the lines

with

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)

PsyCam
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.

Links
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.

9 Comments

  1. 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:
          http://www.knight-of-pi.org/deepdreaming-on-a-raspberry-pi-2/
          You could try halving that, but max image size would be in the range of 250*200.

  2. 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.

  3. 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…

  4. 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.

Comment

Time limit is exhausted. Please reload CAPTCHA.