Michael Data

OS & Camera Config

  • raspi-config to enable camera or other peripherals.
  • rpi-update to update OS
  • apt purge wolfram-engine to remove bloatware
  • picamera Python API

Swap Size

Typical swap usage applies. Via blog:

System default swap is configured in /etc/dphys-swapfile, by value of CONF_SWAPSIZE=100, in megabytes. After making changes, swap usage can be restarted with sudo /etc/init.d/dphys-swapfile stop; sudo /etc/init.d/dphys-swapfile start. Changes can be verified with free -m.

ML Setup

OS Preparation

Use a high-speed-rated SD card if rapid writes are needed, such as “10” or greater as used in GoPro.
Easiest & reliable way to install an OS image using etcher.

  • 64-bit Raspbian has best support for the architecture and peripherals.
  • Python 3.4.2 makes the other installs easier/possible.
  1. sudo apt purge wolfram-engine && sudo apt autoremove
  2. sudo apt update && sudo apt upgrade && sudo rpi-update && sudo reboot
  3. sudo apt install make build-essential screen vim git python3-dev cmake pkg-config libatlas-base-dev libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev
  4. sudo apt update && sudo apt upgrade -y
  5. pip3 install numpy

Other OSs

ML Packages

Don't run pip install -r requirements.txt on a Pi as it will choke on the large packages Tensorflow, Keras, H5PY, OpenCV.

H5PY
  • apt install
    • sudo apt install libhdf5-dev python3-h5py python3-scipy -y
  • try verbose mode pip3 install h5py -vvv
Tensorflow

Tensorflow 1.9.0 now supports Raspbian:

  1. sudo apt install libatlas-base-dev
  2. pip3 install tensorflow
Keras
sudo pip3 install keras pyyaml

If keras doesn't install correctly, try apt.

OpenCV

OpenCV via SE

  1. download opencv and opencv_contrib
  2. check out same release version of each
  3. build opencv
    1. cd opencv && mkdir build && cd build
    2. cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_-AMPLES=OFF -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=~/workspace/openc-ntrib/modules -D BUILD_EXAMPLES=ON ..
    3. make -j3
      • if it appears to freeze or stall, don't panic. be patient. When patience runs out, hit CTRL-C to cancel and resume build with a make
    4. sudo make install
    5. sudo ldconfig
PyQT
  • Try installing by apt
    • sudo apt install build-essential python3-dev libqt4-dev