Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pose Estimation Support for Jetsons #62

Open
undefined-references opened this issue Sep 26, 2020 · 2 comments
Open

Add Pose Estimation Support for Jetsons #62

undefined-references opened this issue Sep 26, 2020 · 2 comments

Comments

@undefined-references
Copy link
Contributor

I tried to run existing pose estimation algorithms on Jetson devices as what @alpha-carinae29 has done for X86, GPU and Coral. I’m going to write my results and issues here.

@undefined-references
Copy link
Contributor Author

First, I started with the NVIDIA-AI-IOT/trt_pose project. There are several pretrained models on their repo and I could easily make a dockerfile to run it using their instruction.
It is reported to work with 12-22 fps on Jetson Nano but its pose estimation accuracy on frames from surveillance cameras wasn’t good enough for our problem due to the small object sizes and the best result from this project was with the pretrained densenet121_baseline_att_256x256_B model with the frame rate of 9 fps.

@undefined-references
Copy link
Contributor Author

I continued this task with OpenPifPaf project, as I found out it has the best results for our task. I decided to export openpifpaf model as ONNX format and then generate a TensorRT engine from that onnx model.
To export onnx from openpifpaf I used openpifpaf 0.10.0 and this command:

python3 -m openpifpaf.export_onnx --checkpoint resnet50 --outfile resnet50-openpifpaf.onnx --no-polish

I used ONNX-TensorRT repo to convert onnx model. Since I had jetpack 4.3 (TensorRT 6.0.1) installed on my Jetson devices, I used 6.0-full-dims tag.
After getting lots of error I used these instruction to build ONNX-TensorRT on a smart-distancing l4t docker for Jetson:

docker run --runtime nvidia --privileged -it -v /usr/include/aarch64-linux-gnu/:/usr/include/aarch64-linux-gnu/ -v $PWD:/repo neuralet/onnx2trt 
git clone https://github.com/onnx/onnx-tensorrt.git
cd onnx-tensorrt
git checkout 6.0-full-dims
mkdir build
cd build
cmake ../ -DCUDA_INCLUDE_DIRS=/usr/local/cuda-10.0/include -DTENSORRT_INCLUDE_DIR=/usr/include/aarch64-linux-gnu -DTENSORRT_LIBRARY_INFER_PLUGIN=/usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so -DTENSORRT_ROOT=/usr/src/tensorrt/ -DGPU_ARCHS="53" -DCUDNN_INCLUDE_DIR=/usr/lib/aarch64-linux-gnu -DTENSORRT_LIBRARY_INFER=/usr/lib/aarch64-linux-gnu/libnvinfer.so
make -j4
make install
  • -DGPU_ARCHS="53" for Jetson Nano and -DGPU_ARCHS="62" for Jetson TX2

ERROR: make[2]: * No rule to make target '/usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so', needed by 'libnvonnxparser.so.6.0.1'. Stop

Solve with:

ln -s /usr/lib/aarch64-linux-gnu/libnvinfer.so.6 /usr/lib/aarch64-linux-gnu/libnvinfer.so
ln -s /usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so.6 /usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so

And finally TensorRT generation was performed using command bellow:

onnx2trt resnet50-openpifpaf -o resnet50-openpifpaf.trt

Tips:

  • As TensorRT engine is built based on target GPU platform it is required to be generated and used on target device.
  • You can see onnx2trt help using -h argument and you can set max_batch_size using -b and model_data_type_bit_depth using -d to 32 for float32 and 16 for float16

@undefined-references undefined-references changed the title Add Pose Estimator Support for Jetsons Add Pose Estimation Support for Jetsons Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant