当前位置:网站首页>(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
边栏推荐
- 对象和类的概念
- Design and implementation of redis (4): what is the event driver of redis
- 第四次作业
- Problem C: realize Joseph Ring with linked list
- SQL topic exercise summary
- 2021-08-31
- Build websocket server in. Net5 webapi
- 集合之List接口
- MySQL is completely uninstalled and MySQL service is cleaned up
- Development record of primary sensitive word detection
猜你喜欢
Super easy to use asynchronous export function of Excel
C interface
JS - accuracy issues
Idea view history [file history and project history]
File upload vulnerability summary and upload labs shooting range documentary
Wechat applet canvas draws a simple asymptotic color of the dashboard
When migrating tslib_ setup: No such file or directory、ts_ open: No such file or director
AWS from entry to actual combat: creating accounts
QT dynamic translation of Chinese and English languages
QT learning summary
随机推荐
Detailed description of MySQL index [B + tree index, hash index, full-text index, overlay index]
Codeforces round 784 (Div. 4) (AK CF (XD) for the first time)
MySQL zip installation tutorial
Create virtual machine
Three types of jump statements
Batch download of files ---- compressed and then downloaded
Instructions for fastmock
Design and implementation of redis (5): master-slave replication strategy and optimization
Basic use of Charles
Common exceptions
Punch in: 4.22 C language chapter - (1) first knowledge of C language - (11) pointer
Use of rotary selector wheelpicker
Test questions and some space wars
Software testing process
2022 团体程序设计天梯赛 模拟赛 L2-3 浪漫侧影 (25 分)
2022 group programming ladder game simulation L2-4 Zhezhi game (25 points)
標識符、關鍵字、數據類型
New ORM framework -- Introduction to beetlsql
Design and implementation of redis (2): how to handle expired keys
Section 1 array and slicing in Chapter 6