Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
38d1517f
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
38d1517f
编写于
5月 13, 2020
作者:
C
channings
提交者:
GitHub
5月 13, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make TensorRT dir settable (#658)
上级
95934aca
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
59 addition
and
35 deletion
+59
-35
deploy/README.md
deploy/README.md
+1
-1
deploy/cpp/CMakeLists.txt
deploy/cpp/CMakeLists.txt
+6
-5
deploy/cpp/cmake/yaml-cpp.cmake
deploy/cpp/cmake/yaml-cpp.cmake
+1
-0
deploy/cpp/docs/linux_build.md
deploy/cpp/docs/linux_build.md
+20
-10
deploy/cpp/scripts/bootstrap.sh
deploy/cpp/scripts/bootstrap.sh
+4
-5
deploy/cpp/scripts/build.sh
deploy/cpp/scripts/build.sh
+27
-14
未找到文件。
deploy/README.md
浏览文件 @
38d1517f
...
...
@@ -5,7 +5,7 @@
## 模型导出
训练得到一个满足要求的模型后,如果想要将该模型接入到C++预测库,需要通过
`tools/export_model.py`
导出该模型。
-
[
导出教程
](
../docs/advanced_tutorials/
inference
/EXPORT_MODEL.md
)
-
[
导出教程
](
../docs/advanced_tutorials/
deploy
/EXPORT_MODEL.md
)
模型导出后, 目录结构如下(以
`yolov3_darknet`
为例):
```
...
...
deploy/cpp/CMakeLists.txt
浏览文件 @
38d1517f
...
...
@@ -9,6 +9,7 @@ option(WITH_TENSORRT "Compile demo with TensorRT." OFF)
SET
(
PADDLE_DIR
""
CACHE PATH
"Location of libraries"
)
SET
(
OPENCV_DIR
""
CACHE PATH
"Location of libraries"
)
SET
(
CUDA_LIB
""
CACHE PATH
"Location of libraries"
)
SET
(
TENSORRT_DIR
""
CACHE PATH
"Compile demo with TensorRT"
)
include
(
cmake/yaml-cpp.cmake
)
...
...
@@ -112,8 +113,8 @@ endif()
if
(
NOT WIN32
)
if
(
WITH_TENSORRT AND WITH_GPU
)
include_directories
(
"
${
PADDLE_DIR
}
/third_party/install/tensorrt
/include"
)
link_directories
(
"
${
PADDLE_DIR
}
/third_party/install/tensorrt
/lib"
)
include_directories
(
"
${
TENSORRT_DIR
}
/include"
)
link_directories
(
"
${
TENSORRT_DIR
}
/lib"
)
endif
()
endif
(
NOT WIN32
)
...
...
@@ -195,15 +196,15 @@ endif(NOT WIN32)
if
(
WITH_GPU
)
if
(
NOT WIN32
)
if
(
WITH_TENSORRT
)
set
(
DEPS
${
DEPS
}
${
PADDLE_DIR
}
/third_party/install/tensorrt/lib/libnvinfer
${
CMAKE_STATIC
_LIBRARY_SUFFIX
}
)
set
(
DEPS
${
DEPS
}
${
PADDLE_DIR
}
/third_party/install/tensorrt/lib/libnvinfer_plugin
${
CMAKE_STATIC
_LIBRARY_SUFFIX
}
)
set
(
DEPS
${
DEPS
}
${
TENSORRT_DIR
}
/lib/libnvinfer
${
CMAKE_SHARED
_LIBRARY_SUFFIX
}
)
set
(
DEPS
${
DEPS
}
${
TENSORRT_DIR
}
/lib/libnvinfer_plugin
${
CMAKE_SHARED
_LIBRARY_SUFFIX
}
)
endif
()
set
(
DEPS
${
DEPS
}
${
CUDA_LIB
}
/libcudart
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
)
set
(
DEPS
${
DEPS
}
${
CUDNN_LIB
}
/libcudnn
${
CMAKE_SHARED_LIBRARY_SUFFIX
}
)
else
()
set
(
DEPS
${
DEPS
}
${
CUDA_LIB
}
/cudart
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
)
set
(
DEPS
${
DEPS
}
${
CUDA_LIB
}
/cublas
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
)
set
(
DEPS
${
DEPS
}
${
CUD
A
_LIB
}
/cudnn
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
)
set
(
DEPS
${
DEPS
}
${
CUD
NN
_LIB
}
/cudnn
${
CMAKE_STATIC_LIBRARY_SUFFIX
}
)
endif
()
endif
()
...
...
deploy/cpp/cmake/yaml-cpp.cmake
浏览文件 @
38d1517f
...
...
@@ -26,4 +26,5 @@ ExternalProject_Add(
# Disable install step
INSTALL_COMMAND
""
LOG_DOWNLOAD ON
LOG_BUILD 1
)
deploy/cpp/docs/linux_build.md
浏览文件 @
38d1517f
...
...
@@ -38,30 +38,40 @@ fluid_inference
### Step4: 编译
编译
`cmake`
的命令在
`scripts/build.sh`
中,请根据实际情况修改主要参数,其主要内容说明如下:
```
# 是否使用GPU(即是否使用 CUDA)
WITH_GPU=ON
WITH_GPU=OFF
# 使用MKL or openblas
WITH_MKL=ON
# 是否集成 TensorRT(仅WITH_GPU=ON 有效)
WITH_TENSORRT=OFF
# 上一步下载的 Paddle 预测库路径
PADDLE_DIR=/root/projects/deps/fluid_inference/
# OPENCV 路径, 如果使用自带预编译版本可不设置
OPENCV_DIR=$(pwd)/deps/opencv346/
# TensorRT 的lib路径
TENSORRT_DIR=/path/to/TensorRT/
# Paddle 预测库路径
PADDLE_DIR=/path/to/fluid_inference/
# Paddle 的预测库是否使用静态库来编译
# 使用TensorRT时,Paddle的预测库通常为动态库
WITH_STATIC_LIB=OFF
# CUDA 的 lib 路径
CUDA_LIB=/
usr/local/cuda/lib64
/
CUDA_LIB=/
path/to/cuda/lib
/
# CUDNN 的 lib 路径
CUDNN_LIB=/
usr/local/cuda/lib64
/
CUDNN_LIB=/
path/to/cudnn/lib
/
# 以下无需改动
# OPENCV 路径, 如果使用自带预编译版本可不修改
sh $(pwd)/scripts/bootstrap.sh # 下载预编译版本的opencv
OPENCV_DIR=$(pwd)/deps/opencv3gcc4.8/
sh $(pwd)/scripts/bootstrap.sh
# 以下无需改动
rm -rf build
mkdir -p build
cd build
cmake ..
\
-DWITH_GPU=${WITH_GPU}
\
-DWITH_MKL=${WITH_MKL}
\
-DWITH_TENSORRT=${WITH_TENSORRT}
\
-DTENSORRT_DIR=${TENSORRT_DIR}
\
-DPADDLE_DIR=${PADDLE_DIR}
\
-DWITH_STATIC_LIB=${WITH_STATIC_LIB}
\
-DCUDA_LIB=${CUDA_LIB}
\
-DCUDNN_LIB=${CUDNN_LIB}
\
-DOPENCV_DIR=${OPENCV_DIR}
...
...
deploy/cpp/scripts/bootstrap.sh
浏览文件 @
38d1517f
# download pre-compiled opencv lib
OPENCV_URL
=
https://paddleseg.bj.bcebos.com/deploy/d
eps/opencv346
.tar.bz2
if
[
!
-d
"./deps/opencv3
46
"
]
;
then
OPENCV_URL
=
https://paddleseg.bj.bcebos.com/deploy/d
ocker/opencv3gcc4.8
.tar.bz2
if
[
!
-d
"./deps/opencv3
gcc4.8
"
]
;
then
mkdir
-p
deps
cd
deps
wget
-c
${
OPENCV_URL
}
tar
xvfj opencv3
46
.tar.bz2
rm
-rf
opencv3
46
.tar.bz2
tar
xvfj opencv3
gcc4.8
.tar.bz2
rm
-rf
opencv3
gcc4.8
.tar.bz2
cd
..
fi
deploy/cpp/scripts/build.sh
浏览文件 @
38d1517f
# compile with cuda
WITH_GPU
=
ON
# compile with tensorrt
# 是否使用GPU(即是否使用 CUDA)
WITH_GPU
=
OFF
# 使用MKL or openblas
WITH_MKL
=
ON
# 是否集成 TensorRT(仅WITH_GPU=ON 有效)
WITH_TENSORRT
=
OFF
# path to paddle inference lib
PADDLE_DIR
=
/root/projects/deps/fluid_inference/
# path to opencv lib
OPENCV_DIR
=
$(
pwd
)
/deps/opencv346/
# path to cuda lib
CUDA_LIB
=
/usr/local/cuda/lib64/
# TensorRT 的lib路径
TENSORRT_DIR
=
/path/to/TensorRT/
# Paddle 预测库路径
PADDLE_DIR
=
/path/to/fluid_inference/
# Paddle 的预测库是否使用静态库来编译
# 使用TensorRT时,Paddle的预测库通常为动态库
WITH_STATIC_LIB
=
OFF
# CUDA 的 lib 路径
CUDA_LIB
=
/path/to/cuda/lib/
# CUDNN 的 lib 路径
CUDNN_LIB
=
/path/to/cudnn/lib/
sh
$(
pwd
)
/scripts/bootstrap.sh
# OPENCV 路径, 如果使用自带预编译版本可不修改
sh
$(
pwd
)
/scripts/bootstrap.sh
# 下载预编译版本的opencv
OPENCV_DIR
=
$(
pwd
)
/deps/opencv3gcc4.8/
# 以下无需改动
rm
-rf
build
mkdir
-p
build
cd
build
cmake ..
\
-DWITH_GPU
=
OFF
\
-DWITH_TENSORRT
=
OFF
\
-DWITH_GPU
=
${
WITH_GPU
}
\
-DWITH_MKL
=
${
WITH_MKL
}
\
-DWITH_TENSORRT
=
${
WITH_TENSORRT
}
\
-DTENSORRT_DIR
=
${
TENSORRT_DIR
}
\
-DPADDLE_DIR
=
${
PADDLE_DIR
}
\
-DWITH_STATIC_LIB
=
${
WITH_STATIC_LIB
}
\
-DCUDA_LIB
=
${
CUDA_LIB
}
\
-D
OPENCV_DIR
=
${
OPENCV_DIR
}
\
-D
WITH_STATIC_LIB
=
OFF
-D
CUDNN_LIB
=
${
CUDNN_LIB
}
\
-D
OPENCV_DIR
=
${
OPENCV_DIR
}
make
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录