Jetson nano Tutorial(Tensorflow, Keras, OpenCV4) 젯슨 나노 - 환경구축




<Jetson nano Tutorial>



Version information

maduino@maduino-desktop:~$ python3 -c 'import numpy; print(numpy.__version__)'
1.17.0
maduino@maduino-desktop:~$ python3 -c 'import tensorflow; print(tensorflow.__version__)'
1.14.0
maduino@maduino-desktop:~$ python3 -c 'import keras; print(keras.__version__)'
Using TensorFlow backend.
2.2.5
maduino@maduino-desktop:~$ python3 -c 'import jupyter; print(jupyter.__version__)'
1.0.0
maduino@maduino-desktop:~$ python3 -c 'import PIL; print(PIL.__version__)'
6.1.0



Command history


sudo swapoff -a
sudo fallocate -l 8G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

sudo jetson_clocks
sudo nvpmodel -m 0

sudo apt install -y git \
cmake \
libatlas-base-dev \
gfortran \
python3-dev \
python3-pip \
libhdf5-serial-dev \
hdf5-tools \
libfreetype6-dev

sudo pip3 install -U pip
sudo pip3 install -U numpy grpcio absl-py py-cpuinfo psutil portpicker six mock requests gast h5py astor termcolor protobuf keras-applications keras-preprocessing wrapt google-pasta setuptools testresources

- Installing TensorFlow
sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu

- Upgrade TensorFlow
sudo pip3 install --upgrade --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu

sudo pip3 install keras jupyter pillow matplotlib

python3 -c 'import numpy; print(numpy.__version__)'
python3 -c 'import tensorflow; print(tensorflow.__version__)'
python3 -c 'import keras; print(keras.__version__)'
python3 -c 'import jupyter; print(jupyter.__version__)'
python3 -c 'import PIL; print(PIL.__version__)'
python3 -c 'import matplotlib; print(matplotlib.__version__)'

git clone https://github.com/NVIDIA-AI-IOT/jetcam
cd jetcam
pip3 install ./ --user
cd ..

sudo reboot

wget https://raw.githubusercontent.com/AastaNV/JEP/master/script/install_opencv4.0.0_Nano.sh
sudo bash install_opencv4.0.0_Nano.sh $HOME/.local

sudo reboot

export PYTHONPATH="$PYTHONPATH:/usr/local/python/cv2/python-3.6/"
echo "export PYTHONPATH=$PYTHONPATH:/usr/local/python/cv2/python-3.6/" >> ~/.bashrc
source ~/.bashrc

python3 -c 'import cv2; print(cv2.__version__)'

sudo apt-get install git cmake
cd ~
git clone https://github.com/dusty-nv/jetson-inference
cd jetson-inference
git submodule update --init

sudo apt-get install libpython3-dev python3-numpy

sudo swapoff -a
sudo rm -rf swapfile
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

sudo apt upgrade
sudo apt autoremove

cd ~
cd jetson-inference
mkdir build
cd build
cmake ../

cd ~
cd jetson-inference/tools
./download-models.sh

cd ~
cd jetson-inference/build
./install-pytorch.sh
sudo pip3 install torch-1.1.0-cp36-cp36m-linux_aarch64.whl

cd ~
cd jetson-inference/build
make
sudo make install

cd ~/jetson-inference/build/aarch64/bin
./imagenet-console --network=googlenet orange_0.jpg output_0.jpg

========== For Error Issue ==========

if 'apt' not work
E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarily unavailable)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), 
 is another process using it?

sudo killall apt apt-get
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*
sudo dpkg --configure -a
sudo apt update



if importError: cannot import name 'main'
Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    from pip import main
ImportError: cannot import name 'main'

sudo python3 -m pip uninstall pip && sudo apt-get install python3-pip --reinstall

댓글 쓰기

0 댓글