0%
Loading ...

Install Tensorflow on raspberry pi and classify Images

Tensorraspberry

Steps:

  1. Download Raspbian strech with desktop from RaspberryPi
  2. Unzip downloaded image.
  3. Using Win32DiskImager, flash a SDCARD (minimum 8GB) with downloaded Raspbian Stretch.
  4. Power up rasphberry pi with:
    • Usb Mouse and Keyboard.
    • Hdmi monitor
    • SdCard
    • MicroUsb  Power spply
    • Case of using Raspberry pi 2, plugin also usb wifi dongle.
  5. Let the Raspberry Pi power up till you see Raspbian desktop.
  6. Setup wireless network.
  7. At this stage you have python 3.5 and 2.7 installed at your system.
  8. Open terminal and write there:
    • pip list
    • pip3 list
    • You will see all pacjages installedfor python 2.7 and python 3.5
  9. Install Tensorflow as follows:
    • sudo apt-get update

      # For Python 2.7
      sudo apt-get install python-pip python-dev

      # For Python 3.3+
      sudo apt-get install python3-pip python3-dev

    • # For Python 2.7
      wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v1.1.0/tensorflow-1.1.0-cp27-none-linux_armv7l.whl
      sudo pip install tensorflow-1.1.0-cp27-none-linux_armv7l.whl

      # For Python 3.4
      wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v1.1.0/tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl
      sudo pip3 install tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl

    • Finally, we need to reinstall the mock library to keep it from throwing an error when we import TensorFlow:

      # For Python 2.7
      sudo pip uninstall mock
      sudo pip install mock

      # For Python 3.3+
      sudo pip3 uninstall mock
      sudo pip3 install mock

  10. Run image classification with python as follows:

Keywords

Tensorflow, Python, Tensor Flow, Raspberry, Raspberry Pi, RaspberryPi, RPI