LoginSignup
1
0

More than 3 years have passed since last update.

Raspberry Pi4で機械学習の準備

Last updated at Posted at 2020-07-16

空白行で区切ったので、多少コピペしやすいと思います。
エラーっぽいメッセージが出たら、もう一回同じコマンドを実行させてみるとよさげ。よさげに酢をかけさしすせそ

Windowsから変更

boot\config.txt
# この2行は左のハッシュ記号を取り除く。
hdmi_force_hotplug=1
hdmi_group=1
# この1行は左のハッシュ記号を取り除いたうえで数字を5に
hdmi_mode=5
# この1行は最後に追加
dtparam=act_led_trigger=heartbeat

ラズパイの左上のこいつからシェルを起動

image.png

本体のアップデート作業

update

sudo apt update

sudo apt upgrade

sudo apt dist-upgrade

sudo apt autoremove

sudo apt autoclean

sudo reboot

pipをPython3.xに紐づける

参考:https://www.souichi.club/raspberrypi/python3-default/

change_default_python
cd /usr/bin

sudo unlink python

sudo ln -s python3 python

tensorflow2.xのインストール

tensorflow1.xを利用したい場合は飛ばす。
参考:https://github.com/PINTO0309/Tensorflow-bin
下から4つ目のsudo、3つ目のshが抜けてるので付け足しました。

install_libraries
sudo apt install -y libhdf5-dev libc-ares-dev cython gcc gfortran python-dev \
                    libgfortran5 libatlas3-base libatlas-base-dev libopenblas-dev \
                    libopenblas-base libblas-dev liblapack-dev libeigen3-dev \
                    openmpi-bin libopenmpi-dev python3-dev

pip install keras_applications==1.0.8 --no-deps

pip install keras_preprocessing==1.1.0 --no-deps

pip install h5py==2.9.0 pybind11

pip install -U --user six wheel mock

cd

sudo wget "https://raw.githubusercontent.com/PINTO0309/Tensorflow-bin/master/tensorflow-2.2.0-cp37-cp37m-linux_armv7l_download.sh"

sudo sh ./tensorflow-2.2.0-cp37-cp37m-linux_armv7l_download.sh

pip uninstall tensorflow

sudo -H pip3 install tensorflow-2.2.0-cp37-cp37m-linux_armv7l.whl

OpenCVのインストール

ImportErrorが出てしまったのでやり直しました。
こちらを参考にしました:https://creepfablic.site/2020/04/10/python-opencv-error/
再度やったらエラーが出たので、こちらを参考に少々修正しました。:https://qiita.com/XM03/items/48463fd910470b226f22

install_opencv
pip install opencv-python==4.1.0.25

sudo apt install -y libjasper-dev qt4-dev-tools qt4-doc qt4-qtconfig libqt4-test libatlas-base-dev

sudo nano .bashrc

export LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1の1行を追加.
Ctrl+O, Enter, Ctrl+Xの順に押して保存。
再起動。

その他のライブラリのインストール

他に必要なのがあればご自身でどうぞ。

install__libraries
pip install numpy pandas scipy scikit-learn matplotlib keras keras-rectified-adam

VSCodeのインストール

参考:https://qiita.com/optimisuke/items/1cd7440442f7420e6b99

install_vscode
sudo -s

. <( wget -O - https://code.headmelted.com/installers/apt.sh )

exit
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0