網頁

2020年8月27日 星期四

學習 How to configure your NVIDIA Jetson Nano for Computer Vision and Deep Learning

參考 How to configure your NVIDIA Jetson Nano for Computer Vision and Deep Learning

更新 system level packages
$ sudo apt-get update
$ sudo apt-get upgrade

安裝 system-level 相關套件
$ sudo apt-get install git
$ sudo apt-get install cmake
$ sudo apt-get install libatlas-base-dev
$ sudo apt-get install gfortran
$ sudo apt-get install libhdf5-serial-dev
$ sudo apt-get install hdf5-tools
$ sudo apt-get install python3-dev
$ sudo apt-get install locate
$ sudo apt-get install libfreetype6-dev
$ sudo apt-get install python3-setuptools
$ sudo apt-get install protobuf-compiler
$ sudo apt-get install libprotobuf-dev
$ sudo apt-get install openssl
$ sudo apt-get install libssl-dev
$ sudo apt-get install libcurl4-openssl-dev
$ sudo apt-get install cython3
$ sudo apt-get install libxml2-dev
$ sudo apt-get install libxslt1-dev

更新 CMake
$ wget http://www.cmake.org/files/v3.13/cmake-3.13.0.tar.gz
$ tar xpvf cmake-3.13.0.tar.gz cmake-3.13.0
$ cd cmake-3.13.0
$ ./bootstrap --system-curl
$ make -j4
$ vi ~/.bashrc
加入下列一行
export PATH=/home/nano/Data/cmake-3.13.0/bin:$PATH
$ source ~/.bashrc

新增 python virtual environment, 參考 python virtualenv
建立 py3cv4
$ source ~/envs/py3cv4/bin/activate

安裝 Peotobuf Compiler
下載別人做好的安裝 script, 並執行
$ wget https://raw.githubusercontent.com/jkjung-avt/jetson_nano/master/install_protobuf-3.6.1.sh
$ sudo chmod +x install_protobuf-3.6.1.sh
$ ./install_protobuf-3.6.1.sh
使用 setup.py 安裝 protobuf 於 py3cv4
$ source ~/envs/py3cv4/bin/activate
$ cd ~
$ cp -r ~/src/protobuf-3.6.1/python/ .
$ cd python
$ python setup.py install --cpp_implementation

安裝 TensorFlow, Keras, NumPy 和 SciPy
$ pip install numpy
$ pip install cython
$ wget https://github.com/scipy/scipy/releases/download/v1.3.3/scipy-1.3.3.tar.gz
$ tar -xzvf scipy-1.3.3.tar.gz scipy-1.3.3
$ cd scipy-1.3.3/
$ python setup.py install
其中注意網址中的 v44 表示 Jetpack 4.4
$ pip install tensorflow-1.15.3+nv20.7-cp36-cp36m-linux_aarch64.whl
$ pip install keras

安裝 TensorFlow Object Detection API
下載 TensorFlow Model Garden
$ git clone https://github.com/tensorflow/models
安裝 COCO API
$ git clone https://github.com/cocodataset/cocoapi.git
$ cd cocoapi/PythonAPI
$ python setup.py install
編譯 Protobuf libraries
(py3cv4) nano@nano-desktop:~/Data/tensorflow-models/models/research$ protoc object_detection/protos/*.proto --python_out=.
新增 PYTHONPATH 到 TFOD API
(py3cv4) nano@nano-desktop:~$ cat tfod_api.sh 
#!/bin/sh

export PYTHONPATH=$PYTHONPATH:/home/nano/Data/tensorflow-models/models/research:/home/nano/Data/tensorflow-models/models/research/slim

安裝 tf_trt_models
$ git clone --recursive https://github.com/NVIDIA-Jetson/tf_trt_models.git
$ cd tf_trt_models
$ ./install.sh

安裝機器學習,影像處理,繪圖套件
$ pip install matplotlib
$ pip install scikit-learn
$ pip install scikit-image
$ pip install pillow
$ pip install imutils
$ pip install dlib
$ pip install flask
$ pip install jupyter
$ pip install lxml
$ pip install progressbar2

測試 TFOD API
(py3cv4) nano@nano-desktop:~/Data/tensorflow-models/models/research$ python object_detection/builders/model_builder_tf1_test.py
Ran 21 tests in 0.892s

OK (skipped=1)
(py3cv4) nano@nano-desktop:~/Data/tensorflow-models/models/research$ 


沒有留言:

張貼留言