Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
c2bc4b4a
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看板
未验证
提交
c2bc4b4a
编写于
6月 08, 2021
作者:
G
Guanghua Yu
提交者:
GitHub
6月 08, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add armv7 in lite demo (#3306)
上级
8a33b794
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
136 addition
and
12 deletion
+136
-12
deploy/lite/Makefile_armv7
deploy/lite/Makefile_armv7
+61
-0
deploy/lite/README.md
deploy/lite/README.md
+4
-3
deploy/lite/run_detection.cc
deploy/lite/run_detection.cc
+3
-3
static/deploy/lite/Makefile_armv7
static/deploy/lite/Makefile_armv7
+61
-0
static/deploy/lite/README.md
static/deploy/lite/README.md
+4
-3
static/deploy/lite/run_detection.cc
static/deploy/lite/run_detection.cc
+3
-3
未找到文件。
deploy/lite/Makefile_armv7
0 → 100644
浏览文件 @
c2bc4b4a
ARM_ABI = arm7
export ARM_ABI
include ../Makefile.def
LITE_ROOT=../../../
THIRD_PARTY_DIR=${LITE_ROOT}/third_party
OPENCV_VERSION=opencv4.1.0
OPENCV_LIBS = ${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/libs/libopencv_imgcodecs.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/libs/libopencv_imgproc.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/libs/libopencv_core.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/libtegra_hal.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/liblibjpeg-turbo.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/liblibwebp.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/liblibpng.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/liblibjasper.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/liblibtiff.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/libIlmImf.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/libtbb.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/libcpufeatures.a
OPENCV_INCLUDE = -I../../../third_party/${OPENCV_VERSION}/armeabi-v7a/include
CXX_INCLUDES = $(INCLUDES) ${OPENCV_INCLUDE} -I$(LITE_ROOT)/cxx/include
CXX_LIBS = ${OPENCV_LIBS} -L$(LITE_ROOT)/cxx/lib/ -lpaddle_light_api_shared $(SYSTEM_LIBS)
###############################################################
# How to use one of static libaray: #
# `libpaddle_api_full_bundled.a` #
# `libpaddle_api_light_bundled.a` #
###############################################################
# Note: default use lite's shared library. #
###############################################################
# 1. Comment above line using `libpaddle_light_api_shared.so`
# 2. Undo comment below line using `libpaddle_api_light_bundled.a`
#CXX_LIBS = $(LITE_ROOT)/cxx/lib/libpaddle_api_light_bundled.a $(SYSTEM_LIBS)
detect_system: fetch_opencv detect_system.o
$(CC) $(SYSROOT_LINK) $(CXXFLAGS_LINK) detect_system.o -o detect_system $(CXX_LIBS) $(LDFLAGS)
detect_system.o: run_detection.cc
$(CC) $(SYSROOT_COMPLILE) $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o detect_system.o -c run_detection.cc
fetch_opencv:
@ test -d ${THIRD_PARTY_DIR} || mkdir ${THIRD_PARTY_DIR}
@ test -e ${THIRD_PARTY_DIR}/${OPENCV_VERSION}.tar.gz || \
(echo "fetch opencv libs" && \
wget -P ${THIRD_PARTY_DIR} https://paddle-inference-dist.bj.bcebos.com/${OPENCV_VERSION}.tar.gz)
@ test -d ${THIRD_PARTY_DIR}/${OPENCV_VERSION} || \
tar -zxvf ${THIRD_PARTY_DIR}/${OPENCV_VERSION}.tar.gz -C ${THIRD_PARTY_DIR}
.PHONY: clean
clean:
rm -f detect_system.o
rm -f detect_system
deploy/lite/README.md
浏览文件 @
c2bc4b4a
...
@@ -12,7 +12,7 @@ Paddle Lite是飞桨轻量化推理引擎,为手机、IOT端提供高效推理
...
@@ -12,7 +12,7 @@ Paddle Lite是飞桨轻量化推理引擎,为手机、IOT端提供高效推理
### 1.1 准备交叉编译环境
### 1.1 准备交叉编译环境
交叉编译环境用于编译 Paddle Lite 和 PaddleDetection 的C++ demo。
交叉编译环境用于编译 Paddle Lite 和 PaddleDetection 的C++ demo。
支持多种开发环境,不同开发环境的编译流程请参考对应文档。
支持多种开发环境,不同开发环境的编译流程请参考对应文档
,请确保安装完成Java jdk、Android NDK(R17以上)
。
1.
[
Docker
](
https://paddle-lite.readthedocs.io/zh/latest/source_compile/compile_env.html#docker
)
1.
[
Docker
](
https://paddle-lite.readthedocs.io/zh/latest/source_compile/compile_env.html#docker
)
2.
[
Linux
](
https://paddle-lite.readthedocs.io/zh/latest/source_compile/compile_env.html#linux
)
2.
[
Linux
](
https://paddle-lite.readthedocs.io/zh/latest/source_compile/compile_env.html#linux
)
...
@@ -25,9 +25,9 @@ Paddle Lite是飞桨轻量化推理引擎,为手机、IOT端提供高效推理
...
@@ -25,9 +25,9 @@ Paddle Lite是飞桨轻量化推理引擎,为手机、IOT端提供高效推理
|平台|预测库下载链接|
|平台|预测库下载链接|
|-|-|
|-|-|
|Android|
[
arm7
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.android.armv7.gcc.c++_static.with_extra.with_cv.tar.gz
)
/
[
arm8
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.android.armv8.gcc.c++_static.with_extra.with_cv.tar.gz
)
|
|Android|
[
arm7
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.android.armv7.gcc.c++_static.with_extra.with_cv.tar.gz
)
/
[
arm8
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.android.armv8.gcc.c++_static.with_extra.with_cv.tar.gz
)
|
|iOS|
[
arm7
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.ios.armv7.with_cv.with_extra.tiny_publish.tar.gz
)
/
[
arm8
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.ios.armv8.with_cv.with_extra.tiny_publish.tar.gz
)
|
注:1. 如果是从 Paddle-Lite [官方文档](https://paddle-lite.readthedocs.io/zh/latest/quick_start/release_lib.html#android-toolchain-gcc)下载的预测库,注意选择`with_extra=ON,with_cv=ON`的下载链接。
**注意**
:1. 如果是从 Paddle-Lite
[
官方文档
](
https://paddle-lite.readthedocs.io/zh/latest/quick_start/release_lib.html#android-toolchain-gcc
)
下载的预测库,注意选择
`with_extra=ON,with_cv=ON`
的下载链接。2. 目前只提供Android端demo,IOS端demo可以参考
[
Paddle-Lite IOS demo
](
https://github.com/PaddlePaddle/Paddle-Lite-Demo/tree/master/PaddleLite-ios-demo
)
2.
编译Paddle-Lite得到预测库,Paddle-Lite的编译方式如下:
2.
编译Paddle-Lite得到预测库,Paddle-Lite的编译方式如下:
```
shell
```
shell
...
@@ -228,6 +228,7 @@ precision fp32 # 模型精度
...
@@ -228,6 +228,7 @@ precision fp32 # 模型精度
```
shell
```
shell
# 执行编译,得到可执行文件detect_system
# 执行编译,得到可执行文件detect_system
# 如果是编译armv7的执行程序,需要使用 Makefile_armv7 替换 Makefile 文件
make
make
# 将编译得到的可执行文件移动到debug文件夹中
# 将编译得到的可执行文件移动到debug文件夹中
...
...
deploy/lite/run_detection.cc
浏览文件 @
c2bc4b4a
...
@@ -35,7 +35,7 @@ struct Object {
...
@@ -35,7 +35,7 @@ struct Object {
// Object for storing all preprocessed data
// Object for storing all preprocessed data
struct
ImageBlob
{
struct
ImageBlob
{
// image width and height
// image width and height
std
::
vector
<
floa
t
>
im_shape_
;
std
::
vector
<
in
t
>
im_shape_
;
// Buffer for image data after preprocessing
// Buffer for image data after preprocessing
const
float
*
im_data_
;
const
float
*
im_data_
;
// Scale factor for image size to origin image size
// Scale factor for image size to origin image size
...
@@ -270,8 +270,8 @@ ImageBlob prepare_imgdata(const cv::Mat& img,
...
@@ -270,8 +270,8 @@ ImageBlob prepare_imgdata(const cv::Mat& img,
int
width
=
target_size_
[
0
];
int
width
=
target_size_
[
0
];
int
height
=
target_size_
[
1
];
int
height
=
target_size_
[
1
];
img_data
.
im_shape_
=
{
img_data
.
im_shape_
=
{
static_cast
<
floa
t
>
(
target_size_
[
0
]),
static_cast
<
in
t
>
(
target_size_
[
0
]),
static_cast
<
floa
t
>
(
target_size_
[
1
])
static_cast
<
in
t
>
(
target_size_
[
1
])
};
};
img_data
.
scale_factor_
=
{
img_data
.
scale_factor_
=
{
...
...
static/deploy/lite/Makefile_armv7
0 → 100644
浏览文件 @
c2bc4b4a
ARM_ABI = arm7
export ARM_ABI
include ../Makefile.def
LITE_ROOT=../../../
THIRD_PARTY_DIR=${LITE_ROOT}/third_party
OPENCV_VERSION=opencv4.1.0
OPENCV_LIBS = ${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/libs/libopencv_imgcodecs.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/libs/libopencv_imgproc.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/libs/libopencv_core.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/libtegra_hal.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/liblibjpeg-turbo.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/liblibwebp.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/liblibpng.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/liblibjasper.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/liblibtiff.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/libIlmImf.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/libtbb.a \
${THIRD_PARTY_DIR}/${OPENCV_VERSION}/armeabi-v7a/3rdparty/libs/libcpufeatures.a
OPENCV_INCLUDE = -I../../../third_party/${OPENCV_VERSION}/armeabi-v7a/include
CXX_INCLUDES = $(INCLUDES) ${OPENCV_INCLUDE} -I$(LITE_ROOT)/cxx/include
CXX_LIBS = ${OPENCV_LIBS} -L$(LITE_ROOT)/cxx/lib/ -lpaddle_light_api_shared $(SYSTEM_LIBS)
###############################################################
# How to use one of static libaray: #
# `libpaddle_api_full_bundled.a` #
# `libpaddle_api_light_bundled.a` #
###############################################################
# Note: default use lite's shared library. #
###############################################################
# 1. Comment above line using `libpaddle_light_api_shared.so`
# 2. Undo comment below line using `libpaddle_api_light_bundled.a`
#CXX_LIBS = $(LITE_ROOT)/cxx/lib/libpaddle_api_light_bundled.a $(SYSTEM_LIBS)
detect_system: fetch_opencv detect_system.o
$(CC) $(SYSROOT_LINK) $(CXXFLAGS_LINK) detect_system.o -o detect_system $(CXX_LIBS) $(LDFLAGS)
detect_system.o: run_detection.cc
$(CC) $(SYSROOT_COMPLILE) $(CXX_DEFINES) $(CXX_INCLUDES) $(CXX_FLAGS) -o detect_system.o -c run_detection.cc
fetch_opencv:
@ test -d ${THIRD_PARTY_DIR} || mkdir ${THIRD_PARTY_DIR}
@ test -e ${THIRD_PARTY_DIR}/${OPENCV_VERSION}.tar.gz || \
(echo "fetch opencv libs" && \
wget -P ${THIRD_PARTY_DIR} https://paddle-inference-dist.bj.bcebos.com/${OPENCV_VERSION}.tar.gz)
@ test -d ${THIRD_PARTY_DIR}/${OPENCV_VERSION} || \
tar -zxvf ${THIRD_PARTY_DIR}/${OPENCV_VERSION}.tar.gz -C ${THIRD_PARTY_DIR}
.PHONY: clean
clean:
rm -f detect_system.o
rm -f detect_system
static/deploy/lite/README.md
浏览文件 @
c2bc4b4a
...
@@ -12,7 +12,7 @@ Paddle Lite是飞桨轻量化推理引擎,为手机、IOT端提供高效推理
...
@@ -12,7 +12,7 @@ Paddle Lite是飞桨轻量化推理引擎,为手机、IOT端提供高效推理
### 1.1 准备交叉编译环境
### 1.1 准备交叉编译环境
交叉编译环境用于编译 Paddle Lite 和 PaddleDetection 的C++ demo。
交叉编译环境用于编译 Paddle Lite 和 PaddleDetection 的C++ demo。
支持多种开发环境,不同开发环境的编译流程请参考对应文档。
支持多种开发环境,不同开发环境的编译流程请参考对应文档
,请确保安装完成Java jdk、Android NDK(R17以上)
。
1.
[
Docker
](
https://paddle-lite.readthedocs.io/zh/latest/source_compile/compile_env.html#docker
)
1.
[
Docker
](
https://paddle-lite.readthedocs.io/zh/latest/source_compile/compile_env.html#docker
)
2.
[
Linux
](
https://paddle-lite.readthedocs.io/zh/latest/source_compile/compile_env.html#linux
)
2.
[
Linux
](
https://paddle-lite.readthedocs.io/zh/latest/source_compile/compile_env.html#linux
)
...
@@ -25,9 +25,9 @@ Paddle Lite是飞桨轻量化推理引擎,为手机、IOT端提供高效推理
...
@@ -25,9 +25,9 @@ Paddle Lite是飞桨轻量化推理引擎,为手机、IOT端提供高效推理
|平台|预测库下载链接|
|平台|预测库下载链接|
|-|-|
|-|-|
|Android|
[
arm7
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.android.armv7.gcc.c++_static.with_extra.with_cv.tar.gz
)
/
[
arm8
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.android.armv8.gcc.c++_static.with_extra.with_cv.tar.gz
)
|
|Android|
[
arm7
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.android.armv7.gcc.c++_static.with_extra.with_cv.tar.gz
)
/
[
arm8
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.android.armv8.gcc.c++_static.with_extra.with_cv.tar.gz
)
|
|iOS|
[
arm7
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.ios.armv7.with_cv.with_extra.tiny_publish.tar.gz
)
/
[
arm8
](
https://github.com/PaddlePaddle/Paddle-Lite/releases/download/v2.8/inference_lite_lib.ios.armv8.with_cv.with_extra.tiny_publish.tar.gz
)
|
注:1. 如果是从 Paddle-Lite [官方文档](https://paddle-lite.readthedocs.io/zh/latest/quick_start/release_lib.html#android-toolchain-gcc)下载的预测库,注意选择`with_extra=ON,with_cv=ON`的下载链接。
**注意**
:1. 如果是从 Paddle-Lite
[
官方文档
](
https://paddle-lite.readthedocs.io/zh/latest/quick_start/release_lib.html#android-toolchain-gcc
)
下载的预测库,注意选择
`with_extra=ON,with_cv=ON`
的下载链接。2. 目前只提供Android端demo,IOS端demo可以参考
[
Paddle-Lite IOS demo
](
https://github.com/PaddlePaddle/Paddle-Lite-Demo/tree/master/PaddleLite-ios-demo
)
2.
编译Paddle-Lite得到预测库,Paddle-Lite的编译方式如下:
2.
编译Paddle-Lite得到预测库,Paddle-Lite的编译方式如下:
```
shell
```
shell
...
@@ -230,6 +230,7 @@ precision fp32 # 模型精度
...
@@ -230,6 +230,7 @@ precision fp32 # 模型精度
```
shell
```
shell
# 执行编译,得到可执行文件detect_system
# 执行编译,得到可执行文件detect_system
# 如果是编译armv7的执行程序,需要使用 Makefile_armv7 替换 Makefile 文件
make
make
# 将编译得到的可执行文件移动到debug文件夹中
# 将编译得到的可执行文件移动到debug文件夹中
...
...
static/deploy/lite/run_detection.cc
浏览文件 @
c2bc4b4a
...
@@ -35,7 +35,7 @@ struct Object {
...
@@ -35,7 +35,7 @@ struct Object {
// Object for storing all preprocessed data
// Object for storing all preprocessed data
struct
ImageBlob
{
struct
ImageBlob
{
// image width and height
// image width and height
std
::
vector
<
floa
t
>
im_shape_
;
std
::
vector
<
in
t
>
im_shape_
;
// Buffer for image data after preprocessing
// Buffer for image data after preprocessing
const
float
*
im_data_
;
const
float
*
im_data_
;
std
::
vector
<
float
>
mean_
;
std
::
vector
<
float
>
mean_
;
...
@@ -268,8 +268,8 @@ ImageBlob prepare_imgdata(const cv::Mat& img,
...
@@ -268,8 +268,8 @@ ImageBlob prepare_imgdata(const cv::Mat& img,
int
width
=
target_size_
[
0
];
int
width
=
target_size_
[
0
];
int
height
=
target_size_
[
1
];
int
height
=
target_size_
[
1
];
img_data
.
im_shape_
=
{
img_data
.
im_shape_
=
{
static_cast
<
floa
t
>
(
target_size_
[
0
]),
static_cast
<
in
t
>
(
target_size_
[
0
]),
static_cast
<
floa
t
>
(
target_size_
[
1
])
static_cast
<
in
t
>
(
target_size_
[
1
])
};
};
std
::
vector
<
float
>
mean_
;
std
::
vector
<
float
>
mean_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录