[PYTHON] Build a Tensorflow environment with Raspberry Pi [2020]

Tensorflow environment construction with Raspberry Pi [2020]

The environment construction on Raspberry Pi, which has little information and is difficult to manage the version, is described below.

  1. Write Raspberry Pi OS (32-bit) Lite to SD

    I needed to reduce the size of the OS as much as possible for real-time image processing using mobileNet V2.

  2. Connect your computer with ssh. Only under the same wifi environment

    Add your own Wifi settings to the Wifi management file and connect with ssh.

  3. Use the following command to update the OS relations. sudo apt update sudo apt upgrade -y sudo reboot
  4. Refer to this article to expand the swap area.

    Expand to have as much memory capacity as possible.

    When opening a text file, nano is recommended. Nano is basically the same as Notepad, but save is ctrl + X and after that you will be asked to confirm the saved file, but please press enter Example of use: sudo nano / etc / dphys-swapfile (may be different) Please change the contents of the file referring to the above site.

  5. Finally, This article will be used as a reference to build the Tensorflow environment. Install by referring to the above article However, the following command is absolute because there are some changes. Please be sure to compare it with the article. Refer to this article for changes to the contents of the file ...
    sudo nano /etc/sysctl.conf
    sudo sysctl -p
    sudo nano /etc/rc.local
    

    sudo reboot #reboot sudo apt install -y libhdf5-dev libqtwebkit4 libqt4-test libatlas-base-dev libjasper-dev sudo apt install python3-pip sudo apt install python3-dev -y

    sudo pip3 install pip -U
    sudo pip3 install setuptools -U
    

    numpy sudo pip3 install numpy==1.16.4

    sklearn sudo pip3 install scipy sudo pip3 install scikit-learn==0.21.3

    matplotlib sudo pip3 install matplotlib

    pandas sudo pip3 install pandas==0.24.2

    seaborn sudo pip3 install seaborn

    Tensorflow sudo pip3 install tensorflow==1.14.0

    keras sudo pip3 install keras

    flask sudo pip3 install flask flask_cors -U

  6. Finally, install OpenCV by referring to this article .