{"id":18525013,"url":"https://github.com/paddlepaddle/litekit","last_synced_at":"2025-04-09T12:31:06.314Z","repository":{"id":46703421,"uuid":"302509341","full_name":"PaddlePaddle/LiteKit","owner":"PaddlePaddle","description":"Off-The-Shelf AI Development Kit for APP Developers based on Paddle Lite （『飞桨』移动端开箱即用AI套件, 包含Java \u0026 Objective C接口支持）","archived":false,"fork":false,"pushed_at":"2021-06-25T09:30:21.000Z","size":80754,"stargazers_count":135,"open_issues_count":12,"forks_count":13,"subscribers_count":7,"default_branch":"develop","last_synced_at":"2025-03-24T05:34:49.608Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/PaddlePaddle/LiteKit","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PaddlePaddle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-09T02:10:33.000Z","updated_at":"2025-02-19T08:59:51.000Z","dependencies_parsed_at":"2022-09-10T15:21:25.535Z","dependency_job_id":null,"html_url":"https://github.com/PaddlePaddle/LiteKit","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddlePaddle%2FLiteKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddlePaddle%2FLiteKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddlePaddle%2FLiteKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddlePaddle%2FLiteKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaddlePaddle","download_url":"https://codeload.github.com/PaddlePaddle/LiteKit/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248040140,"owners_count":21037821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T17:44:12.246Z","updated_at":"2025-04-09T12:31:01.300Z","avatar_url":"https://github.com/PaddlePaddle.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LiteKit接入文档\n\n[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)\n\nLiteKit是基于端推理框架LiteKitCore和端推理引擎PaddleLite，面向移动端工程师的AI能力解决方案。\nLiteKit旨在为客户端应用提供开箱即用的离线的AI能力，使产品快速的简单的接入AI能力，并将提供的AI能力应用于各种业务场景。\n\n目前已经支持的人像分割、手势识别、视频超分均来自百度各个产品线，已上线功能中，中台化输出的AI能力。\n\n## 快速体验\n\n### 效果展示\n| 手势识别 | 人像分割 |\n| --- | --- |\n| \u003cdiv align=center\u003e\u003cimg width=\"320\" height=\"480\"  src=\"/Doc/Resources/1_5.gif\"/\u003e\u003c/div\u003e | \u003cdiv align=center\u003e\u003cimg width=\"320\" height=\"315\"  src=\"/Doc/Resources/1_6.gif\"/\u003e\u003c/div\u003e |\n\n视频超分\n| 增强前 | 增强后 |\n| --- | --- |\n| ![SR](/Doc/Resources/1_7.png) | ![SR](/Doc/Resources/1_7_2.png) |\n### 1. Android - 扫码安装\u003cbr\u003e\n![QR_Code](/Doc/Resources/1_3.png)\n\n### 2. Demo Project 源码安装\n\n```\ngit clone https://github.com/PaddlePaddle/LiteKit.git\n```\n\n\n#### iOS平台\n示例工程中展示了人像分割、手势识别、视频超分能力。包括能力的接入demo和能力效果的展示。\n\n###### 示例工程部署\n```\ncd ./LiteKit/LiteKitDemo/iOS/LiteKitDemo\npod install --repo-update\nopen LiteKitDemo.xcworkspace\n```\n运行工程可在真机测试机上查看效果。\n\n\n#### Android平台\n1. clone依赖SDK仓库作为LocalMaven仓库\n```\ngit clone https://gitee.com/paddlepaddle/LiteKit\n```\n\n2. 修改LiteKitDemo工程local.properties（文件位置在`./LiteKitDemo/Android/LiteKitDemo/local.properties`)，添加MAVEN_REPO_LOCAL属性，值为第1步中clone的gitee仓库地址。\n例如：\n```\nMAVEN_REPO_LOCAL = XXXXXXX\n```\n\n3. 打开工程\n```\ncd ./LiteKit/LiteKitDemo/Android/LiteKitDemo\nopen -a /Applications/Android\\ Studio.app ./\n```\n\n4. Gradle sync \u0026 Run\n\n\n\n## 安装SDK\n\nLiteKit依赖关系如下：\n\u003cp align=\"center\"\u003e\u003cimg width=\"450\" src=\"/Doc/Resources/1_4.png\"/\u003e\u003c/p\u003e\n\n其中：\n1. PaddleLite层，[PaddleLite](https://github.com/PaddlePaddle/Paddle-Lite)是一个高性能、轻量级、灵活性强且易于扩展的深度学习推理框架，LiteKitSDK的AI能力底层基于PaddleLite引擎实现。\n2. LiteKitCore层，LiteKitCore是一种跨平台的，面向移动开发者的，AI工程化的综合解决方案。LiteKitCore作为端模型预测的统一接入层，目的是端模型的快速工程化集成，降低客户端RD在端运行AI模型的门槛和提升集成效率，同时也能更好实现基于端模型业务能力的快速横向输出。目前为提供了Objective C，Java，C++三种语言的API。\n3. LiteKit层，视频超分，人像分割，手势识别，均称为LiteKit的业务SDK。每种业务SDK中，封装了对应AI能力的模型、预测的前后处理等逻辑。后续会产生更多覆盖其他AI场景的业务SDK。\n\n### 1. 依赖\nLiteKit由[MIT License](LICENSE)提供\n\n| 功能 |依赖 | iOS版本| Android版本 |\n|---|---|---|---|\n| 手势识别 |LiteKitHandGestureDetection    | 0.2.0 | 0.2.0 | \n| 人像分割 |LiteKitPortraitSegmentation      | 0.2.0 | 0.2.0 |\n| 视频超分 |LiteKitAIVideoSuperResolution  | 0.2.0 | 0.2.0 |\n\n### 2. 安装\n#### iOS 安装SDK\n- 系统最低版本iOS 9.0\n- 通过pod引入，[参考](/LiteKitDemo/iOS/LiteKitDemo/Podfile)\n```ruby\n# coding: utf-8\nsource 'https://github.com/CocoaPods/Specs.git'\n\nplatform :ios\n\ntarget 'LiteKitDemo' do\n  project './LiteKitDemo.xcodeproj'\n    platform :ios, '10.0'\n\n    pod 'LiteKitHandGestureDetection', '~\u003e 0.2.0'\n    pod 'LiteKitPortraitSegmentation', '~\u003e 0.2.0'\n    pod 'LiteKitVideoSuperResolution', '~\u003e 0.2.0'\nend\n\n```\n\n#### Android 安装SDK\n- 系统最低API Level16（4.1版本）\n1. 将依赖SDK仓库作为LocalMaven仓库\n```\ngit clone https://gitee.com/paddlepaddle/LiteKit\n```\n\n2. 修改LiteKitDemo工程local.properties（例如`./LiteKitDemo/Android/LiteKitDemo/local.properties`)，添加MAVEN_REPO_LOCAL属性，值为第1步中clone的gitee仓库地址。\n例如：\n```\nMAVEN_REPO_LOCAL = XXXXXXX\n```\n\n3. 在工程的gradle中增加配置LocalMaven，例如`./LiteKitDemo/Android/LiteKitDemo/build.gradle`\n```groovy\n\nallprojects {\n    repositories {\n        google()\n        jcenter()\n        maven{ url getLocalProperty(\"MAVEN_REPO_LOCAL\") + \"/Android/repository\" }\n    }\n}\n\n/**\n * 从local.properties文件中读取配置\n *\n * @param propertyName 读取的参数名\n * @return 配置value\n */\ndef getLocalProperty(String propertyName) {\n    Properties properties = new Properties()\n    try {\n        properties.load(project.rootProject.file('local.properties').newDataInputStream())\n    } catch (Exception e) {\n        println \"read local.properties failed${e.message}\"\n    }\n    String value =  properties.get(propertyName);\n    System.out.println(\"key: \" + propertyName + \", value: \" +  value)\n    return value\n}\n```\n\n4. 在app的gradle中增加配置引入SDK，例如`./LiteKitDemo/Android/LiteKitDemo/app/build.gradle`\n```groovy\n\ndependencies {\n    implementation 'com.baidu.litekit:handgesturedetector:0.2.0'\n    implementation 'com.baidu.litekit:portraitsegmentation:0.2.0'\n    implementation 'com.baidu.litekit:videosuperresolution:0.2.0'\n}\n```\n\n\n## API\nLiteKit的AI能力，主要包含3类接口：创建、执行、释放。\n使用时，先通过创建接口创建对应的预测引擎实例，之后可以通过执行接口进行预测，当使用完毕后需要对预测引擎实例进行释放。\n\u003cbr\u003e\n其中执行接口通常有多个，可以接受不同格式的数据输入，以适应相机帧、图像、视频解码数据等不同也业务场景。\n\n\u003cp align=\"center\"\u003e\u003cimg width=\"800\" src=\"/Doc/Resources/1_8.png\"/\u003e\u003c/p\u003e\n\n[人像分割 API文档](/Doc/LiteKit接口文档_人像分割.md) \u003cbr\u003e\n[手势识别 API文档](/Doc/LiteKit接口文档_手势识别.md) \u003cbr\u003e\n[视频超分 API文档](/Doc/LiteKit接口文档_视频超分.md) \u003cbr\u003e\n\n\n## 隐私说明\nLiteKit目前版本不会收集任何用户数据和用户信息，也不需要申请用户的隐私权限。\n\n## 交流与反馈\n\u003cp align=\"center\"\u003e\n    \u003cimg width=\"200\" height=\"200\"  src=\"https://user-images.githubusercontent.com/45189361/64117959-1969de80-cdc9-11e9-84f7-e1c2849a004c.jpeg\"/\u003e\n    \u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\n    \u003cimg width=\"200\" height=\"200\"  src=\"/Doc/Resources/1_9.png\"/\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u0026#8194;\u0026#8194;\u0026#8194;微信公众号\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\n\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;\u0026#8194;官方技术交流微信群\n\u003c/p\u003e\n\n\n## 版权和许可证\nLiteKit由[MIT License](LICENSE)提供\n\n\n## FAQ\n[FAQ](/Doc/LiteKitFAQ.md)\n\n\n\n# LiteKitCore接入文档\n## 一、介绍\n### 1. 背景\nLiteKitCore是一种跨平台的，面向移动开发者的，AI工程化的综合解决方案。LiteKitCore作为端模型预测的统一接入层，目的是端模型的快速工程化集成，降低客户端RD在端运行AI模型的门槛和提升集成效率，同时也能更好实现基于端模型业务能力的快速横向输出。基于LiteKitCore的端AI预测能力，可以快速的基于不同宿主进行集成与部署。LiteKitCore主要功能如下：模型加载，预测能力，前后处理能力，业务数据到Backend Input/Output的转换，Backend无感知升级，性能统计，容错处理，任务队列管理，运行时资源调度，生命周期管理等。\n\n\n### 2. 兼容性\n支持平台：iOS、Android、Native C++ 。\u003cbr\u003e\n\n\n### 3. Demo Project\niOS示例工程包含了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之间是隔离的，预测所使用的模型是不一样的。\n\n#### 部署iOS示例工程\n1. clone git仓库\n```\ngit clone https://github.com/PaddlePaddle/LiteKit.git\n```\n\n2. 添加LiteKitCore依赖\n按照[接入文档 for Objective-C API ](/Doc/LiteKitCore接入文档(for%20Objective-C%20API).md)构建产物`LiteKit.framework`放在`./LiteKitCore/LiteKitCoreDemo/iOS/Dependence/*`\u003c/br\u003e\n按照[接入文档 for Native C++ API on iOS](/Doc/LiteKitCore接入文档(for%20Native%20C%2B%2B%20API%20on%20iOS).md)构建产物`./LiteKitCore/LiteKitCore/C++/build-ios/product/release/*`，\n*.h头文件到文件夹`./LiteKitCore/LiteKitCoreDemo/iOS/Dependence/LiteKitCoreNative/include/*.h`，liblitekit_framework_ios.a文件放到`./LiteKitCore/LiteKitCoreDemo/iOS/Dependence/LiteKitCoreNative/liblitekit_framework_ios.a`\n\n3. 打开工程\n```\ncd ./LiteKitCore/LiteKitCoreDemo/iOS\npod install\nopen LiteKitCoreDemo.xcworkspace\n```\n\n|类名 | 说明 | \n|---|---|\n|ViewController |LiteKit（Objective-C \u0026 C++）以GPU、CPU作为backend的load及predict的demo code |\n| ViewController+LiteKitCore_CPP | LiteKit Native C++ API demo code|\n| ViewController+LiteKitCore_OC | LiteKit Objective-C API demo code|\n\n#### 部署Android示例工程  \n1. 环境部署\n\n| 环境 | 版本 | \n| ----- | ----- |\n| NDK |[android-ndk-r16b](https://developer.android.google.cn/ndk/downloads/older_releases) |\n| cmake | cmake 3.15.0 |\n\n在~/.bashrc里指定cmake路径`ANDROID_CMAKE`和NDK路径`ANDROID_NDK`变量\n\n2. clone git仓库\n```\ngit clone https://github.com/PaddlePaddle/LiteKit.git\n```\n\n3. 根据[接入文档 for Java API ](/Doc/LiteKitCore接入文档(for%20Java%20API).md), 生成`LiteKitCore-debug.aar`，放置在`./LiteKitCore/LiteKitCoreDemo/Android/app/libs/litekitcore-debug.aar`路径下。\n4. 需要[下载](https://gitee.com/paddlepaddle/LiteKit/tree/main/Android/LiteKitCoreDemoDependency/opencv/0.1.0)Demo依赖的opencv.so和libgnustl_shared.so，放置在`./LiteKitCore/LiteKitCoreDemo/Android/app/src/main/cpp/libs`路径下。\n5. 打开工程\n```\ncd ./LiteKit/LiteKitCore/LiteKitCoreDemo/Android\nopen -a /Applications/Android\\ Studio.app ./\n```\n\n6. Gradle sync \u0026 Run\n\n## 二、接口文档\n[接口文档 for Native C++ API](/Doc/LiteKitCore接口文档(for%20Native%20C%2B%2B%20API).md)\n\u003cbr\u003e\n[接口文档 for Objective-C API ](/Doc/LiteKitCore接口文档(for%20Objective-C%20API).md)\n\u003cbr\u003e\n[接口文档 for Java API ](/Doc/LiteKitCore接口文档(for%20Java%20API).md)\n\n## 三、接入文档\n[接入文档 for Objective-C API ](/Doc/LiteKitCore接入文档(for%20Objective-C%20API).md)\n\u003cbr\u003e\n[接入文档 for Native C++ API on iOS](/Doc/LiteKitCore接入文档(for%20Native%20C%2B%2B%20API%20on%20iOS).md)\n\u003cbr\u003e\n[接入文档 for Native C++ API on Android](/Doc/LiteKitCore接入文档(for%20Native%20C%2B%2B%20API%20on%20Android).md)\n\u003cbr\u003e\n[接入文档 for Java API ](/Doc/LiteKitCore接入文档(for%20Java%20API).md)\n\n\n\n## FAQ\n[FAQ](/Doc/LiteKitCoreFAQ.md)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaddlepaddle%2Flitekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaddlepaddle%2Flitekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaddlepaddle%2Flitekit/lists"}