All Projects → PaddlePaddle → LiteKit

PaddlePaddle / LiteKit

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

Programming Languages

objective c
16641 projects - #2 most used programming language
C++
36643 projects - #6 most used programming language
Objective-C++
1391 projects
java
68154 projects - #9 most used programming language
c
50402 projects - #5 most used programming language
python
139335 projects - #7 most used programming language

LiteKit接入文档

License

LiteKit是基于端推理框架LiteKitCore和端推理引擎PaddleLite,面向移动端工程师的AI能力解决方案。 LiteKit旨在为客户端应用提供开箱即用的离线的AI能力,使产品快速的简单的接入AI能力,并将提供的AI能力应用于各种业务场景。

目前已经支持的人像分割、手势识别、视频超分均来自百度各个产品线,已上线功能中,中台化输出的AI能力。

快速体验

效果展示

手势识别 人像分割

视频超分

增强前 增强后
SR SR

1. Android - 扫码安装

QR_Code

2. Demo Project 源码安装

git clone https://github.com/PaddlePaddle/LiteKit.git

iOS平台

示例工程中展示了人像分割、手势识别、视频超分能力。包括能力的接入demo和能力效果的展示。

示例工程部署
cd ./LiteKit/LiteKitDemo/iOS/LiteKitDemo
pod install --repo-update
open LiteKitDemo.xcworkspace

运行工程可在真机测试机上查看效果。

Android平台

  1. clone依赖SDK仓库作为LocalMaven仓库
git clone https://gitee.com/paddlepaddle/LiteKit
  1. 修改LiteKitDemo工程local.properties(文件位置在./LiteKitDemo/Android/LiteKitDemo/local.properties),添加MAVEN_REPO_LOCAL属性,值为第1步中clone的gitee仓库地址。 例如:
MAVEN_REPO_LOCAL = XXXXXXX
  1. 打开工程
cd ./LiteKit/LiteKitDemo/Android/LiteKitDemo
open -a /Applications/Android\ Studio.app ./
  1. Gradle sync & Run

安装SDK

LiteKit依赖关系如下:

其中:

  1. PaddleLite层,PaddleLite是一个高性能、轻量级、灵活性强且易于扩展的深度学习推理框架,LiteKitSDK的AI能力底层基于PaddleLite引擎实现。
  2. LiteKitCore层,LiteKitCore是一种跨平台的,面向移动开发者的,AI工程化的综合解决方案。LiteKitCore作为端模型预测的统一接入层,目的是端模型的快速工程化集成,降低客户端RD在端运行AI模型的门槛和提升集成效率,同时也能更好实现基于端模型业务能力的快速横向输出。目前为提供了Objective C,Java,C++三种语言的API。
  3. LiteKit层,视频超分,人像分割,手势识别,均称为LiteKit的业务SDK。每种业务SDK中,封装了对应AI能力的模型、预测的前后处理等逻辑。后续会产生更多覆盖其他AI场景的业务SDK。

1. 依赖

LiteKit由MIT License提供

功能 依赖 iOS版本 Android版本
手势识别 LiteKitHandGestureDetection 0.2.0 0.2.0
人像分割 LiteKitPortraitSegmentation 0.2.0 0.2.0
视频超分 LiteKitAIVideoSuperResolution 0.2.0 0.2.0

2. 安装

iOS 安装SDK

  • 系统最低版本iOS 9.0
  • 通过pod引入,参考
# coding: utf-8
source 'https://github.com/CocoaPods/Specs.git'

platform :ios

target 'LiteKitDemo' do
  project './LiteKitDemo.xcodeproj'
    platform :ios, '10.0'

    pod 'LiteKitHandGestureDetection', '~> 0.2.0'
    pod 'LiteKitPortraitSegmentation', '~> 0.2.0'
    pod 'LiteKitVideoSuperResolution', '~> 0.2.0'
end

Android 安装SDK

  • 系统最低API Level16(4.1版本)
  1. 将依赖SDK仓库作为LocalMaven仓库
git clone https://gitee.com/paddlepaddle/LiteKit
  1. 修改LiteKitDemo工程local.properties(例如./LiteKitDemo/Android/LiteKitDemo/local.properties),添加MAVEN_REPO_LOCAL属性,值为第1步中clone的gitee仓库地址。 例如:
MAVEN_REPO_LOCAL = XXXXXXX
  1. 在工程的gradle中增加配置LocalMaven,例如./LiteKitDemo/Android/LiteKitDemo/build.gradle
allprojects {
    repositories {
        google()
        jcenter()
        maven{ url getLocalProperty("MAVEN_REPO_LOCAL") + "/Android/repository" }
    }
}

/**
 * 从local.properties文件中读取配置
 *
 * @param propertyName 读取的参数名
 * @return 配置value
 */
