From e3f1384deb3108adc05873493014a35950c04eae Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Thu, 14 May 2020 15:07:06 +0800 Subject: [PATCH] update doc for ext_op (#667) --- configs/anchor_free/README.md | 1 + ppdet/ext_op/README.md | 17 +++++++++++++++++ ppdet/ext_op/src/make.sh | 2 -- ppdet/modeling/anchor_heads/corner_head.py | 3 ++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/configs/anchor_free/README.md b/configs/anchor_free/README.md index 7c0d196c6..184ca2a6e 100644 --- a/configs/anchor_free/README.md +++ b/configs/anchor_free/README.md @@ -38,6 +38,7 @@ - CornerNet-Squeeze中使用ResNet结构的骨干网络时,加入了FPN结构,骨干网络的输出feature map采用FPN中的P3层输出。 - \*CornerNet-Squeeze-dcn-mixup-cosine是基于原版CornerNet-Squeeze优化效果最好的模型,在ResNet的骨干网络基础上增加mixup预处理和使用cosine_decay - FCOS使用GIoU loss、用location分支预测centerness、左上右下角点偏移量归一化和ground truth中心匹配策略 +- Cornernet-Squeeze模型依赖corner_pooling op,该op在```ppdet/ext_op```中编译得到,具体编译方式请参考[自定义OP的编译过程](../../ppdet/ext_op/README.md) ## 算法细节 diff --git a/ppdet/ext_op/README.md b/ppdet/ext_op/README.md index cc6173b36..6bfeb0e88 100644 --- a/ppdet/ext_op/README.md +++ b/ppdet/ext_op/README.md @@ -37,6 +37,23 @@ sh make.sh 编译自定义OP时会报错找不到`mkldnn.h`等文件,可在`make.sh`中删除编译命令中的`-DPADDLE_WITH_MKLDNN`选项。 +## 设置环境变量 + +需要将Paddle的核心库设置到`LD_LIBRARY_PATH`里, 先运行下面程序获取路径: + +``` +import paddle +print(paddle.sysconfig.get_lib()) +``` + +可通过如下方式添加动态库路径: + +``` +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`python -c 'import paddle; print(paddle.sysconfig.get_lib())'` +``` + + + ## 执行单测 执行下列单测,确保自定义算子可在网络中正确使用: diff --git a/ppdet/ext_op/src/make.sh b/ppdet/ext_op/src/make.sh index bd0d3a3c9..ffc66034f 100755 --- a/ppdet/ext_op/src/make.sh +++ b/ppdet/ext_op/src/make.sh @@ -19,5 +19,3 @@ g++ bottom_pool_op.cc bottom_pool_op.cu.o top_pool_op.cc top_pool_op.cu.o right_ -L /usr/local/cuda/lib64 -lpaddle_framework -lcudart rm *.cu.o - -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$lib_dir diff --git a/ppdet/modeling/anchor_heads/corner_head.py b/ppdet/modeling/anchor_heads/corner_head.py index a43416d15..01e1195b0 100644 --- a/ppdet/modeling/anchor_heads/corner_head.py +++ b/ppdet/modeling/anchor_heads/corner_head.py @@ -246,7 +246,8 @@ class CornerHead(object): try: import cornerpool_lib except: - logger.error("cornerpool_lib not found, compile in ext_op at first") + logger.error( + "cornerpool_lib not found, compile in ppdet/ext_op at first") self.train_batch_size = train_batch_size self.test_batch_size = test_batch_size self.num_classes = num_classes -- GitLab