Skip to content

Commit

Permalink
release Android and iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
vnn committed Dec 7, 2021
0 parents commit be35ede
Show file tree
Hide file tree
Showing 442 changed files with 25,814 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
![Logo](./doc/resource/vnn_logo.png)

# 简介
VNN是由[欢聚集团(Joyy Inc.)](http://www.huanju.cn/)推出的高性能、轻量级神经网络部署框架。目前已为Hago、VOO、VFly、马克相机等App提供20余种AI能力的支持,覆盖直播、短视频、视频编辑等泛娱乐场景和工程场景

**特性**
- 免费:无授权控制,无广告植入
- 安全:零权限需求
- 跨平台一致设计和体验:良好支持Andorid/iOS/Windows/MacOS/Linux 5大系统平台
- 轻盈:全部功能SDK打包体积 Andorid 2.3M, iOS 2.0M
- 易用:API风格简洁、统一

---

# 支持能力
![ability](./doc/resource/ability.png)

---

# 效果展示
| ![disney_example](./doc/resource/disney_example.gif) | ![3dgame_example](./doc/resource/3dgame_example.gif) | ![comic_example](./doc/resource/comic_example.gif) |
| :--------------------------------------------------: | :--------------------------------------------------: | :--------------------------------------------------------: |
| [迪士尼人脸风格化](./doc/disney_face_stylizing.md) | [3D游戏人脸风格化](./doc/3d_game_face_stylizing.md) | [油画图像风格化](./doc/cartoonstylizing_comicstylizing.md) |

| ![portrait_segment_example](./doc/resource/portrait_segment_example.gif) | ![animal_segment_example](./doc/resource/animal_segment_example.gif) | ![sky_segment_example](./doc/resource/sky_segment_example.gif) |
| :----------------------------------------------------------------------: | :------------------------------------------------------------------: | :------------------------------------------------------------: |
| [人像分割](./doc/general_segmentation.md) | [动物分割](./doc/general_segmentation.md) | [天空分割](./doc/general_segmentation.md) |

| ![clothes_segment_example](./doc/resource/clothes_segment_example.gif) | ![animal_segment_example](./doc/resource/hair_segment_eaxmple.gif) | ![face_reenactment_example](./doc/resource/face_reenactment_example.gif) |
| :--------------------------------------------------------------------: | :----------------------------------------------------------------: | :----------------------------------------------------------------------: |
| [衣物分割(换色)](./doc/general_segmentation.md) | [头发分割(换色)](./doc/general_segmentation.md) | [人脸表情驱动](./doc/face_reenactment.md) |

---

## Demo体验

[Android Demo APK](./demos/Android/vnn_demo.apk)
[Android Demo工程](./demos/Android)
[iOS Demo工程](./demos/iOS)

---

## 集成指引与SDK文档

[Android集成指引](./demos/Android/readme.md)
[iOS集成指引](./demos/iOS/readme.md)
[SDK文档索引](./doc/doc_index.md)
[常见问题](./doc/question_and_answer.md)

---

## 更新计划
- 支持 Windows/MacOS/Linux 平台
- 新增 人体关键点检测(Pose Detection)SDK

---
## License

[MIT](./license.txt)
27 changes: 27 additions & 0 deletions demos/Android/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
- [1. Android apk](#1-android-apk)
- [2. Android工程](#2-android工程)
- [1. 头文件](#1-头文件)
- [2. 库文件](#2-库文件)
- [3. 模型文件](#3-模型文件)
- [4. 编译Android工程生成apk即可](#4-编译android工程生成apk即可)
- [5. 其它](#5-其它)
- [(1) 横竖屏问题:Demo目前只支持竖屏显示效果。](#1-横竖屏问题demo目前只支持竖屏显示效果)

# 1. Android apk
可直接在Android手机上安装使用
[APK下载链接](./vnn_demo.apk)
# 2. Android工程
## 1. 头文件
拷贝根目录下 ```libs/headers``` 文件夹中的头文件放入```vnn_android_demo/vnnlib/src/main/cpp/include``` 文件夹中
![include](./../../doc/resource/android_include_setting.png)
## 2. 库文件
拷贝根目录下 ```libs/Android``` 文件夹下内容放入 ```vnn_android_demo/vnnlib/src/main/cpp/libs``` 文件夹中
![libs](./../../doc/resource/android_libs_setting.png)
## 3. 模型文件
拷贝根目录下models文件夹中的内容放入 ```vnn_android_demo/app/src/main/assets/vnn_models``` 文件夹中
![models](./../../doc/resource/android_models_setting.png)
## 4. 编译Android工程生成apk即可
如果对assets中的内容做改动,需要先卸载已经安装的vnn的apk, 再重新安装(因为demo未对assets内容二进制校验,只校验了文件夹, 新添加的文件夹会自动拷贝到手机上)
## 5. 其它
### (1) 横竖屏问题:Demo目前只支持竖屏显示效果,横屏未对结果做相应的渲染适配。
### (2) 涉及到多个人脸的,与分割有关的,如头部分割,3d game风格等,会产生多个mask。 demo只是简单的将所有的mask画到同一张图上,再做后续处理,因为mask的重叠问题,可能会引起效果上的显示问题,实际使用时应该每个mask都单独做后续处理。
15 changes: 15 additions & 0 deletions demos/Android/vnn_android_demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
3 changes: 3 additions & 0 deletions demos/Android/vnn_android_demo/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions demos/Android/vnn_android_demo/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions demos/Android/vnn_android_demo/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions demos/Android/vnn_android_demo/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions demos/Android/vnn_android_demo/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions demos/Android/vnn_android_demo/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions demos/Android/vnn_android_demo/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
60 changes: 60 additions & 0 deletions demos/Android/vnn_android_demo/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
plugins {
id 'com.android.application'
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"

defaultConfig {
applicationId "com.duowan.vnndemo"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

// ndk {
// abiFilters 'armeabi-v7a'
// abiFilters 'arm64-v8a'
// }
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation project(':vnnlib')
// def camerax_version = "1.0.1"
//// CameraX core library using camera2 implementation
// implementation "androidx.camera:camera-camera2:$camerax_version"
//// CameraX Lifecycle Library
// implementation "androidx.camera:camera-lifecycle:$camerax_version"
//// CameraX View class
// implementation "androidx.camera:camera-view:1.0.0-alpha27"
def camerax_version = "1.0.0-beta03"
// CameraX core library using camera2 implementation
implementation "androidx.camera:camera-camera2:$camerax_version"
// CameraX Lifecycle Library
implementation "androidx.camera:camera-lifecycle:$camerax_version"
// CameraX View class
implementation "androidx.camera:camera-view:1.0.0-alpha10"
}
21 changes: 21 additions & 0 deletions demos/Android/vnn_android_demo/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.duowan.vnndemo;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.duowan.vnndemo", appContext.getPackageName());
}
}
45 changes: 45 additions & 0 deletions demos/Android/vnn_android_demo/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.duowan.vnndemo">

<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/>
<application
android:allowBackup="true"
android:icon="@drawable/icon_vnn"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Vnndemo">
<activity android:name="com.duowan.vnndemo.MainActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.duowan.vnndemo.StreamProducers"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:screenOrientation="portrait">
</activity>
<activity
android:name="com.duowan.vnndemo.CameraActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:screenOrientation="portrait">
</activity>
<activity
android:name="com.duowan.vnndemo.ImageActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:screenOrientation="portrait">
</activity>
</application>

</manifest>
Empty file.
Loading

0 comments on commit be35ede

Please sign in to comment.