def getLocalProperty(String propertyName) {
    Properties properties = new Properties()
    try {
        properties.load(project.rootProject.file('local.properties').newDataInputStream())
    } catch (Exception e) {
        println "read local.properties failed${e.message}"
    }
    String value =  properties.get(propertyName);
    System.out.println("key: " + propertyName + ", value: " +  value)
    return value
}
  1. 在app的gradle中增加配置引入SDK,例如./LiteKitDemo/Android/LiteKitDemo/app/build.gradle
dependencies {
    implementation 'com.baidu.litekit:handgesturedetector:0.2.0'
    implementation 'com.baidu.litekit:portraitsegmentation:0.2.0'
    implementation 'com.baidu.litekit:videosuperresolution:0.2.0'
}

API

LiteKit的AI能力,主要包含3类接口:创建、执行、释放。 使用时,先通过创建接口创建对应的预测引擎实例,之后可以通过执行接口进行预测,当使用完毕后需要对预测引擎实例进行释放。
其中执行接口通常有多个,可以接受不同格式的数据输入,以适应相机帧、图像、视频解码数据等不同也业务场景。

人像分割 API文档
手势识别 API文档
视频超分 API文档

隐私说明

LiteKit目前版本不会收集任何用户数据和用户信息,也不需要申请用户的隐私权限。

交流与反馈

     

   微信公众号                  官方技术交流微信群

版权和许可证

LiteKit由MIT License提供

FAQ

FAQ

LiteKitCore接入文档

一、介绍

1. 背景

LiteKitCore是一种跨平台的,面向移动开发者的,AI工程化的综合解决方案。LiteKitCore作为端模型预测的统一接入层,目的是端模型的快速工程化集成,降低客户端RD在端运行AI模型的门槛和提升集成效率,同时也能更好实现基于端模型业务能力的快速横向输出。基于LiteKitCore的端AI预测能力,可以快速的基于不同宿主进行集成与部署。LiteKitCore主要功能如下:模型加载,预测能力,前后处理能力,业务数据到Backend Input/Output的转换,Backend无感知升级,性能统计,容错处理,任务队列管理,运行时资源调度,生命周期管理等。

2. 兼容性

支持平台:iOS、Android、Native C++ 。

3. Demo Project

iOS示例工程包含了Native C++ API和Objective-C API的demo调用示例,Native C++ API和Objective-C API分别包含CPU和GPU两种backend,一共4种加载和预测的方式。针对C++API(在iOS上)和Objective-C API的CPU/GPU backend分别是对齐的,模型的加载和预测能力一致。但是CPU和GPU backend之间是隔离的,预测所使用的模型是不一样的。

部署iOS示例工程

  1. clone git仓库
git clone https://github.com/PaddlePaddle/LiteKit.git
  1. 添加LiteKitCore依赖 按照接入文档 for Objective-C API 构建产物LiteKit.framework放在./LiteKitCore/LiteKitCoreDemo/iOS/Dependence/*
    按照接入文档 for Native C++ API on iOS构建产物./LiteKitCore/LiteKitCore/C++/build-ios/product/release/*, *.h头文件到文件夹./LiteKitCore/LiteKitCoreDemo/iOS/Dependence/LiteKitCoreNative/include/*.h,liblitekit_framework_ios.a文件放到./LiteKitCore/LiteKitCoreDemo/iOS/Dependence/LiteKitCoreNative/liblitekit_framework_ios.a

  2. 打开工程

cd ./LiteKitCore/LiteKitCoreDemo/iOS
pod install
open LiteKitCoreDemo.xcworkspace
类名 说明
ViewController LiteKit(Objective-C & C++)以GPU、CPU作为backend的load及predict的demo code
ViewController+LiteKitCore_CPP LiteKit Native C++ API demo code
ViewController+LiteKitCore_OC LiteKit Objective-C API demo code

部署Android示例工程

  1. 环境部署
环境 版本
NDK android-ndk-r16b
cmake cmake 3.15.0

在~/.bashrc里指定cmake路径ANDROID_CMAKE和NDK路径ANDROID_NDK变量

  1. clone git仓库
git clone https://github.com/PaddlePaddle/LiteKit.git
  1. 根据接入文档 for Java API , 生成LiteKitCore-debug.aar,放置在./LiteKitCore/LiteKitCoreDemo/Android/app/libs/litekitcore-debug.aar路径下。
  2. 需要下载Demo依赖的opencv.so和libgnustl_shared.so,放置在./LiteKitCore/LiteKitCoreDemo/Android/app/src/main/cpp/libs路径下。
  3. 打开工程
cd ./LiteKit/LiteKitCore/LiteKitCoreDemo/Android
open -a /Applications/Android\ Studio.app ./
  1. Gradle sync & Run

二、接口文档

接口文档 for Native C++ API
接口文档 for Objective-C API
接口文档 for Java API

三、接入文档

接入文档 for Objective-C API
接入文档 for Native C++ API on iOS
接入文档 for Native C++ API on Android
接入文档 for Java API

FAQ

FAQ

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].