In the previous article, I installed OpenPose 1.7.0 on the Jetson Nano. This time, I will install OpenPose 1.7.0 on Xavier NX. Since both Nano and Xavier NX will use JetPack 4.5, there is no significant difference in installation.
However, Xavier NX can use SSD. By installing an SSD that provides better performance than an SD card, I will try to work faster.
The working directory on the Nano was /usr/local/src. In Xavier NX, the directory will be used by mounting the SSD (/dev/nvme0n1) to /usr/local/src.
Prerequisites
For how to use SSD in Xavier NX, refer to the following.
You can see that the NVME SSD is mounted in /usr/local/src. Therefore, performance improvement can be expected rather than working on an SD card.
root@spypiggy-nx:~# df -h Filesystem Size Used Avail Use% Mounted on /dev/mmcblk0p1 59G 14G 43G 24% / none 3.5G 0 3.5G 0% /dev tmpfs 3.8G 40K 3.8G 1% /dev/shm tmpfs 3.8G 30M 3.8G 1% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup tmpfs 777M 4.0K 777M 1% /run/user/0 tmpfs 777M 20K 777M 1% /run/user/120 tmpfs 777M 140K 777M 1% /run/user/1000 /dev/nvme0n1 117G 1.3G 110G 2% /usr/local/src
Refer to the following for how to install OpenPose 1.7.0 in Jetson Nano. It is helpful to read this information in advance.
CMake version check and update
Refer to "Jetpack 4.5-Install the latest version of OpenPose on Jetson Nano" and install the latest version of cmake in advance.
The installation process is almost the same as the Jetson Nano. However, the working directory have changed. On Jetson Nano, I will work in the /usr/local/src directory as the root user, but in Xavier NX you will work in the SSD that is mounted at /usr/local/src directory as the root user.
First, I checked the mounted SSD information. And check the power mode. I had to use 15W, 6 Core to use the maximum performance of the Xavier NX.
spypiggy@spypiggy-nx:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p1 59G 13G 44G 23% /
none 3.5G 0 3.5G 0% /dev
tmpfs 3.8G 4.0K 3.8G 1% /dev/shm
tmpfs 3.8G 21M 3.8G 1% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/nvme0n1 117G 427M 111G 1% /home/spypiggy
tmpfs 777M 16K 777M 1% /run/user/120
tmpfs 777M 0 777M 0% /run/user/1000
spypiggy@spypiggy-nx:~$ sudo nvpmodel -q
NV Fan Mode:quiet
NV Power Mode: MODE_15W_6CORE
2
Then build the latest cmake.
root@spypiggy-nx:~# apt-get update root@spypiggy-nx:~# apt-get -y install libssl-dev libcurl4-openssl-dev qt5-default
root@spypiggy-nx:~# apt-get install -y build-essential libboost-all-dev libboost-dev libhdf5-dev libatlas-base-dev root@spypiggy-nx:~# apt-get install -y python3-dev python3-pip
root@spypiggy-nx:~# apt-get remove -y cmake root@spypiggy-nx:~# cd /usr/local/src root@spypiggy-nx:/usr/local/src# wget https://github.com/Kitware/CMake/releases/download/v3.19.4/cmake-3.19.4.tar.gz root@spypiggy-nx:/usr/local/src# tar -xvzf cmake-3.19.4.tar.gz root@spypiggy-nx:/usr/local/src# cd cmake-3.19.4 root@spypiggy-nx:/usr/local/src/cmake-3.19.4# ./bootstrap --qt-gui root@spypiggy-nx:/usr/local/src/cmake-3.19.4# make -j6 root@spypiggy-nx:/usr/local/src/cmake-3.19.4# make install
If you use ssh, you must restart your ssh session. The cmake and cmake-gui are created in the /cmake-3.19.4/bin directory. If the version of cmake or cmake-gui has not been updated in a new ssh or local terminal after make install, copy the cmake and cmake-gui files from the above directory to the /usr/bin directory.
Install OpenPose for Xavier NX
Install Protocol Buffer
First, install Google's protocol buffer.
root@spypiggy-nx:~# apt-get install -y libprotobuf-dev protobuf-compiler libgflags-dev libgoogle-glog-dev
Install OpenPose 1.7.0
As of now, the latest version of OpenPose is 1.7.0, released on November 17th, 2020.
Download the source code.
root@spypiggy-nx:~# cd /usr/local/src
root@spypiggy-nx:/usr/local/src# wget https://github.com/CMU-Perceptual-Computing-Lab/openpose/archive/v1.7.0.tar.gz
root@spypiggy-nx:/usr/local/src# tar -xvzf v1.7.0.tar.gz
root@spypiggy-nx:/usr/local/src# cd openpose-1.7.0/
root@spypiggy-nx:/usr/local/src/openpose-1.7.0# cd 3rdparty
root@spypiggy-nx:/usr/local/src/openpose-1.7.0# git clone https://github.com/CMU-Perceptual-Computing-Lab/caffe.git
root@spypiggy-nx:/usr/local/src/openpose-1.7.0# git clone https://github.com/pybind/pybind11.git
<Download Openpose source code>
step1. Enable BUILD_PYTHON OPTION
The following is the procedure to create a Makefile using cmake. Run "sudo cmake-gui" and specify the source code directory and build directory as below. Be sure to check the BUILD_PYTHON option.
step2. Disable USE_CUDNN option
step3. Generate Makefile
root@spypiggy-nx:/usr/local/src/openpose-1.7.0# cd buildroot@spypiggy-nx:/usr/local/src/openpose-1.7.0/build# make -j6
root@spypiggy-nx:/usr/local/src/openpose-1.7.0/build# make installroot@spypiggy-nx:/usr/local/src/openpose-1.7.0/build# cd pythonroot@spypiggy-nx:/usr/local/src/openpose-1.7.0/build/python# make
It's time to copy our OpenPose python modules to python3.6 path directory(/usr/lib/python3.6/dist-packages). Then you can import openpose without path problem.
cp -r /usr/local/src/openpose-1.7.0/build/python/openpose/ /usr/lib/python3.6/dist-packages
root@spypiggy-nx:/usr/local/src/openpose-1.7.0# python3 Python 3.6.9 (default, Oct 8 2020, 12:12:24) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import openpose
Yes, I finally installed the OpenPose 1.7.0 version successfully on the Jetson Xavier NX.
Run a sample program
Let's run a sample program to test whether the OpenPose is properly installed.
root@spypiggy-nx:/usr/local/src/openpose-1.7.0# ./build/examples/openpose/openpose.bin --video ./examples/media/video.avi Starting OpenPose demo... Configuring OpenPose... Starting thread(s)... Auto-detecting all available GPUs... Detected 1 GPU(s), using 1 of them starting at GPU 0. OpenPose demo successfully finished. Total time: 162.277487 seconds.
And maybe you can watch the next video.
This sample program records 1.3 fps with video.avi. Although this value is higher than the Jetson Nano's FPS, it is still not satisfactory.
You can control the processing speed with the --net_resolution option.
Increasing the resolution of this option value increases the accuracy instead of increasing the processing speed to some extent.
However, if this option value is too high than the resolution used for learning in OpenPose, the recognition rate will decrease. Conversely, lowering this option lowers the recognition rate and increases the processing speed.
Wrapping up
In my previous blog, I installed OpenPose 1.7.0 on Jetson Nano, and this time I installed OpenPose 1.7.0 on Xavier NX. Unlike the Jetson Nano, the Xavier NX, which has 8GB of memory, did not show a forced termination of the program. However, since the FPS value is not satisfactory, it seems good to find an appropriate combination of processing speed and recognition rate by adjusting the net_resolution option.
댓글 없음:
댓글 쓰기