• Stars
    star
    675
  • Rank 66,879 (Top 2 %)
  • Language
    C++
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

lib, demo, model, data

Paddle-Lite-Demo

Paddle-Lite 提供了多个应用场景的 demo,并支持 Android、iOS 和 ArmLinux 三个平台:

关于 Paddle-Lite 更多示例,请参考如下文档链接:

要求

  • iOS

    • macOS+Xcode,已验证的环境:Xcode Version 11.5 (11E608c) on macOS Catalina(10.15.5)
    • Xcode 11.3会报"Invalid bitcode version ..."的编译错误,请将Xcode升级到11.4及以上的版本后重新编译
    • 对于ios 12.x版本,如果提示“xxx. which may not be supported by this version of Xcode”,请下载对应的工具包, 下载完成后解压放到/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport目录,重启xcode
  • Android

    • Android Studio 4.2;
    • adb调试工具;
    • Android手机或开发版;
    • 华为手机支持NPU的 Demo(NPU的功能暂时只在nova5、mate30和mate30 5G上进行了测试,用户可自行尝试其它搭载了麒麟810和990芯片的华为手机(如nova5i pro、mate30 pro、荣耀v30,mate40或p40,且需要将系统更新到最新版)
  • ARMLinux

    $ sudo apt-get update
    $ sudo apt-get install gcc g++ make wget unzip libopencv-dev pkg-config
    $ wget https://www.cmake.org/files/v3.10/cmake-3.10.3.tar.gz
    $ tar -zxvf cmake-3.10.3.tar.gz
    $ cd cmake-3.10.3
    $ ./configure
    $ make
    $ sudo make install

安装

$ git clone https://github.com/PaddlePaddle/Paddle-Lite-Demo

  • iOS

    • 在PaddleLite-ios-demo目录下执行download_dependencies.sh脚本,该脚本会离线下载并解压ios demo所需要的依赖, 包括paddle-lite 预测库,demo所需要的模型,opencv framework
    $ chmod +x download_dependencies.sh
    $ ./download_dependencies.sh
    • 打开xcode,点击“Open another project…”打开Paddle-Lite-Demo/PaddleLite-ios-demo/ios-xxx_demo/目录下的xcode工程;
    • 在选中左上角“project navigator”,选择“classification_demo”,修改“General”信息;
    • 插入ios真机(已验证:iphone8, iphonexr),选择Device为插入的真机;
    • 点击左上角“build and run”按钮;
  • Android

    • 打开Android Studio,在"Welcome to Android Studio"窗口点击"Open an existing Android Studio project",在弹出的路径选择窗口中进入"image_classification_demo"目录,然后点击右下角的"Open"按钮即可导入工程
    • 通过USB连接Android手机或开发板;
    • 载入工程后,点击菜单栏的Run->Run 'App'按钮,在弹出的"Select Deployment Target"窗口选择已经连接的Android设备(连接失败请检查本机adb工具是否正常),然后点击"OK"按钮;
    • 由于Demo所用到的库和模型均通过app/build.gradle脚本在线下载,因此,第一次编译耗时较长(取决于网络下载速度),请耐心等待;
    • 对于图像分类Demo,如果库和模型下载失败,建议手动下载并拷贝到相应目录下:
      1. paddle_lite_libs.tar.gz:解压后将 inference_*/cxx 拷贝至 Paddle-Lite-Demo/image_classification/android/app/cxx/image_classification/app/PaddleLite/cxx,将 inference_*/java 拷贝至 Paddle-Lite-Demo/image_classification/android/app/cxx/image_classification/app/PaddleLite/java
      2. mobilenet_v1_for_cpu.tar.gz:解压至 Paddle-Lite-Demo/image_classification/android/app/cxx/image_classification/app/app/src/main/assets/models/mobilenet_v1_for_cpu 目录
    • 在图像分类Demo中,你还可以通过上方的"Gallery"和"Take Photo"按钮从相册或相机中加载测试图像;
  • ARMLinux or Shell

    • 预测库下载
    $ cd Paddle-Lite-Demo/libs
    $ ./download.sh # 下载预测库
    • 图像分类Demo的编译与运行(以下所有命令均在设备上操作)
    $ cd Paddle-Lite-Demo/image_classification/assets
    $ ./download.sh # 下载模型、测试图片和标签文件
    $ cd Paddle-Lite-Demo/image_classification/android/shell/cxx/image_classification
    $ ./build.sh armv8 # 编译可执行文件,并运行程序

    在终端打印预测结果和性能数据。

    • 目标检测Demo的编译与运行(以下所有命令均在设备上操作)
    $ cd Paddle-Lite-Demo/object_detection/assets
    $ ./download.sh # 下载模型、测试图片和标签文件
    $ cd Paddle-Lite-Demo/object_detection/android/shell/cxx/yolov3_mobilenet_v3
    $ ./build.sh armv8 # 编译可执行文件,并运行程序

    在终端打印预测结果和性能数据,同时在build目录中生成dog_yolo_v3_mobilenetv3_detection_result.jpg.jpg。

效果展示

  • 图像分类

    Android iOS Armlinux
    android_image_classification_cat_cpu width="200" height="500" ios_static width="200" height="500" armlinux_image_classification_raspberry_pi width="200" height="500"
  • 目标检测

    Android iOS
    android_object_detection_picodet_cpu width="300" height="500" ios_picodet_static width="300" height="500"
  • OCR

    Android iOS
  • 人脸检测

    Android iOS
    android_face_detection_cpu 补充中
  • 人脸关键点检测

    Android iOS
    android_face_keypoints_detection_cpu 补充中
  • 口罩识别

    Android iOS
    android_mask_detection_cpu 补充中
  • 人像分割

    Android iOS
  • PP 识图

    Android iOS

性能优化

  • 多线程设置:
    • demo 中线程数默认是1,用户可以根据手机大核个数,设置最大线程数。如小米9,它有4个A76 大核,线程数最大设置为4;
    • 设置方法:可以通过界面的setting 按钮进行更新,也可以通过修改源码(config.set_threads())的线程数进行更新。
  • FP16 推理:
    • demo 中模型默认是FP32 模型,如果你是在armv8.2 架构以上的手机运行如小米9,则可选用FP16 模型进行推理;否则,不能使用FP16 模型进行推理。
    • FP16 推理方法:如果 APP 中 assets/model 目录下提供了FP16 模型(nb 模型以_fp16结尾),用户只需更新源码模型路径就行;否则,用户需要下载 OPT 可执行文件,并参考 OPT 使用文档重新转换模型(将 enable_fp16 设置为 true,如 --enable_fp16=1),然后更新源码中模型路径即可。
    • 如果提供的预测库没有包含FP16 kernel 算子话,用户需要从 release 仓库中下载含有FP16 kernel新的预测库。
  • Int8/稀疏推理:
    • 用户可以使用 PaddleSlim 工具 完成模型量化/稀疏化处理,进一步提升模型性能。
    • 使用方法:用 PaddleSlim 生成新模型,然后参考 FP16 推理方法,更新 demo 中预测模型即可。

More Repositories

1

PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
Python
43,170
star
2

Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
C++
22,193
star
3

PaddleDetection

Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Python
12,744
star
4

PaddleHub

Awesome pre-trained models toolkit based on PaddlePaddle. (400+ models including Image, Text, Audio, Video and Cross-Modal with Easy Inference & Serving)【安全加固,暂停交互,请耐心等待】
Python
12,704
star
5

PaddleNLP

👑 Easy-to-use and powerful NLP and LLM library with 🤗 Awesome model zoo, supporting wide-range of NLP tasks from research to industrial applications, including 🗂Text Classification, 🔍 Neural Search, ❓ Question Answering, ℹ️ Information Extraction, 📄 Document Intelligence, 💌 Sentiment Analysis etc.
Python
11,953
star
6

PaddleSpeech

Easy-to-use Speech Toolkit including Self-Supervised Learning model, SOTA/Streaming ASR with punctuation, Streaming TTS with text frontend, Speaker Verification System, End-to-End Speech Translation and Keyword Spotting. Won NAACL2022 Best Demo Award.
Python
11,053
star
7

PaddleSeg

Easy-to-use image segmentation library with awesome pre-trained model zoo, supporting wide-range of practical tasks in Semantic Segmentation, Interactive Segmentation, Panoptic Segmentation, Image Matting, 3D Segmentation, etc.
Python
8,601
star
8

PaddleGAN

PaddlePaddle GAN library, including lots of interesting applications like First-Order motion transfer, Wav2Lip, picture repair, image editing, photo2cartoon, image style transfer, GPEN, and so on.
Python
7,858
star
9

Paddle-Lite

PaddlePaddle High Performance Deep Learning Inference Engine for Mobile and Edge (飞桨高性能深度学习端侧推理引擎)
C++
6,953
star
10

models

Officially maintained, supported by PaddlePaddle, including CV, NLP, Speech, Rec, TS, big models and so on.
Python
6,897
star
11

ERNIE

Official implementations for various pre-training models of ERNIE-family, covering topics of Language Understanding & Generation, Multimodal Understanding & Generation, and beyond.
Python
6,300
star
12

PaddleClas

A treasure chest for visual classification and recognition powered by PaddlePaddle
Python
5,418
star
13

PaddleX

All-in-One Development Tool based on PaddlePaddle(飞桨低代码全流程开发工具)
Python
4,781
star
14

VisualDL

Deep Learning Visualization Toolkit(『飞桨』深度学习可视化工具 )
HTML
4,773
star
15

PaddleRec

Recommendation Algorithm大规模推荐算法库,包含推荐系统经典及最新算法LR、Wide&Deep、DSSM、TDM、MIND、Word2Vec、Bert4Rec、DeepWalk、SSR、AITM,DSIN,SIGN,IPREC、GRU4Rec、Youtube_dnn、NCF、GNN、FM、FFM、DeepFM、DCN、DIN、DIEN、DLRM、MMOE、PLE、ESMM、ESCMM, MAML、xDeepFM、DeepFEFM、NFM、AFM、RALM、DMR、GateNet、NAML、DIFM、Deep Crossing、PNN、BST、AutoInt、FGCNN、FLEN、Fibinet、ListWise、DeepRec、ENSFM,TiSAS,AutoFIS等,包含经典推荐系统数据集criteo 、movielens等
Python
4,273
star
16

PARL

A high-performance distributed training framework for Reinforcement Learning
Python
3,261
star
17

awesome-DeepLearning

深度学习入门课、资深课、特色课、学术案例、产业实践案例、深度学习知识百科及面试题库The course, case and knowledge of Deep Learning and AI
Jupyter Notebook
3,001
star
18

FastDeploy

⚡️An Easy-to-use and Fast Deep Learning Model Deployment Toolkit for ☁️Cloud 📱Mobile and 📹Edge. Including Image, Video, Text and Audio 20+ main stream scenarios and 150+ SOTA models with end-to-end optimization, multi-platform and multi-framework support.
C++
2,952
star
19

book

Deep Learning 101 with PaddlePaddle (『飞桨』深度学习框架入门教程)
Jupyter Notebook
2,735
star
20

Research

novel deep learning research works with PaddlePaddle
Python
1,715
star
21

PGL

Paddle Graph Learning (PGL) is an efficient and flexible graph learning framework based on PaddlePaddle
Python
1,572
star
22

PaddleSlim

PaddleSlim is an open-source library for deep model compression and architecture search.
Python
1,557
star
23

PaddleVideo

Awesome video understanding toolkits based on PaddlePaddle. It supports video data annotation tools, lightweight RGB and skeleton based action recognition model, practical applications for video tagging and sport action detection.
Python
1,512
star
24

PaddleHelix

Bio-Computing Platform Featuring Large-Scale Representation Learning and Multi-Task Deep Learning “螺旋桨”生物计算工具集
Python
1,007
star
25

Paddle.js

Paddle.js is a web project for Baidu PaddlePaddle, which is an open source deep learning framework running in the browser. Paddle.js can either load a pre-trained model, or transforming a model from paddle-hub with model transforming tools provided by Paddle.js. It could run in every browser with WebGL/WebGPU/WebAssembly supported. It could also run in Baidu Smartprogram and WX miniprogram.
JavaScript
980
star
26

Serving

A flexible, high-performance carrier for machine learning models(『飞桨』服务化部署框架)
C++
894
star
27

RocketQA

🚀 RocketQA, dense retrieval for information retrieval and question answering, including both Chinese and English state-of-the-art models.
Python
763
star
28

X2Paddle

Deep learning model converter for PaddlePaddle. (『飞桨』深度学习模型转换工具)
Python
727
star
29

Paddle2ONNX

ONNX Model Exporter for PaddlePaddle
Python
723
star
30

Knover

Large-scale open domain KNOwledge grounded conVERsation system based on PaddlePaddle
Python
674
star
31

Parakeet

PAddle PARAllel text-to-speech toolKIT (supporting Tacotron2, Transformer TTS, FastSpeech2/FastPitch, SpeedySpeech, WaveFlow and Parallel WaveGAN)
Python
600
star
32

FlyCV

FlyCV is a high-performance library for processing computer visual tasks.
C++
577
star
33

Paddle3D

A 3D computer vision development toolkit based on PaddlePaddle. It supports point-cloud object detection, segmentation, and monocular 3D object detection models.
Python
565
star
34

Quantum

Jupyter Notebook
564
star
35

PaddleYOLO

🚀🚀🚀 YOLO series of PaddlePaddle implementation, PP-YOLOE+, RT-DETR, YOLOv5, YOLOv6, YOLOv7, YOLOv8, YOLOv10, YOLOX, YOLOv5u, YOLOv7u, YOLOv6Lite, RTMDet and so on. 🚀🚀🚀
Python
551
star
36

Anakin

High performance Cross-platform Inference-engine, you could run Anakin on x86-cpu,arm, nv-gpu, amd-gpu,bitmain and cambricon devices.
C++
531
star
37

VIMER

视觉预训练基础模型仓库
Python
494
star
38

PaddleTS

Awesome Easy-to-Use Deep Time Series Modeling based on PaddlePaddle, including comprehensive functionality modules like TSDataset, Analysis, Transform, Models, AutoTS, and Ensemble, etc., supporting versatile tasks like time series forecasting, representation learning, and anomaly detection, etc., featured with quick tracking of SOTA deep models.
Python
481
star
39

PaddleFL

Federated Deep Learning in PaddlePaddle
Python
480
star
40

PaddleFleetX

飞桨大模型开发套件,提供大语言模型、跨模态大模型、生物计算大模型等领域的全流程开发工具链。
Python
436
star
41

ERNIE-SDK

ERNIE Bot Agent is a Large Language Model (LLM) Agent Framework, powered by the advanced capabilities of ERNIE Bot and the platform resources of Baidu AI Studio.
Jupyter Notebook
341
star
42

PaddleSpatial

PaddleSpatial is an open-source spatial-temporal computing tool based on PaddlePaddle.
GLSL
331
star
43

PaddleRS

Awesome Remote Sensing Toolkit based on PaddlePaddle.
Python
330
star
44

PaddleMIX

Paddle Multimodal Integration and eXploration, supporting mainstream multi-modal tasks, including end-to-end large-scale multi-modal pretrain models and diffusion model toolbox. Equipped with high performance and flexibility.
Python
308
star
45

PaddleCloud

PaddlePaddle Docker images and K8s operators for PaddleOCR/Detection developers to use on public/private cloud.
Go
284
star
46

MetaGym

Collection of Reinforcement Learning / Meta Reinforcement Learning Environments.
Python
276
star
47

PASSL

PASSL包含 SimCLR,MoCo v1/v2,BYOL,CLIP,PixPro,simsiam, SwAV, BEiT,MAE 等图像自监督算法以及 Vision Transformer,DEiT,Swin Transformer,CvT,T2T-ViT,MLP-Mixer,XCiT,ConvNeXt,PVTv2 等基础视觉算法
Python
273
star
48

PaddleScience

PaddleScience is SDK and library for developing AI-driven scientific computing applications based on PaddlePaddle.
Python
259
star
49

InterpretDL

InterpretDL: Interpretation of Deep Learning Models,基于『飞桨』的模型可解释性算法库。
Python
241
star
50

docs

Documentations for PaddlePaddle
Python
240
star
51

Paddle-Inference-Demo

C++
235
star
52

PaddleRobotics

PaddleRobotics is an open-source algorithm library for robots based on Paddle, including open-source parts such as human-robot interaction, complex motion control, environment perception, SLAM positioning, and navigation.
Python
215
star
53

TrustAI

飞桨可信AI
Python
182
star
54

PALM

a Fast, Flexible, Extensible and Easy-to-use NLP Large-scale Pretraining and Multi-task Learning Framework.
Python
176
star
55

ElasticCTR

ElasticCTR,即飞桨弹性计算推荐系统,是基于Kubernetes的企业级推荐系统开源解决方案。该方案融合了百度业务场景下持续打磨的高精度CTR模型、飞桨开源框架的大规模分布式训练能力、工业级稀疏参数弹性调度服务,帮助用户在Kubernetes环境中一键完成推荐系统部署,具备高性能、工业级部署、端到端体验的特点,并且作为开源套件,满足二次深度开发的需求。
Python
176
star
56

AutoDL

Python
158
star
57

PLSC

Paddle Large Scale Classification Tools,supports ArcFace, CosFace, PartialFC, Data Parallel + Model Parallel. Model includes ResNet, ViT, Swin, DeiT, CaiT, FaceViT, MoCo, MAE, ConvMAE, CAE.
Python
148
star
58

CINN

Compiler Infrastructure for Neural Networks
C++
142
star
59

LiteKit

Off-The-Shelf AI Development Kit for APP Developers based on Paddle Lite (『飞桨』移动端开箱即用AI套件, 包含Java & Objective C接口支持)
Objective-C
134
star
60

PaddleFlow

Go
113
star
61

PaddleSports

Python
101
star
62

PaddleDTX

Paddle with Decentralized Trust based on Xuperchain
Go
89
star
63

PaConvert

PaddlePaddle Code Convert Toolkit. 『飞桨』深度学习代码转换工具
Python
87
star
64

XWorld

A C++/Python simulator package for reinforcement learning
C++
85
star
65

community

PaddlePaddle Developer Community
Jupyter Notebook
83
star
66

PaddleSleeve

PaddleSleeve
Python
76
star
67

benchmark

Python
76
star
68

hapi

hapi is a High-level API that supports both static and dynamic execution modes
Jupyter Notebook
76
star
69

Mobile

Embedded and Mobile Deployment
Python
71
star
70

PaddleCustomDevice

PaddlePaddle custom device implementaion. (『飞桨』自定义硬件接入实现)
Python
68
star
71

PaddleDepth

Python
63
star
72

PaddlePaddle.org

PaddlePaddle.org is the repository for the website of the PaddlePaddle open source project.
CSS
48
star
73

PaDiff

Paddle Automatically Diff Precision Toolkits.
Python
46
star
74

EasyData

Python
46
star
75

PaddleTest

PaddlePaddle TestSuite
Python
44
star
76

epep

Easy & Effective Application Framework for PaddlePaddle
Python
34
star
77

paddle-ce-latest-kpis

Paddle Continuous Evaluation, keep updating.
Python
26
star
78

VisionTools

Python
21
star
79

PaddleCraft

Take neural networks as APIs for human-like AI.
Python
20
star
80

Contrib

contribution works with PaddlePaddle from the third party developers
Python
20
star
81

PaddleTransfer

飞桨迁移学习算法库
Python
19
star
82

continuous_evaluation

Macro Continuous Evaluation Platform for Paddle.
Python
19
star
83

recordio

An implementation of the RecordIO file format.
Go
19
star
84

Perf

SOTA benchmark
Python
17
star
85

Paddle-bot

Python
17
star
86

examples

Python
17
star
87

continuous_integration

Python
16
star
88

PaddleSOT

A Bytecode level Implementation of Symbolic OpCode Translator For PaddlePaddle
Python
15
star
89

tape

C++
14
star
90

paddle_upgrade_tool

upgrade paddle-1.x to paddle-2.0
Python
12
star
91

PaddleAPEX

PaddleAPEX:Paddle Accuracy and Performance EXpansion pack
Python
7
star
92

talks

Shell
6
star
93

CLA

5
star
94

any

Legacy Repo only for PaddlePaddle with version <= 1.3
C++
5
star