当前位置:网站首页>(valid for personal testing) compilation guide of paddedetection on Jetson
(valid for personal testing) compilation guide of paddedetection on Jetson
2022-04-23 03:35:00 【Crispy eggplant strips】
This document is in NVIDIA Jetson Xavier NX (Jetpack The version is 4.4.1) Upper Department PaddleDetection Of c++ Reasoning course .
Jetpack 4.4.1 Your environment is configured as :
CUDA 10.2
cuDNN 8.8.0
1. Get deployment code
I downloaded is 2.3 edition .
The download link is as follows :https://github.com/PaddlePaddle/PaddleDetection.git
2. download paddle_inference Forecast base , The download link is as follows :https://paddleinference.paddlepaddle.org.cn/user_guides/download_lib.html
The contents of the extracted folder are as follows ;
paddle_inference
├── paddle # paddle Core libraries and header files
├── third_party # Third parties rely on Libraries and header files
└── version.txt # Version and compilation information
3. Get into PaddleDetection-release-2.3\deploy\cpp\scripts In file
compile cmake Command on scripts/build.sh in , adopt vim Modify the main parameters , The modified example is as follows :
# Whether to use GPU( I.e. whether to use CUDA)
WITH_GPU=ON
# Whether to use MKL or openblas,TX2 I need to set to OFF
WITH_MKL=ON
# Is it integrated TensorRT( only WITH_GPU=ON It works )
WITH_TENSORRT=ON
# paddle Forecast base lib name , Due to different platforms and different versions of prediction Libraries lib Different names , Please check the downloaded forecast Library `paddle_inference/lib/` Under the folder `lib` The name of
PADDLE_LIB_NAME=libpaddle_inference
# TensorRT Of include route
TENSORRT_INC_DIR=/usr/include/aarch64-linux-gnu
# TensorRT Of lib route
TENSORRT_LIB_DIR=/usr/lib/aarch64-linux-gnu
# Paddle Prediction library path ( Downloaded in the previous step paddle_inference The path after decompression )
PADDLE_DIR=/path/to/paddle_inference
# CUDA Of lib route
CUDA_LIB=/usr/local/cuda-10.2/lib64
# CUDNN Of lib route
CUDNN_LIB=/usr/lib/aarch64-linux-gnu/
# Whether the key point model prediction function is enabled
WITH_KEYPOINT=ON
# Whether to enable the tracking model prediction function
WITH_MOT=OFF
MACHINE_TYPE=`uname -m`
echo "MACHINE_TYPE: "${
MACHINE_TYPE}
if [ "$MACHINE_TYPE" = "x86_64" ]
then
echo "set OPENCV_DIR for x86_64"
# linux The system downloads the precompiled opencv
mkdir -p $(pwd)/deps && cd $(pwd)/deps
wget -c https://paddledet.bj.bcebos.com/data/opencv-3.4.16_gcc8.2_ffmpeg.tar.gz
tar -xvf opencv-3.4.16_gcc8.2_ffmpeg.tar.gz && cd ..
# set OPENCV_DIR
OPENCV_DIR=$(pwd)/deps/opencv-3.4.16_gcc8.2_ffmpeg
elif [ "$MACHINE_TYPE" = "aarch64" ]
then
echo "set OPENCV_DIR for aarch64"
# TX2 The platform downloads the precompiled through the following command opencv
mkdir -p $(pwd)/deps && cd $(pwd)/deps
wget -c https://bj.bcebos.com/v1/paddledet/data/TX2_JetPack4.3_opencv_3.4.6_gcc7.5.0.tar.gz
tar -xvf TX2_JetPack4.3_opencv_3.4.6_gcc7.5.0.tar.gz && cd ..
# set OPENCV_DIR
OPENCV_DIR=$(pwd)/deps/TX2_JetPack4.3_opencv_3.4.6_gcc7.5.0/
else
echo "Please set OPENCV_DIR manually"
fi
echo "OPENCV_DIR: "$OPENCV_DIR
# There is no need to change the following
rm -rf build
mkdir -p build
cd build
cmake .. \
-DWITH_GPU=${
WITH_GPU} \
-DWITH_MKL=${
WITH_MKL} \
-DWITH_TENSORRT=${
WITH_TENSORRT} \
-DTENSORRT_LIB_DIR=${
TENSORRT_LIB_DIR} \
-DTENSORRT_INC_DIR=${
TENSORRT_INC_DIR} \
-DPADDLE_DIR=${
PADDLE_DIR} \
-DWITH_STATIC_LIB=${
WITH_STATIC_LIB} \
-DCUDA_LIB=${
CUDA_LIB} \
-DCUDNN_LIB=${
CUDNN_LIB} \
-DOPENCV_DIR=${
OPENCV_DIR} \
-DPADDLE_LIB_NAME=${
PADDLE_LIB_NAME} \
-DWITH_KEYPOINT=${
WITH_KEYPOINT} \
-DWITH_MOT=${
WITH_MOT}
make
echo "make finished!"
After modifying the script and setting the main parameters , perform build Script :
sh ./scripts/build.sh
After execution build After script , Will be in deploy/cpp Generate... In file build Folder , The compiled file is in build In file .
4. Prediction and visualization
After successful compilation , The prediction procedure is build/main, The main command parameters are described as follows :
Parameter description :
--model_dir The path of the exported detection and prediction model
--model_dir_keypoint Option
--image_file Image file path to predict
--image_dir Picture folder path to predict
--video_file Video file path to predict
--camera_id Option
--device Device at run time , Can choose CPU/GPU/XPU, The default is CPU
--gpu_id Specify the... For reasoning GPU device id( The default value is 0)
--run_mode Use GPU when , The default is paddle, Optional (paddle/trt_fp32/trt_fp16/trt_int8)
--batch_size Test the prediction of the model batch size, In the specified image_dir Effective when
--batch_size_keypoint Prediction of key point model batch size, The default is 8
--run_benchmark Whether to repeat the prediction benchmark velocity measurement |
--output_dir The folder where the output picture is located , The default is output |
--use_mkldnn CPU Whether it is enabled in prediction MKLDNN Speed up
--cpu_threads Set up cpu Number of threads , The default is 1
--use_dark Whether the key point model output prediction uses DarkPose post-processing , The default is true
Examples are as follows :
./main --model_dir=/path/to/yolov3_darknet --image_file=/path/to/test.jpg --device=GPU
版权声明
本文为[Crispy eggplant strips]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220602451766.html
边栏推荐
- Learn about I / O flow and file operations
- The art of concurrent programming (5): the use of reentrantlock
- Use the thread factory to set the thread name in the thread pool
- Un aperçu des flux d'E / s et des opérations de fichiers de classe de fichiers
- Three types of jump statements
- 深度学习笔记(二)——激活函数原理与实现
- Visual programming -- how to customize the mouse cursor
- Unity Basics
- Notes sur l'apprentissage profond (Ⅱ) - - Principe et mise en oeuvre de la fonction d'activation
- Problem a: face recognition
猜你喜欢
常用的辅助类
C set
Database SQL -- simulate inserting a large amount of data, importing / exporting database scripts, timestamp conversion and database basics
Supersocket is Use in net5 - startup
【微服务】(十)—— 统一网关Gateway
淺學一下I/O流和File類文件操作
Flink customizes the application of sink side sinkfunction
Notes sur l'apprentissage profond (Ⅱ) - - Principe et mise en oeuvre de la fonction d'activation
2022 group programming ladder game simulation L2-4 Zhezhi game (25 points)
New ORM framework -- Introduction to beetlsql
随机推荐
Applet - canvas drawing Poster
MySQL zip installation tutorial
Websites frequented by old programmers (continuously updated)
Supersocket is Use in net5 - startup
JS, bind the event for a label with input, and then bind the stand-alone event in the parent element. The event is executed twice and solved
Variables, constants, operators
There is no index in the database table. When inserting data, SQL statements are used to prevent repeated addition (Reprint)
【微服务】(十)—— 统一网关Gateway
File upload vulnerability summary and upload labs shooting range documentary
Instructions for fastmock
Several common methods of multithreading
Test questions (2)
vscode删除卸载残余
mui. Plusready does not take effect
Design and implementation of redis (4): what is the event driver of redis
Section 1 array and slicing in Chapter 6
Learn about I / O flow and file operations
2022 团体程序设计天梯赛 模拟赛 1-8 均是素数 (20 分)
What to pay attention to when writing the first code
Create virtual machine