diff --git a/examples/vision/detection/paddledetection/android/.gitignore b/examples/vision/detection/paddledetection/android/.gitignore index 7fde52902..f6eba672f 100644 --- a/examples/vision/detection/paddledetection/android/.gitignore +++ b/examples/vision/detection/paddledetection/android/.gitignore @@ -11,3 +11,10 @@ app/build app/src/main/assets/models/* app/.gradle app/.idea +fastdeploy/cache +fastdeploy/libs/fastdeploy* +fastdeploy/.cxx +fastdeploy/build +fastdeploy/src/main/assets/models/* +fastdeploy/.gradle +fastdeploy/.idea diff --git a/examples/vision/detection/paddledetection/android/README.md b/examples/vision/detection/paddledetection/android/README.md index 4a57f98f9..17ba4cd44 100644 --- a/examples/vision/detection/paddledetection/android/README.md +++ b/examples/vision/detection/paddledetection/android/README.md @@ -7,8 +7,6 @@ 1. 在本地环境安装好 Android Studio 工具,详细安装方法请见[Android Stuido 官网](https://developer.android.com/studio)。 2. 准备一部 Android 手机,并开启 USB 调试模式。开启方法: `手机设置 -> 查找开发者选项 -> 打开开发者选项和 USB 调试模式` -**注意**:如果您的 Android Studio 尚未配置 NDK ,请根据 Android Studio 用户指南中的[安装及配置 NDK 和 CMake ](https://developer.android.com/studio/projects/install-ndk)内容,预先配置好 NDK 。您可以选择最新的 NDK 版本,或者使用 FastDeploy Android 预测库版本一样的 NDK - ## 部署步骤 1. 目标检测 PicoDet Demo 位于 `fastdeploy/examples/vision/detection/paddledetection/android` 目录 @@ -16,23 +14,20 @@ 3. 手机连接电脑,打开 USB 调试和文件传输模式,并在 Android Studio 上连接自己的手机设备(手机需要开启允许从 USB 安装软件权限)

-image +image

> **注意:** ->> 如果您在导入项目、编译或者运行过程中遇到 NDK 配置错误的提示,请打开 ` File > Project Structure > SDK Location`,修改 `Andriod NDK location` 为您本机配置的 NDK 所在路径。本工程默认使用的NDK版本为20. ->> 如果您是通过 Andriod Studio 的 SDK Tools 下载的 NDK (见本章节"环境准备"),可以直接点击下拉框选择默认路径。 ->> 还有一种 NDK 配置方法,你可以在 `paddledetection/android/local.properties` 文件中手动完成 NDK 路径配置,如下图所示 ->> 如果以上步骤仍旧无法解决 NDK 配置错误,请尝试根据 Andriod Studio 官方文档中的[更新 Android Gradle 插件](https://developer.android.com/studio/releases/gradle-plugin?hl=zh-cn#updating-plugin)章节,尝试更新Android Gradle plugin版本。 +>> 如果您在导入项目、编译或者运行过程中遇到 NDK 配置错误的提示,请打开 ` File > Project Structure > SDK Location`,修改 `Andriod SDK location` 为您本机配置的 SDK 所在路径。 -4. 点击 Run 按钮,自动编译 APP 并安装到手机。(该过程会自动下载预编译的 FastDeploy Android 库,需要联网) +4. 点击 Run 按钮,自动编译 APP 并安装到手机。(该过程会自动下载预编译的 FastDeploy Android 库 以及 模型文件,需要联网) 成功后效果如下,图一:APP 安装到手机;图二: APP 打开后的效果,会自动识别图片中的物体并标记;图三:APP设置选项,点击右上角的设置图片,可以设置不同选项进行体验。 - | APP 图标 | APP 效果 | APP设置项 + | APP 图标 | APP 效果 | APP设置项 | --- | --- | --- | - | ![app_pic ](https://user-images.githubusercontent.com/31974251/197170082-a2bdd49d-60ea-4df0-af63-18ed898a746e.jpg) | ![app_res](https://user-images.githubusercontent.com/31974251/197169609-bb214af3-d6e7-4433-bb96-1225cddd441c.jpg) | ![app_setup](https://user-images.githubusercontent.com/31974251/197332983-afbfa6d5-4a3b-4c54-a528-4a3e58441be1.jpg) | + | ![app_pic](https://user-images.githubusercontent.com/31974251/203268599-c94018d8-3683-490a-a5c7-a8136a4fa284.jpg) | ![app_res](https://user-images.githubusercontent.com/31974251/197169609-bb214af3-d6e7-4433-bb96-1225cddd441c.jpg) | ![app_setup](https://user-images.githubusercontent.com/31974251/197332983-afbfa6d5-4a3b-4c54-a528-4a3e58441be1.jpg) | -## PicoDet Java API 说明 +### PicoDet Java API 说明 - 模型初始化 API: 模型初始化API包含两种方式,方式一是通过构造函数直接初始化;方式二是,通过调用init函数,在合适的程序节点进行初始化。PicoDet初始化参数说明如下: - modelFile: String, paddle格式的模型文件路径,如 model.pdmodel - paramFile: String, paddle格式的参数文件路径,如 model.pdiparams @@ -56,13 +51,15 @@ public boolean init(String modelFile, String paramsFile, String configFile, Stri // 直接预测:不保存图片以及不渲染结果到Bitmap上 public DetectionResult predict(Bitmap ARGB8888Bitmap); // 预测并且可视化:预测结果以及可视化,并将可视化后的图片保存到指定的途径,以及将可视化结果渲染在Bitmap上 -public DetectionResult predict(Bitmap ARGB8888Bitmap, String savedImagePath, float scoreThreshold) +public DetectionResult predict(Bitmap ARGB8888Bitmap, String savedImagePath, float scoreThreshold); +public DetectionResult predict(Bitmap ARGB8888Bitmap, boolean rendering, float scoreThreshold); // 只渲染 不保存图片 ``` - 模型资源释放 API:调用 release() API 可以释放模型资源,返回true表示释放成功,false表示失败;调用 initialized() 可以判断模型是否初始化成功,true表示初始化成功,false表示失败。 ```java public boolean release(); // 释放native资源 public boolean initialized(); // 检查是否初始化成功 -``` +``` + - RuntimeOption设置说明 ```java public void enableLiteFp16(); // 开启fp16精度推理 @@ -70,16 +67,18 @@ public void disableLiteFP16(); // 关闭fp16精度推理 public void setCpuThreadNum(int threadNum); // 设置线程数 public void setLitePowerMode(LitePowerMode mode); // 设置能耗模式 public void setLitePowerMode(String modeStr); // 通过字符串形式设置能耗模式 -public void enableRecordTimeOfRuntime(); // 是否打印模型运行耗时 ``` - 模型结果DetectionResult说明 ```java -public float[][] mBoxes; // [n,4] 检测框 (x1,y1,x2,y2) -public float[] mScores; // [n] 得分 -public int[] mLabelIds; // [n] 分类ID -public boolean initialized(); // 检测结果是否有效 +public class DetectionResult { + public float[][] mBoxes; // [n,4] 检测框 (x1,y1,x2,y2) + public float[] mScores; // [n] 每个检测框得分(置信度,概率值) + public int[] mLabelIds; // [n] 分类ID + public boolean initialized(); // 检测结果是否有效 +} ``` +其他参考:C++/Python对应的DetectionResult说明: [api/vision_results/detection_result.md](https://github.com/PaddlePaddle/FastDeploy/blob/develop/docs/api/vision_results/detection_result.md) - 模型调用示例1:使用构造函数以及默认的RuntimeOption ```java @@ -125,32 +124,28 @@ String configFile = "picodet_s_320_coco_lcnet/infer_cfg.yml"; RuntimeOption option = new RuntimeOption(); option.setCpuThreadNum(2); option.setLitePowerMode(LitePowerMode.LITE_POWER_HIGH); -option.enableRecordTimeOfRuntime(); option.enableLiteFp16(); // 使用init函数初始化 model.init(modelFile, paramFile, configFile, option); // Bitmap读取、模型预测、资源释放 同上 ... ``` -更详细的用法请参考 [MainActivity](./app/src/main/java/com/baidu/paddle/fastdeploy/examples/MainActivity.java#L207) 中的用法 +更详细的用法请参考 [DetectionMainActivity](./app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/detection/DetectionMainActivity.java) 中的用法 + +## 替换 FastDeploy SDK和模型 +替换FastDeploy预测库和模型的步骤非常简单。预测库所在的位置为 `app/libs/fastdeploy-android-sdk-xxx.aar`,其中 `xxx` 表示当前您使用的预测库版本号。模型所在的位置为,`app/src/main/assets/models/picodet_s_320_coco_lcnet`。 +- 替换FastDeploy Android SDK: 下载或编译最新的FastDeploy Android SDK,解压缩后放在 `app/libs` 目录下;详细配置文档可参考: + - [在 Android 中使用 FastDeploy Java SDK](../../../../../java/android/) -## 替换 FastDeploy 预测库和模型 -替换FastDeploy预测库和模型的步骤非常简单。预测库所在的位置为 `app/libs/fastdeploy-android-xxx-shared`,其中 `xxx` 表示当前您使用的预测库版本号。模型所在的位置为,`app/src/main/assets/models/picodet_s_320_coco_lcnet`。 -- 替换FastDeploy预测库的步骤: - - 下载或编译最新的FastDeploy Android预测库,解压缩后放在 `app/libs` 目录下; - - 修改 `app/src/main/cpp/CMakeLists.txt` 中的预测库路径,指向您下载或编译的预测库路径。如: -```cmake -set(FastDeploy_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/fastdeploy-android-xxx-shared") -``` - 替换PicoDet模型的步骤: - 将您的PicoDet模型放在 `app/src/main/assets/models` 目录下; - 修改 `app/src/main/res/values/strings.xml` 中模型路径的默认值,如: ```xml -models/picodet_s_320_coco_lcnet -labels/coco_label_list.txt +models/picodet_s_320_coco_lcnet +labels/coco_label_list.txt ``` -## 如何通过 JNI 在 Native 层接入 FastDeploy C++ API ? -如果您对如何通过JNI来接入FastDeploy C++ API感兴趣,可以参考以下内容: -- [app/src/main/cpp 代码实现](./app/src/main/cpp/) +## 更多参考文档 +如果您想知道更多的FastDeploy Java API文档以及如何通过JNI来接入FastDeploy C++ API感兴趣,可以参考以下内容: +- [在 Android 中使用 FastDeploy Java SDK](../../../../../java/android/) - [在 Android 中使用 FastDeploy C++ SDK](../../../../../docs/cn/faq/use_cpp_sdk_on_android.md) diff --git a/examples/vision/detection/paddledetection/android/app/build.gradle b/examples/vision/detection/paddledetection/android/app/build.gradle index 2d41f85a6..c02e5daf5 100644 --- a/examples/vision/detection/paddledetection/android/app/build.gradle +++ b/examples/vision/detection/paddledetection/android/app/build.gradle @@ -6,21 +6,13 @@ android { compileSdk 28 defaultConfig { - applicationId "com.baidu.paddle.fastdeploy" + applicationId 'com.baidu.paddle.fastdeploy.app.examples' minSdkVersion 15 //noinspection ExpiredTargetSdkVersion targetSdkVersion 28 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - - externalNativeBuild { - cmake { - arguments '-DANDROID_PLATFORM=android-21', '-DANDROID_STL=c++_shared', "-DANDROID_TOOLCHAIN=clang" - abiFilters 'armeabi-v7a', 'arm64-v8a' - cppFlags "-std=c++11" - } - } } buildTypes { @@ -30,17 +22,10 @@ android { } } - externalNativeBuild { - cmake { - path file('src/main/cpp/CMakeLists.txt') - version '3.10.2' - } - } - ndkVersion '20.1.5948944' } dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') + implementation fileTree(include: ['*.aar'], dir: 'libs') implementation 'com.android.support:appcompat-v7:28.0.0' //noinspection GradleDependency implementation 'com.android.support.constraint:constraint-layout:1.1.3' @@ -52,49 +37,81 @@ dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' } -def archives = [ +def FD_MODEL = [ [ - 'src' : 'https://bj.bcebos.com/fastdeploy/release/android/fastdeploy-android-0.4.0-shared.tgz', - 'dest': 'libs' - ], - [ - 'src': 'https://bj.bcebos.com/paddlehub/fastdeploy/picodet_s_320_coco_lcnet.tgz', - 'dest' : 'src/main/assets/models' - ], - [ - 'src': 'https://bj.bcebos.com/paddlehub/fastdeploy/picodet_l_320_coco_lcnet.tgz', - 'dest' : 'src/main/assets/models' + 'src' : 'https://bj.bcebos.com/paddlehub/fastdeploy/picodet_s_320_coco_lcnet.tgz', + 'dest': 'src/main/assets/models' ] ] -task downloadAndExtractArchives(type: DefaultTask) { +def FD_JAVA_SDK = [ + [ + 'src' : 'https://bj.bcebos.com/fastdeploy/test/fastdeploy-android-sdk-latest-dev.aar', + 'dest': 'libs' + ] +] + +task downloadAndExtractModels(type: DefaultTask) { doFirst { - println "Downloading and extracting archives including libs and models" + println "Downloading and extracting fastdeploy models ..." } doLast { - // Prepare cache folder for archives String cachePath = "cache" if (!file("${cachePath}").exists()) { mkdir "${cachePath}" } - archives.eachWithIndex { archive, index -> + FD_MODEL.eachWithIndex { model, index -> MessageDigest messageDigest = MessageDigest.getInstance('MD5') - messageDigest.update(archive.src.bytes) - String cacheName = new BigInteger(1, messageDigest.digest()).toString(32) - // Download the target archive if not exists - boolean copyFiles = !file("${archive.dest}").exists() - if (!file("${cachePath}/${cacheName}.tgz").exists()) { - ant.get(src: archive.src, dest: file("${cachePath}/${cacheName}.tgz")) - copyFiles = true // force to copy files from the latest archive files + messageDigest.update(model.src.bytes) + String[] modelPaths = model.src.split("/") + String modelName = modelPaths[modelPaths.length - 1] + // Download the target model if not exists + boolean copyFiles = !file("${model.dest}").exists() + if (!file("${cachePath}/${modelName}").exists()) { + println "Downloading ${model.src} -> ${cachePath}/${modelName}" + ant.get(src: model.src, dest: file("${cachePath}/${modelName}")) + copyFiles = true } - // Extract the target archive if its dest path does not exists if (copyFiles) { + println "Coping ${cachePath}/${modelName} -> ${model.dest}" copy { - from tarTree("${cachePath}/${cacheName}.tgz") - into "${archive.dest}" + from tarTree("${cachePath}/${modelName}") + into "${model.dest}" } } } } } -preBuild.dependsOn downloadAndExtractArchives \ No newline at end of file + +task downloadAndExtractSDKs(type: DefaultTask) { + doFirst { + println "Downloading and extracting fastdeploy android java sdk ..." + } + doLast { + String cachePath = "cache" + if (!file("${cachePath}").exists()) { + mkdir "${cachePath}" + } + FD_JAVA_SDK.eachWithIndex { sdk, index -> + String[] sdkPaths = sdk.src.split("/") + String sdkName = sdkPaths[sdkPaths.length - 1] + // Download the target SDK if not exists + boolean copyFiles = !file("${sdk.dest}/${sdkName}").exists() + if (!file("${cachePath}/${sdkName}").exists()) { + println "Downloading ${sdk.src} -> ${cachePath}/${sdkName}" + ant.get(src: sdk.src, dest: file("${cachePath}/${sdkName}")) + copyFiles = true + } + if (copyFiles) { + println "Coping ${cachePath}/${sdkName} -> ${sdk.dest}/${sdkName}" + copy { + from "${cachePath}/${sdkName}" + into "${sdk.dest}" + } + } + } + } +} + +preBuild.dependsOn downloadAndExtractSDKs +preBuild.dependsOn downloadAndExtractModels \ No newline at end of file diff --git a/examples/vision/detection/paddledetection/android/app/libs/.gitignore b/examples/vision/detection/paddledetection/android/app/libs/.gitignore deleted file mode 100644 index 51958edc9..000000000 --- a/examples/vision/detection/paddledetection/android/app/libs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -fastdeploy-* \ No newline at end of file diff --git a/examples/vision/detection/paddledetection/android/app/src/main/AndroidManifest.xml b/examples/vision/detection/paddledetection/android/app/src/main/AndroidManifest.xml index 144240f7d..95511824f 100644 --- a/examples/vision/detection/paddledetection/android/app/src/main/AndroidManifest.xml +++ b/examples/vision/detection/paddledetection/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="com.baidu.paddle.fastdeploy.app.examples"> @@ -15,14 +15,14 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> - + diff --git a/examples/vision/detection/paddledetection/android/app/src/main/assets/labels/en_dict.txt b/examples/vision/detection/paddledetection/android/app/src/main/assets/labels/en_dict.txt new file mode 100644 index 000000000..7848491a5 --- /dev/null +++ b/examples/vision/detection/paddledetection/android/app/src/main/assets/labels/en_dict.txt @@ -0,0 +1,94 @@ +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +: +; +< += +> +? +@ +A +B +C +D +E +F +G +H +I +J +K +L +M +N +O +P +Q +R +S +T +U +V +W +X +Y +Z +[ +\ +] +^ +_ +` +a +b +c +d +e +f +g +h +i +j +k +l +m +n +o +p +q +r +s +t +u +v +w +x +y +z +{ +| +} +~ +! +" +# +$ +% +& +' +( +) +* ++ +, +- +. +/ diff --git a/examples/vision/detection/paddledetection/android/app/src/main/assets/labels/imagenet1k_label_list.txt b/examples/vision/detection/paddledetection/android/app/src/main/assets/labels/imagenet1k_label_list.txt new file mode 100644 index 000000000..376e18021 --- /dev/null +++ b/examples/vision/detection/paddledetection/android/app/src/main/assets/labels/imagenet1k_label_list.txt @@ -0,0 +1,1000 @@ +0 tench, Tinca tinca +1 goldfish, Carassius auratus +2 great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias +3 tiger shark, Galeocerdo cuvieri +4 hammerhead, hammerhead shark +5 electric ray, crampfish, numbfish, torpedo +6 stingray +7 cock +8 hen +9 ostrich, Struthio camelus +10 brambling, Fringilla montifringilla +11 goldfinch, Carduelis carduelis +12 house finch, linnet, Carpodacus mexicanus +13 junco, snowbird +14 indigo bunting, indigo finch, indigo bird, Passerina cyanea +15 robin, American robin, Turdus migratorius +16 bulbul +17 jay +18 magpie +19 chickadee +20 water ouzel, dipper +21 kite +22 bald eagle, American eagle, Haliaeetus leucocephalus +23 vulture +24 great grey owl, great gray owl, Strix nebulosa +25 European fire salamander, Salamandra salamandra +26 common newt, Triturus vulgaris +27 eft +28 spotted salamander, Ambystoma maculatum +29 axolotl, mud puppy, Ambystoma mexicanum +30 bullfrog, Rana catesbeiana +31 tree frog, tree-frog +32 tailed frog, bell toad, ribbed toad, tailed toad, Ascaphus trui +33 loggerhead, loggerhead turtle, Caretta caretta +34 leatherback turtle, leatherback, leathery turtle, Dermochelys coriacea +35 mud turtle +36 terrapin +37 box turtle, box tortoise +38 banded gecko +39 common iguana, iguana, Iguana iguana +40 American chameleon, anole, Anolis carolinensis +41 whiptail, whiptail lizard +42 agama +43 frilled lizard, Chlamydosaurus kingi +44 alligator lizard +45 Gila monster, Heloderma suspectum +46 green lizard, Lacerta viridis +47 African chameleon, Chamaeleo chamaeleon +48 Komodo dragon, Komodo lizard, dragon lizard, giant lizard, Varanus komodoensis +49 African crocodile, Nile crocodile, Crocodylus niloticus +50 American alligator, Alligator mississipiensis +51 triceratops +52 thunder snake, worm snake, Carphophis amoenus +53 ringneck snake, ring-necked snake, ring snake +54 hognose snake, puff adder, sand viper +55 green snake, grass snake +56 king snake, kingsnake +57 garter snake, grass snake +58 water snake +59 vine snake +60 night snake, Hypsiglena torquata +61 boa constrictor, Constrictor constrictor +62 rock python, rock snake, Python sebae +63 Indian cobra, Naja naja +64 green mamba +65 sea snake +66 horned viper, cerastes, sand viper, horned asp, Cerastes cornutus +67 diamondback, diamondback rattlesnake, Crotalus adamanteus +68 sidewinder, horned rattlesnake, Crotalus cerastes +69 trilobite +70 harvestman, daddy longlegs, Phalangium opilio +71 scorpion +72 black and gold garden spider, Argiope aurantia +73 barn spider, Araneus cavaticus +74 garden spider, Aranea diademata +75 black widow, Latrodectus mactans +76 tarantula +77 wolf spider, hunting spider +78 tick +79 centipede +80 black grouse +81 ptarmigan +82 ruffed grouse, partridge, Bonasa umbellus +83 prairie chicken, prairie grouse, prairie fowl +84 peacock +85 quail +86 partridge +87 African grey, African gray, Psittacus erithacus +88 macaw +89 sulphur-crested cockatoo, Kakatoe galerita, Cacatua galerita +90 lorikeet +91 coucal +92 bee eater +93 hornbill +94 hummingbird +95 jacamar +96 toucan +97 drake +98 red-breasted merganser, Mergus serrator +99 goose +100 black swan, Cygnus atratus +101 tusker +102 echidna, spiny anteater, anteater +103 platypus, duckbill, duckbilled platypus, duck-billed platypus, Ornithorhynchus anatinus +104 wallaby, brush kangaroo +105 koala, koala bear, kangaroo bear, native bear, Phascolarctos cinereus +106 wombat +107 jellyfish +108 sea anemone, anemone +109 brain coral +110 flatworm, platyhelminth +111 nematode, nematode worm, roundworm +112 conch +113 snail +114 slug +115 sea slug, nudibranch +116 chiton, coat-of-mail shell, sea cradle, polyplacophore +117 chambered nautilus, pearly nautilus, nautilus +118 Dungeness crab, Cancer magister +119 rock crab, Cancer irroratus +120 fiddler crab +121 king crab, Alaska crab, Alaskan king crab, Alaska king crab, Paralithodes camtschatica +122 American lobster, Northern lobster, Maine lobster, Homarus americanus +123 spiny lobster, langouste, rock lobster, crawfish, crayfish, sea crawfish +124 crayfish, crawfish, crawdad, crawdaddy +125 hermit crab +126 isopod +127 white stork, Ciconia ciconia +128 black stork, Ciconia nigra +129 spoonbill +130 flamingo +131 little blue heron, Egretta caerulea +132 American egret, great white heron, Egretta albus +133 bittern +134 crane +135 limpkin, Aramus pictus +136 European gallinule, Porphyrio porphyrio +137 American coot, marsh hen, mud hen, water hen, Fulica americana +138 bustard +139 ruddy turnstone, Arenaria interpres +140 red-backed sandpiper, dunlin, Erolia alpina +141 redshank, Tringa totanus +142 dowitcher +143 oystercatcher, oyster catcher +144 pelican +145 king penguin, Aptenodytes patagonica +146 albatross, mollymawk +147 grey whale, gray whale, devilfish, Eschrichtius gibbosus, Eschrichtius robustus +148 killer whale, killer, orca, grampus, sea wolf, Orcinus orca +149 dugong, Dugong dugon +150 sea lion +151 Chihuahua +152 Japanese spaniel +153 Maltese dog, Maltese terrier, Maltese +154 Pekinese, Pekingese, Peke +155 Shih-Tzu +156 Blenheim spaniel +157 papillon +158 toy terrier +159 Rhodesian ridgeback +160 Afghan hound, Afghan +161 basset, basset hound +162 beagle +163 bloodhound, sleuthhound +164 bluetick +165 black-and-tan coonhound +166 Walker hound, Walker foxhound +167 English foxhound +168 redbone +169 borzoi, Russian wolfhound +170 Irish wolfhound +171 Italian greyhound +172 whippet +173 Ibizan hound, Ibizan Podenco +174 Norwegian elkhound, elkhound +175 otterhound, otter hound +176 Saluki, gazelle hound +177 Scottish deerhound, deerhound +178 Weimaraner +179 Staffordshire bullterrier, Staffordshire bull terrier +180 American Staffordshire terrier, Staffordshire terrier, American pit bull terrier, pit bull terrier +181 Bedlington terrier +182 Border terrier +183 Kerry blue terrier +184 Irish terrier +185 Norfolk terrier +186 Norwich terrier +187 Yorkshire terrier +188 wire-haired fox terrier +189 Lakeland terrier +190 Sealyham terrier, Sealyham +191 Airedale, Airedale terrier +192 cairn, cairn terrier +193 Australian terrier +194 Dandie Dinmont, Dandie Dinmont terrier +195 Boston bull, Boston terrier +196 miniature schnauzer +197 giant schnauzer +198 standard schnauzer +199 Scotch terrier, Scottish terrier, Scottie +200 Tibetan terrier, chrysanthemum dog +201 silky terrier, Sydney silky +202 soft-coated wheaten terrier +203 West Highland white terrier +204 Lhasa, Lhasa apso +205 flat-coated retriever +206 curly-coated retriever +207 golden retriever +208 Labrador retriever +209 Chesapeake Bay retriever +210 German short-haired pointer +211 vizsla, Hungarian pointer +212 English setter +213 Irish setter, red setter +214 Gordon setter +215 Brittany spaniel +216 clumber, clumber spaniel +217 English springer, English springer spaniel +218 Welsh springer spaniel +219 cocker spaniel, English cocker spaniel, cocker +220 Sussex spaniel +221 Irish water spaniel +222 kuvasz +223 schipperke +224 groenendael +225 malinois +226 briard +227 kelpie +228 komondor +229 Old English sheepdog, bobtail +230 Shetland sheepdog, Shetland sheep dog, Shetland +231 collie +232 Border collie +233 Bouvier des Flandres, Bouviers des Flandres +234 Rottweiler +235 German shepherd, German shepherd dog, German police dog, alsatian +236 Doberman, Doberman pinscher +237 miniature pinscher +238 Greater Swiss Mountain dog +239 Bernese mountain dog +240 Appenzeller +241 EntleBucher +242 boxer +243 bull mastiff +244 Tibetan mastiff +245 French bulldog +246 Great Dane +247 Saint Bernard, St Bernard +248 Eskimo dog, husky +249 malamute, malemute, Alaskan malamute +250 Siberian husky +251 dalmatian, coach dog, carriage dog +252 affenpinscher, monkey pinscher, monkey dog +253 basenji +254 pug, pug-dog +255 Leonberg +256 Newfoundland, Newfoundland dog +257 Great Pyrenees +258 Samoyed, Samoyede +259 Pomeranian +260 chow, chow chow +261 keeshond +262 Brabancon griffon +263 Pembroke, Pembroke Welsh corgi +264 Cardigan, Cardigan Welsh corgi +265 toy poodle +266 miniature poodle +267 standard poodle +268 Mexican hairless +269 timber wolf, grey wolf, gray wolf, Canis lupus +270 white wolf, Arctic wolf, Canis lupus tundrarum +271 red wolf, maned wolf, Canis rufus, Canis niger +272 coyote, prairie wolf, brush wolf, Canis latrans +273 dingo, warrigal, warragal, Canis dingo +274 dhole, Cuon alpinus +275 African hunting dog, hyena dog, Cape hunting dog, Lycaon pictus +276 hyena, hyaena +277 red fox, Vulpes vulpes +278 kit fox, Vulpes macrotis +279 Arctic fox, white fox, Alopex lagopus +280 grey fox, gray fox, Urocyon cinereoargenteus +281 tabby, tabby cat +282 tiger cat +283 Persian cat +284 Siamese cat, Siamese +285 Egyptian cat +286 cougar, puma, catamount, mountain lion, painter, panther, Felis concolor +287 lynx, catamount +288 leopard, Panthera pardus +289 snow leopard, ounce, Panthera uncia +290 jaguar, panther, Panthera onca, Felis onca +291 lion, king of beasts, Panthera leo +292 tiger, Panthera tigris +293 cheetah, chetah, Acinonyx jubatus +294 brown bear, bruin, Ursus arctos +295 American black bear, black bear, Ursus americanus, Euarctos americanus +296 ice bear, polar bear, Ursus Maritimus, Thalarctos maritimus +297 sloth bear, Melursus ursinus, Ursus ursinus +298 mongoose +299 meerkat, mierkat +300 tiger beetle +301 ladybug, ladybeetle, lady beetle, ladybird, ladybird beetle +302 ground beetle, carabid beetle +303 long-horned beetle, longicorn, longicorn beetle +304 leaf beetle, chrysomelid +305 dung beetle +306 rhinoceros beetle +307 weevil +308 fly +309 bee +310 ant, emmet, pismire +311 grasshopper, hopper +312 cricket +313 walking stick, walkingstick, stick insect +314 cockroach, roach +315 mantis, mantid +316 cicada, cicala +317 leafhopper +318 lacewing, lacewing fly +319 dragonfly, darning needle, devil's darning needle, sewing needle, snake feeder, snake doctor, mosquito hawk, skeeter hawk +320 damselfly +321 admiral +322 ringlet, ringlet butterfly +323 monarch, monarch butterfly, milkweed butterfly, Danaus plexippus +324 cabbage butterfly +325 sulphur butterfly, sulfur butterfly +326 lycaenid, lycaenid butterfly +327 starfish, sea star +328 sea urchin +329 sea cucumber, holothurian +330 wood rabbit, cottontail, cottontail rabbit +331 hare +332 Angora, Angora rabbit +333 hamster +334 porcupine, hedgehog +335 fox squirrel, eastern fox squirrel, Sciurus niger +336 marmot +337 beaver +338 guinea pig, Cavia cobaya +339 sorrel +340 zebra +341 hog, pig, grunter, squealer, Sus scrofa +342 wild boar, boar, Sus scrofa +343 warthog +344 hippopotamus, hippo, river horse, Hippopotamus amphibius +345 ox +346 water buffalo, water ox, Asiatic buffalo, Bubalus bubalis +347 bison +348 ram, tup +349 bighorn, bighorn sheep, cimarron, Rocky Mountain bighorn, Rocky Mountain sheep, Ovis canadensis +350 ibex, Capra ibex +351 hartebeest +352 impala, Aepyceros melampus +353 gazelle +354 Arabian camel, dromedary, Camelus dromedarius +355 llama +356 weasel +357 mink +358 polecat, fitch, foulmart, foumart, Mustela putorius +359 black-footed ferret, ferret, Mustela nigripes +360 otter +361 skunk, polecat, wood pussy +362 badger +363 armadillo +364 three-toed sloth, ai, Bradypus tridactylus +365 orangutan, orang, orangutang, Pongo pygmaeus +366 gorilla, Gorilla gorilla +367 chimpanzee, chimp, Pan troglodytes +368 gibbon, Hylobates lar +369 siamang, Hylobates syndactylus, Symphalangus syndactylus +370 guenon, guenon monkey +371 patas, hussar monkey, Erythrocebus patas +372 baboon +373 macaque +374 langur +375 colobus, colobus monkey +376 proboscis monkey, Nasalis larvatus +377 marmoset +378 capuchin, ringtail, Cebus capucinus +379 howler monkey, howler +380 titi, titi monkey +381 spider monkey, Ateles geoffroyi +382 squirrel monkey, Saimiri sciureus +383 Madagascar cat, ring-tailed lemur, Lemur catta +384 indri, indris, Indri indri, Indri brevicaudatus +385 Indian elephant, Elephas maximus +386 African elephant, Loxodonta africana +387 lesser panda, red panda, panda, bear cat, cat bear, Ailurus fulgens +388 giant panda, panda, panda bear, coon bear, Ailuropoda melanoleuca +389 barracouta, snoek +390 eel +391 coho, cohoe, coho salmon, blue jack, silver salmon, Oncorhynchus kisutch +392 rock beauty, Holocanthus tricolor +393 anemone fish +394 sturgeon +395 gar, garfish, garpike, billfish, Lepisosteus osseus +396 lionfish +397 puffer, pufferfish, blowfish, globefish +398 abacus +399 abaya +400 academic gown, academic robe, judge's robe +401 accordion, piano accordion, squeeze box +402 acoustic guitar +403 aircraft carrier, carrier, flattop, attack aircraft carrier +404 airliner +405 airship, dirigible +406 altar +407 ambulance +408 amphibian, amphibious vehicle +409 analog clock +410 apiary, bee house +411 apron +412 ashcan, trash can, garbage can, wastebin, ash bin, ash-bin, ashbin, dustbin, trash barrel, trash bin +413 assault rifle, assault gun +414 backpack, back pack, knapsack, packsack, rucksack, haversack +415 bakery, bakeshop, bakehouse +416 balance beam, beam +417 balloon +418 ballpoint, ballpoint pen, ballpen, Biro +419 Band Aid +420 banjo +421 bannister, banister, balustrade, balusters, handrail +422 barbell +423 barber chair +424 barbershop +425 barn +426 barometer +427 barrel, cask +428 barrow, garden cart, lawn cart, wheelbarrow +429 baseball +430 basketball +431 bassinet +432 bassoon +433 bathing cap, swimming cap +434 bath towel +435 bathtub, bathing tub, bath, tub +436 beach wagon, station wagon, wagon, estate car, beach waggon, station waggon, waggon +437 beacon, lighthouse, beacon light, pharos +438 beaker +439 bearskin, busby, shako +440 beer bottle +441 beer glass +442 bell cote, bell cot +443 bib +444 bicycle-built-for-two, tandem bicycle, tandem +445 bikini, two-piece +446 binder, ring-binder +447 binoculars, field glasses, opera glasses +448 birdhouse +449 boathouse +450 bobsled, bobsleigh, bob +451 bolo tie, bolo, bola tie, bola +452 bonnet, poke bonnet +453 bookcase +454 bookshop, bookstore, bookstall +455 bottlecap +456 bow +457 bow tie, bow-tie, bowtie +458 brass, memorial tablet, plaque +459 brassiere, bra, bandeau +460 breakwater, groin, groyne, mole, bulwark, seawall, jetty +461 breastplate, aegis, egis +462 broom +463 bucket, pail +464 buckle +465 bulletproof vest +466 bullet train, bullet +467 butcher shop, meat market +468 cab, hack, taxi, taxicab +469 caldron, cauldron +470 candle, taper, wax light +471 cannon +472 canoe +473 can opener, tin opener +474 cardigan +475 car mirror +476 carousel, carrousel, merry-go-round, roundabout, whirligig +477 carpenter's kit, tool kit +478 carton +479 car wheel +480 cash machine, cash dispenser, automated teller machine, automatic teller machine, automated teller, automatic teller, ATM +481 cassette +482 cassette player +483 castle +484 catamaran +485 CD player +486 cello, violoncello +487 cellular telephone, cellular phone, cellphone, cell, mobile phone +488 chain +489 chainlink fence +490 chain mail, ring mail, mail, chain armor, chain armour, ring armor, ring armour +491 chain saw, chainsaw +492 chest +493 chiffonier, commode +494 chime, bell, gong +495 china cabinet, china closet +496 Christmas stocking +497 church, church building +498 cinema, movie theater, movie theatre, movie house, picture palace +499 cleaver, meat cleaver, chopper +500 cliff dwelling +501 cloak +502 clog, geta, patten, sabot +503 cocktail shaker +504 coffee mug +505 coffeepot +506 coil, spiral, volute, whorl, helix +507 combination lock +508 computer keyboard, keypad +509 confectionery, confectionary, candy store +510 container ship, containership, container vessel +511 convertible +512 corkscrew, bottle screw +513 cornet, horn, trumpet, trump +514 cowboy boot +515 cowboy hat, ten-gallon hat +516 cradle +517 crane +518 crash helmet +519 crate +520 crib, cot +521 Crock Pot +522 croquet ball +523 crutch +524 cuirass +525 dam, dike, dyke +526 desk +527 desktop computer +528 dial telephone, dial phone +529 diaper, nappy, napkin +530 digital clock +531 digital watch +532 dining table, board +533 dishrag, dishcloth +534 dishwasher, dish washer, dishwashing machine +535 disk brake, disc brake +536 dock, dockage, docking facility +537 dogsled, dog sled, dog sleigh +538 dome +539 doormat, welcome mat +540 drilling platform, offshore rig +541 drum, membranophone, tympan +542 drumstick +543 dumbbell +544 Dutch oven +545 electric fan, blower +546 electric guitar +547 electric locomotive +548 entertainment center +549 envelope +550 espresso maker +551 face powder +552 feather boa, boa +553 file, file cabinet, filing cabinet +554 fireboat +555 fire engine, fire truck +556 fire screen, fireguard +557 flagpole, flagstaff +558 flute, transverse flute +559 folding chair +560 football helmet +561 forklift +562 fountain +563 fountain pen +564 four-poster +565 freight car +566 French horn, horn +567 frying pan, frypan, skillet +568 fur coat +569 garbage truck, dustcart +570 gasmask, respirator, gas helmet +571 gas pump, gasoline pump, petrol pump, island dispenser +572 goblet +573 go-kart +574 golf ball +575 golfcart, golf cart +576 gondola +577 gong, tam-tam +578 gown +579 grand piano, grand +580 greenhouse, nursery, glasshouse +581 grille, radiator grille +582 grocery store, grocery, food market, market +583 guillotine +584 hair slide +585 hair spray +586 half track +587 hammer +588 hamper +589 hand blower, blow dryer, blow drier, hair dryer, hair drier +590 hand-held computer, hand-held microcomputer +591 handkerchief, hankie, hanky, hankey +592 hard disc, hard disk, fixed disk +593 harmonica, mouth organ, harp, mouth harp +594 harp +595 harvester, reaper +596 hatchet +597 holster +598 home theater, home theatre +599 honeycomb +600 hook, claw +601 hoopskirt, crinoline +602 horizontal bar, high bar +603 horse cart, horse-cart +604 hourglass +605 iPod +606 iron, smoothing iron +607 jack-o'-lantern +608 jean, blue jean, denim +609 jeep, landrover +610 jersey, T-shirt, tee shirt +611 jigsaw puzzle +612 jinrikisha, ricksha, rickshaw +613 joystick +614 kimono +615 knee pad +616 knot +617 lab coat, laboratory coat +618 ladle +619 lampshade, lamp shade +620 laptop, laptop computer +621 lawn mower, mower +622 lens cap, lens cover +623 letter opener, paper knife, paperknife +624 library +625 lifeboat +626 lighter, light, igniter, ignitor +627 limousine, limo +628 liner, ocean liner +629 lipstick, lip rouge +630 Loafer +631 lotion +632 loudspeaker, speaker, speaker unit, loudspeaker system, speaker system +633 loupe, jeweler's loupe +634 lumbermill, sawmill +635 magnetic compass +636 mailbag, postbag +637 mailbox, letter box +638 maillot +639 maillot, tank suit +640 manhole cover +641 maraca +642 marimba, xylophone +643 mask +644 matchstick +645 maypole +646 maze, labyrinth +647 measuring cup +648 medicine chest, medicine cabinet +649 megalith, megalithic structure +650 microphone, mike +651 microwave, microwave oven +652 military uniform +653 milk can +654 minibus +655 miniskirt, mini +656 minivan +657 missile +658 mitten +659 mixing bowl +660 mobile home, manufactured home +661 Model T +662 modem +663 monastery +664 monitor +665 moped +666 mortar +667 mortarboard +668 mosque +669 mosquito net +670 motor scooter, scooter +671 mountain bike, all-terrain bike, off-roader +672 mountain tent +673 mouse, computer mouse +674 mousetrap +675 moving van +676 muzzle +677 nail +678 neck brace +679 necklace +680 nipple +681 notebook, notebook computer +682 obelisk +683 oboe, hautboy, hautbois +684 ocarina, sweet potato +685 odometer, hodometer, mileometer, milometer +686 oil filter +687 organ, pipe organ +688 oscilloscope, scope, cathode-ray oscilloscope, CRO +689 overskirt +690 oxcart +691 oxygen mask +692 packet +693 paddle, boat paddle +694 paddlewheel, paddle wheel +695 padlock +696 paintbrush +697 pajama, pyjama, pj's, jammies +698 palace +699 panpipe, pandean pipe, syrinx +700 paper towel +701 parachute, chute +702 parallel bars, bars +703 park bench +704 parking meter +705 passenger car, coach, carriage +706 patio, terrace +707 pay-phone, pay-station +708 pedestal, plinth, footstall +709 pencil box, pencil case +710 pencil sharpener +711 perfume, essence +712 Petri dish +713 photocopier +714 pick, plectrum, plectron +715 pickelhaube +716 picket fence, paling +717 pickup, pickup truck +718 pier +719 piggy bank, penny bank +720 pill bottle +721 pillow +722 ping-pong ball +723 pinwheel +724 pirate, pirate ship +725 pitcher, ewer +726 plane, carpenter's plane, woodworking plane +727 planetarium +728 plastic bag +729 plate rack +730 plow, plough +731 plunger, plumber's helper +732 Polaroid camera, Polaroid Land camera +733 pole +734 police van, police wagon, paddy wagon, patrol wagon, wagon, black Maria +735 poncho +736 pool table, billiard table, snooker table +737 pop bottle, soda bottle +738 pot, flowerpot +739 potter's wheel +740 power drill +741 prayer rug, prayer mat +742 printer +743 prison, prison house +744 projectile, missile +745 projector +746 puck, hockey puck +747 punching bag, punch bag, punching ball, punchball +748 purse +749 quill, quill pen +750 quilt, comforter, comfort, puff +751 racer, race car, racing car +752 racket, racquet +753 radiator +754 radio, wireless +755 radio telescope, radio reflector +756 rain barrel +757 recreational vehicle, RV, R.V. +758 reel +759 reflex camera +760 refrigerator, icebox +761 remote control, remote +762 restaurant, eating house, eating place, eatery +763 revolver, six-gun, six-shooter +764 rifle +765 rocking chair, rocker +766 rotisserie +767 rubber eraser, rubber, pencil eraser +768 rugby ball +769 rule, ruler +770 running shoe +771 safe +772 safety pin +773 saltshaker, salt shaker +774 sandal +775 sarong +776 sax, saxophone +777 scabbard +778 scale, weighing machine +779 school bus +780 schooner +781 scoreboard +782 screen, CRT screen +783 screw +784 screwdriver +785 seat belt, seatbelt +786 sewing machine +787 shield, buckler +788 shoe shop, shoe-shop, shoe store +789 shoji +790 shopping basket +791 shopping cart +792 shovel +793 shower cap +794 shower curtain +795 ski +796 ski mask +797 sleeping bag +798 slide rule, slipstick +799 sliding door +800 slot, one-armed bandit +801 snorkel +802 snowmobile +803 snowplow, snowplough +804 soap dispenser +805 soccer ball +806 sock +807 solar dish, solar collector, solar furnace +808 sombrero +809 soup bowl +810 space bar +811 space heater +812 space shuttle +813 spatula +814 speedboat +815 spider web, spider's web +816 spindle +817 sports car, sport car +818 spotlight, spot +819 stage +820 steam locomotive +821 steel arch bridge +822 steel drum +823 stethoscope +824 stole +825 stone wall +826 stopwatch, stop watch +827 stove +828 strainer +829 streetcar, tram, tramcar, trolley, trolley car +830 stretcher +831 studio couch, day bed +832 stupa, tope +833 submarine, pigboat, sub, U-boat +834 suit, suit of clothes +835 sundial +836 sunglass +837 sunglasses, dark glasses, shades +838 sunscreen, sunblock, sun blocker +839 suspension bridge +840 swab, swob, mop +841 sweatshirt +842 swimming trunks, bathing trunks +843 swing +844 switch, electric switch, electrical switch +845 syringe +846 table lamp +847 tank, army tank, armored combat vehicle, armoured combat vehicle +848 tape player +849 teapot +850 teddy, teddy bear +851 television, television system +852 tennis ball +853 thatch, thatched roof +854 theater curtain, theatre curtain +855 thimble +856 thresher, thrasher, threshing machine +857 throne +858 tile roof +859 toaster +860 tobacco shop, tobacconist shop, tobacconist +861 toilet seat +862 torch +863 totem pole +864 tow truck, tow car, wrecker +865 toyshop +866 tractor +867 trailer truck, tractor trailer, trucking rig, rig, articulated lorry, semi +868 tray +869 trench coat +870 tricycle, trike, velocipede +871 trimaran +872 tripod +873 triumphal arch +874 trolleybus, trolley coach, trackless trolley +875 trombone +876 tub, vat +877 turnstile +878 typewriter keyboard +879 umbrella +880 unicycle, monocycle +881 upright, upright piano +882 vacuum, vacuum cleaner +883 vase +884 vault +885 velvet +886 vending machine +887 vestment +888 viaduct +889 violin, fiddle +890 volleyball +891 waffle iron +892 wall clock +893 wallet, billfold, notecase, pocketbook +894 wardrobe, closet, press +895 warplane, military plane +896 washbasin, handbasin, washbowl, lavabo, wash-hand basin +897 washer, automatic washer, washing machine +898 water bottle +899 water jug +900 water tower +901 whiskey jug +902 whistle +903 wig +904 window screen +905 window shade +906 Windsor tie +907 wine bottle +908 wing +909 wok +910 wooden spoon +911 wool, woolen, woollen +912 worm fence, snake fence, snake-rail fence, Virginia fence +913 wreck +914 yawl +915 yurt +916 web site, website, internet site, site +917 comic book +918 crossword puzzle, crossword +919 street sign +920 traffic light, traffic signal, stoplight +921 book jacket, dust cover, dust jacket, dust wrapper +922 menu +923 plate +924 guacamole +925 consomme +926 hot pot, hotpot +927 trifle +928 ice cream, icecream +929 ice lolly, lolly, lollipop, popsicle +930 French loaf +931 bagel, beigel +932 pretzel +933 cheeseburger +934 hotdog, hot dog, red hot +935 mashed potato +936 head cabbage +937 broccoli +938 cauliflower +939 zucchini, courgette +940 spaghetti squash +941 acorn squash +942 butternut squash +943 cucumber, cuke +944 artichoke, globe artichoke +945 bell pepper +946 cardoon +947 mushroom +948 Granny Smith +949 strawberry +950 orange +951 lemon +952 fig +953 pineapple, ananas +954 banana +955 jackfruit, jak, jack +956 custard apple +957 pomegranate +958 hay +959 carbonara +960 chocolate sauce, chocolate syrup +961 dough +962 meat loaf, meatloaf +963 pizza, pizza pie +964 potpie +965 burrito +966 red wine +967 espresso +968 cup +969 eggnog +970 alp +971 bubble +972 cliff, drop, drop-off +973 coral reef +974 geyser +975 lakeside, lakeshore +976 promontory, headland, head, foreland +977 sandbar, sand bar +978 seashore, coast, seacoast, sea-coast +979 valley, vale +980 volcano +981 ballplayer, baseball player +982 groom, bridegroom +983 scuba diver +984 rapeseed +985 daisy +986 yellow lady's slipper, yellow lady-slipper, Cypripedium calceolus, Cypripedium parviflorum +987 corn +988 acorn +989 hip, rose hip, rosehip +990 buckeye, horse chestnut, conker +991 coral fungus +992 agaric +993 gyromitra +994 stinkhorn, carrion fungus +995 earthstar +996 hen-of-the-woods, hen of the woods, Polyporus frondosus, Grifola frondosa +997 bolete +998 ear, spike, capitulum +999 toilet tissue, toilet paper, bathroom tissue diff --git a/examples/vision/detection/paddledetection/android/app/src/main/assets/labels/ppocr_keys_v1.txt b/examples/vision/detection/paddledetection/android/app/src/main/assets/labels/ppocr_keys_v1.txt new file mode 100644 index 000000000..b75af2130 --- /dev/null +++ b/examples/vision/detection/paddledetection/android/app/src/main/assets/labels/ppocr_keys_v1.txt @@ -0,0 +1,6623 @@ +' +疗 +绚 +诚 +娇 +溜 +题 +贿 +者 +廖 +更 +纳 +加 +奉 +公 +一 +就 +汴 +计 +与 +路 +房 +原 +妇 +2 +0 +8 +- +7 +其 +> +: +] +, +, +骑 +刈 +全 +消 +昏 +傈 +安 +久 +钟 +嗅 +不 +影 +处 +驽 +蜿 +资 +关 +椤 +地 +瘸 +专 +问 +忖 +票 +嫉 +炎 +韵 +要 +月 +田 +节 +陂 +鄙 +捌 +备 +拳 +伺 +眼 +网 +盎 +大 +傍 +心 +东 +愉 +汇 +蹿 +科 +每 +业 +里 +航 +晏 +字 +平 +录 +先 +1 +3 +彤 +鲶 +产 +稍 +督 +腴 +有 +象 +岳 +注 +绍 +在 +泺 +文 +定 +核 +名 +水 +过 +理 +让 +偷 +率 +等 +这 +发 +” +为 +含 +肥 +酉 +相 +鄱 +七 +编 +猥 +锛 +日 +镀 +蒂 +掰 +倒 +辆 +栾 +栗 +综 +涩 +州 +雌 +滑 +馀 +了 +机 +块 +司 +宰 +甙 +兴 +矽 +抚 +保 +用 +沧 +秩 +如 +收 +息 +滥 +页 +疑 +埠 +! +! +姥 +异 +橹 +钇 +向 +下 +跄 +的 +椴 +沫 +国 +绥 +獠 +报 +开 +民 +蜇 +何 +分 +凇 +长 +讥 +藏 +掏 +施 +羽 +中 +讲 +派 +嘟 +人 +提 +浼 +间 +世 +而 +古 +多 +倪 +唇 +饯 +控 +庚 +首 +赛 +蜓 +味 +断 +制 +觉 +技 +替 +艰 +溢 +潮 +夕 +钺 +外 +摘 +枋 +动 +双 +单 +啮 +户 +枇 +确 +锦 +曜 +杜 +或 +能 +效 +霜 +盒 +然 +侗 +电 +晁 +放 +步 +鹃 +新 +杖 +蜂 +吒 +濂 +瞬 +评 +总 +隍 +对 +独 +合 +也 +是 +府 +青 +天 +诲 +墙 +组 +滴 +级 +邀 +帘 +示 +已 +时 +骸 +仄 +泅 +和 +遨 +店 +雇 +疫 +持 +巍 +踮 +境 +只 +亨 +目 +鉴 +崤 +闲 +体 +泄 +杂 +作 +般 +轰 +化 +解 +迂 +诿 +蛭 +璀 +腾 +告 +版 +服 +省 +师 +小 +规 +程 +线 +海 +办 +引 +二 +桧 +牌 +砺 +洄 +裴 +修 +图 +痫 +胡 +许 +犊 +事 +郛 +基 +柴 +呼 +食 +研 +奶 +律 +蛋 +因 +葆 +察 +戏 +褒 +戒 +再 +李 +骁 +工 +貂 +油 +鹅 +章 +啄 +休 +场 +给 +睡 +纷 +豆 +器 +捎 +说 +敏 +学 +会 +浒 +设 +诊 +格 +廓 +查 +来 +霓 +室 +溆 +¢ +诡 +寥 +焕 +舜 +柒 +狐 +回 +戟 +砾 +厄 +实 +翩 +尿 +五 +入 +径 +惭 +喹 +股 +宇 +篝 +| +; +美 +期 +云 +九 +祺 +扮 +靠 +锝 +槌 +系 +企 +酰 +阊 +暂 +蚕 +忻 +豁 +本 +羹 +执 +条 +钦 +H +獒 +限 +进 +季 +楦 +于 +芘 +玖 +铋 +茯 +未 +答 +粘 +括 +样 +精 +欠 +矢 +甥 +帷 +嵩 +扣 +令 +仔 +风 +皈 +行 +支 +部 +蓉 +刮 +站 +蜡 +救 +钊 +汗 +松 +嫌 +成 +可 +. +鹤 +院 +从 +交 +政 +怕 +活 +调 +球 +局 +验 +髌 +第 +韫 +谗 +串 +到 +圆 +年 +米 +/ +* +友 +忿 +检 +区 +看 +自 +敢 +刃 +个 +兹 +弄 +流 +留 +同 +没 +齿 +星 +聆 +轼 +湖 +什 +三 +建 +蛔 +儿 +椋 +汕 +震 +颧 +鲤 +跟 +力 +情 +璺 +铨 +陪 +务 +指 +族 +训 +滦 +鄣 +濮 +扒 +商 +箱 +十 +召 +慷 +辗 +所 +莞 +管 +护 +臭 +横 +硒 +嗓 +接 +侦 +六 +露 +党 +馋 +驾 +剖 +高 +侬 +妪 +幂 +猗 +绺 +骐 +央 +酐 +孝 +筝 +课 +徇 +缰 +门 +男 +西 +项 +句 +谙 +瞒 +秃 +篇 +教 +碲 +罚 +声 +呐 +景 +前 +富 +嘴 +鳌 +稀 +免 +朋 +啬 +睐 +去 +赈 +鱼 +住 +肩 +愕 +速 +旁 +波 +厅 +健 +茼 +厥 +鲟 +谅 +投 +攸 +炔 +数 +方 +击 +呋 +谈 +绩 +别 +愫 +僚 +躬 +鹧 +胪 +炳 +招 +喇 +膨 +泵 +蹦 +毛 +结 +5 +4 +谱 +识 +陕 +粽 +婚 +拟 +构 +且 +搜 +任 +潘 +比 +郢 +妨 +醪 +陀 +桔 +碘 +扎 +选 +哈 +骷 +楷 +亿 +明 +缆 +脯 +监 +睫 +逻 +婵 +共 +赴 +淝 +凡 +惦 +及 +达 +揖 +谩 +澹 +减 +焰 +蛹 +番 +祁 +柏 +员 +禄 +怡 +峤 +龙 +白 +叽 +生 +闯 +起 +细 +装 +谕 +竟 +聚 +钙 +上 +导 +渊 +按 +艾 +辘 +挡 +耒 +盹 +饪 +臀 +记 +邮 +蕙 +受 +各 +医 +搂 +普 +滇 +朗 +茸 +带 +翻 +酚 +( +光 +堤 +墟 +蔷 +万 +幻 +〓 +瑙 +辈 +昧 +盏 +亘 +蛀 +吉 +铰 +请 +子 +假 +闻 +税 +井 +诩 +哨 +嫂 +好 +面 +琐 +校 +馊 +鬣 +缂 +营 +访 +炖 +占 +农 +缀 +否 +经 +钚 +棵 +趟 +张 +亟 +吏 +茶 +谨 +捻 +论 +迸 +堂 +玉 +信 +吧 +瞠 +乡 +姬 +寺 +咬 +溏 +苄 +皿 +意 +赉 +宝 +尔 +钰 +艺 +特 +唳 +踉 +都 +荣 +倚 +登 +荐 +丧 +奇 +涵 +批 +炭 +近 +符 +傩 +感 +道 +着 +菊 +虹 +仲 +众 +懈 +濯 +颞 +眺 +南 +释 +北 +缝 +标 +既 +茗 +整 +撼 +迤 +贲 +挎 +耱 +拒 +某 +妍 +卫 +哇 +英 +矶 +藩 +治 +他 +元 +领 +膜 +遮 +穗 +蛾 +飞 +荒 +棺 +劫 +么 +市 +火 +温 +拈 +棚 +洼 +转 +果 +奕 +卸 +迪 +伸 +泳 +斗 +邡 +侄 +涨 +屯 +萋 +胭 +氡 +崮 +枞 +惧 +冒 +彩 +斜 +手 +豚 +随 +旭 +淑 +妞 +形 +菌 +吲 +沱 +争 +驯 +歹 +挟 +兆 +柱 +传 +至 +包 +内 +响 +临 +红 +功 +弩 +衡 +寂 +禁 +老 +棍 +耆 +渍 +织 +害 +氵 +渑 +布 +载 +靥 +嗬 +虽 +苹 +咨 +娄 +库 +雉 +榜 +帜 +嘲 +套 +瑚 +亲 +簸 +欧 +边 +6 +腿 +旮 +抛 +吹 +瞳 +得 +镓 +梗 +厨 +继 +漾 +愣 +憨 +士 +策 +窑 +抑 +躯 +襟 +脏 +参 +贸 +言 +干 +绸 +鳄 +穷 +藜 +音 +折 +详 +) +举 +悍 +甸 +癌 +黎 +谴 +死 +罩 +迁 +寒 +驷 +袖 +媒 +蒋 +掘 +模 +纠 +恣 +观 +祖 +蛆 +碍 +位 +稿 +主 +澧 +跌 +筏 +京 +锏 +帝 +贴 +证 +糠 +才 +黄 +鲸 +略 +炯 +饱 +四 +出 +园 +犀 +牧 +容 +汉 +杆 +浈 +汰 +瑷 +造 +虫 +瘩 +怪 +驴 +济 +应 +花 +沣 +谔 +夙 +旅 +价 +矿 +以 +考 +s +u +呦 +晒 +巡 +茅 +准 +肟 +瓴 +詹 +仟 +褂 +译 +桌 +混 +宁 +怦 +郑 +抿 +些 +余 +鄂 +饴 +攒 +珑 +群 +阖 +岔 +琨 +藓 +预 +环 +洮 +岌 +宀 +杲 +瀵 +最 +常 +囡 +周 +踊 +女 +鼓 +袭 +喉 +简 +范 +薯 +遐 +疏 +粱 +黜 +禧 +法 +箔 +斤 +遥 +汝 +奥 +直 +贞 +撑 +置 +绱 +集 +她 +馅 +逗 +钧 +橱 +魉 +[ +恙 +躁 +唤 +9 +旺 +膘 +待 +脾 +惫 +购 +吗 +依 +盲 +度 +瘿 +蠖 +俾 +之 +镗 +拇 +鲵 +厝 +簧 +续 +款 +展 +啃 +表 +剔 +品 +钻 +腭 +损 +清 +锶 +统 +涌 +寸 +滨 +贪 +链 +吠 +冈 +伎 +迥 +咏 +吁 +览 +防 +迅 +失 +汾 +阔 +逵 +绀 +蔑 +列 +川 +凭 +努 +熨 +揪 +利 +俱 +绉 +抢 +鸨 +我 +即 +责 +膦 +易 +毓 +鹊 +刹 +玷 +岿 +空 +嘞 +绊 +排 +术 +估 +锷 +违 +们 +苟 +铜 +播 +肘 +件 +烫 +审 +鲂 +广 +像 +铌 +惰 +铟 +巳 +胍 +鲍 +康 +憧 +色 +恢 +想 +拷 +尤 +疳 +知 +S +Y +F +D +A +峄 +裕 +帮 +握 +搔 +氐 +氘 +难 +墒 +沮 +雨 +叁 +缥 +悴 +藐 +湫 +娟 +苑 +稠 +颛 +簇 +后 +阕 +闭 +蕤 +缚 +怎 +佞 +码 +嘤 +蔡 +痊 +舱 +螯 +帕 +赫 +昵 +升 +烬 +岫 +、 +疵 +蜻 +髁 +蕨 +隶 +烛 +械 +丑 +盂 +梁 +强 +鲛 +由 +拘 +揉 +劭 +龟 +撤 +钩 +呕 +孛 +费 +妻 +漂 +求 +阑 +崖 +秤 +甘 +通 +深 +补 +赃 +坎 +床 +啪 +承 +吼 +量 +暇 +钼 +烨 +阂 +擎 +脱 +逮 +称 +P +神 +属 +矗 +华 +届 +狍 +葑 +汹 +育 +患 +窒 +蛰 +佼 +静 +槎 +运 +鳗 +庆 +逝 +曼 +疱 +克 +代 +官 +此 +麸 +耧 +蚌 +晟 +例 +础 +榛 +副 +测 +唰 +缢 +迹 +灬 +霁 +身 +岁 +赭 +扛 +又 +菡 +乜 +雾 +板 +读 +陷 +徉 +贯 +郁 +虑 +变 +钓 +菜 +圾 +现 +琢 +式 +乐 +维 +渔 +浜 +左 +吾 +脑 +钡 +警 +T +啵 +拴 +偌 +漱 +湿 +硕 +止 +骼 +魄 +积 +燥 +联 +踢 +玛 +则 +窿 +见 +振 +畿 +送 +班 +钽 +您 +赵 +刨 +印 +讨 +踝 +籍 +谡 +舌 +崧 +汽 +蔽 +沪 +酥 +绒 +怖 +财 +帖 +肱 +私 +莎 +勋 +羔 +霸 +励 +哼 +帐 +将 +帅 +渠 +纪 +婴 +娩 +岭 +厘 +滕 +吻 +伤 +坝 +冠 +戊 +隆 +瘁 +介 +涧 +物 +黍 +并 +姗 +奢 +蹑 +掣 +垸 +锴 +命 +箍 +捉 +病 +辖 +琰 +眭 +迩 +艘 +绌 +繁 +寅 +若 +毋 +思 +诉 +类 +诈 +燮 +轲 +酮 +狂 +重 +反 +职 +筱 +县 +委 +磕 +绣 +奖 +晋 +濉 +志 +徽 +肠 +呈 +獐 +坻 +口 +片 +碰 +几 +村 +柿 +劳 +料 +获 +亩 +惕 +晕 +厌 +号 +罢 +池 +正 +鏖 +煨 +家 +棕 +复 +尝 +懋 +蜥 +锅 +岛 +扰 +队 +坠 +瘾 +钬 +@ +卧 +疣 +镇 +譬 +冰 +彷 +频 +黯 +据 +垄 +采 +八 +缪 +瘫 +型 +熹 +砰 +楠 +襁 +箐 +但 +嘶 +绳 +啤 +拍 +盥 +穆 +傲 +洗 +盯 +塘 +怔 +筛 +丿 +台 +恒 +喂 +葛 +永 +¥ +烟 +酒 +桦 +书 +砂 +蚝 +缉 +态 +瀚 +袄 +圳 +轻 +蛛 +超 +榧 +遛 +姒 +奘 +铮 +右 +荽 +望 +偻 +卡 +丶 +氰 +附 +做 +革 +索 +戚 +坨 +桷 +唁 +垅 +榻 +岐 +偎 +坛 +莨 +山 +殊 +微 +骇 +陈 +爨 +推 +嗝 +驹 +澡 +藁 +呤 +卤 +嘻 +糅 +逛 +侵 +郓 +酌 +德 +摇 +※ +鬃 +被 +慨 +殡 +羸 +昌 +泡 +戛 +鞋 +河 +宪 +沿 +玲 +鲨 +翅 +哽 +源 +铅 +语 +照 +邯 +址 +荃 +佬 +顺 +鸳 +町 +霭 +睾 +瓢 +夸 +椁 +晓 +酿 +痈 +咔 +侏 +券 +噎 +湍 +签 +嚷 +离 +午 +尚 +社 +锤 +背 +孟 +使 +浪 +缦 +潍 +鞅 +军 +姹 +驶 +笑 +鳟 +鲁 +》 +孽 +钜 +绿 +洱 +礴 +焯 +椰 +颖 +囔 +乌 +孔 +巴 +互 +性 +椽 +哞 +聘 +昨 +早 +暮 +胶 +炀 +隧 +低 +彗 +昝 +铁 +呓 +氽 +藉 +喔 +癖 +瑗 +姨 +权 +胱 +韦 +堑 +蜜 +酋 +楝 +砝 +毁 +靓 +歙 +锲 +究 +屋 +喳 +骨 +辨 +碑 +武 +鸠 +宫 +辜 +烊 +适 +坡 +殃 +培 +佩 +供 +走 +蜈 +迟 +翼 +况 +姣 +凛 +浔 +吃 +飘 +债 +犟 +金 +促 +苛 +崇 +坂 +莳 +畔 +绂 +兵 +蠕 +斋 +根 +砍 +亢 +欢 +恬 +崔 +剁 +餐 +榫 +快 +扶 +‖ +濒 +缠 +鳜 +当 +彭 +驭 +浦 +篮 +昀 +锆 +秸 +钳 +弋 +娣 +瞑 +夷 +龛 +苫 +拱 +致 +% +嵊 +障 +隐 +弑 +初 +娓 +抉 +汩 +累 +蓖 +" +唬 +助 +苓 +昙 +押 +毙 +破 +城 +郧 +逢 +嚏 +獭 +瞻 +溱 +婿 +赊 +跨 +恼 +璧 +萃 +姻 +貉 +灵 +炉 +密 +氛 +陶 +砸 +谬 +衔 +点 +琛 +沛 +枳 +层 +岱 +诺 +脍 +榈 +埂 +征 +冷 +裁 +打 +蹴 +素 +瘘 +逞 +蛐 +聊 +激 +腱 +萘 +踵 +飒 +蓟 +吆 +取 +咙 +簋 +涓 +矩 +曝 +挺 +揣 +座 +你 +史 +舵 +焱 +尘 +苏 +笈 +脚 +溉 +榨 +诵 +樊 +邓 +焊 +义 +庶 +儋 +蟋 +蒲 +赦 +呷 +杞 +诠 +豪 +还 +试 +颓 +茉 +太 +除 +紫 +逃 +痴 +草 +充 +鳕 +珉 +祗 +墨 +渭 +烩 +蘸 +慕 +璇 +镶 +穴 +嵘 +恶 +骂 +险 +绋 +幕 +碉 +肺 +戳 +刘 +潞 +秣 +纾 +潜 +銮 +洛 +须 +罘 +销 +瘪 +汞 +兮 +屉 +r +林 +厕 +质 +探 +划 +狸 +殚 +善 +煊 +烹 +〒 +锈 +逯 +宸 +辍 +泱 +柚 +袍 +远 +蹋 +嶙 +绝 +峥 +娥 +缍 +雀 +徵 +认 +镱 +谷 += +贩 +勉 +撩 +鄯 +斐 +洋 +非 +祚 +泾 +诒 +饿 +撬 +威 +晷 +搭 +芍 +锥 +笺 +蓦 +候 +琊 +档 +礁 +沼 +卵 +荠 +忑 +朝 +凹 +瑞 +头 +仪 +弧 +孵 +畏 +铆 +突 +衲 +车 +浩 +气 +茂 +悖 +厢 +枕 +酝 +戴 +湾 +邹 +飚 +攘 +锂 +写 +宵 +翁 +岷 +无 +喜 +丈 +挑 +嗟 +绛 +殉 +议 +槽 +具 +醇 +淞 +笃 +郴 +阅 +饼 +底 +壕 +砚 +弈 +询 +缕 +庹 +翟 +零 +筷 +暨 +舟 +闺 +甯 +撞 +麂 +茌 +蔼 +很 +珲 +捕 +棠 +角 +阉 +媛 +娲 +诽 +剿 +尉 +爵 +睬 +韩 +诰 +匣 +危 +糍 +镯 +立 +浏 +阳 +少 +盆 +舔 +擘 +匪 +申 +尬 +铣 +旯 +抖 +赘 +瓯 +居 +ˇ +哮 +游 +锭 +茏 +歌 +坏 +甚 +秒 +舞 +沙 +仗 +劲 +潺 +阿 +燧 +郭 +嗖 +霏 +忠 +材 +奂 +耐 +跺 +砀 +输 +岖 +媳 +氟 +极 +摆 +灿 +今 +扔 +腻 +枝 +奎 +药 +熄 +吨 +话 +q +额 +慑 +嘌 +协 +喀 +壳 +埭 +视 +著 +於 +愧 +陲 +翌 +峁 +颅 +佛 +腹 +聋 +侯 +咎 +叟 +秀 +颇 +存 +较 +罪 +哄 +岗 +扫 +栏 +钾 +羌 +己 +璨 +枭 +霉 +煌 +涸 +衿 +键 +镝 +益 +岢 +奏 +连 +夯 +睿 +冥 +均 +糖 +狞 +蹊 +稻 +爸 +刿 +胥 +煜 +丽 +肿 +璃 +掸 +跚 +灾 +垂 +樾 +濑 +乎 +莲 +窄 +犹 +撮 +战 +馄 +软 +络 +显 +鸢 +胸 +宾 +妲 +恕 +埔 +蝌 +份 +遇 +巧 +瞟 +粒 +恰 +剥 +桡 +博 +讯 +凯 +堇 +阶 +滤 +卖 +斌 +骚 +彬 +兑 +磺 +樱 +舷 +两 +娱 +福 +仃 +差 +找 +桁 +÷ +净 +把 +阴 +污 +戬 +雷 +碓 +蕲 +楚 +罡 +焖 +抽 +妫 +咒 +仑 +闱 +尽 +邑 +菁 +爱 +贷 +沥 +鞑 +牡 +嗉 +崴 +骤 +塌 +嗦 +订 +拮 +滓 +捡 +锻 +次 +坪 +杩 +臃 +箬 +融 +珂 +鹗 +宗 +枚 +降 +鸬 +妯 +阄 +堰 +盐 +毅 +必 +杨 +崃 +俺 +甬 +状 +莘 +货 +耸 +菱 +腼 +铸 +唏 +痤 +孚 +澳 +懒 +溅 +翘 +疙 +杷 +淼 +缙 +骰 +喊 +悉 +砻 +坷 +艇 +赁 +界 +谤 +纣 +宴 +晃 +茹 +归 +饭 +梢 +铡 +街 +抄 +肼 +鬟 +苯 +颂 +撷 +戈 +炒 +咆 +茭 +瘙 +负 +仰 +客 +琉 +铢 +封 +卑 +珥 +椿 +镧 +窨 +鬲 +寿 +御 +袤 +铃 +萎 +砖 +餮 +脒 +裳 +肪 +孕 +嫣 +馗 +嵇 +恳 +氯 +江 +石 +褶 +冢 +祸 +阻 +狈 +羞 +银 +靳 +透 +咳 +叼 +敷 +芷 +啥 +它 +瓤 +兰 +痘 +懊 +逑 +肌 +往 +捺 +坊 +甩 +呻 +〃 +沦 +忘 +膻 +祟 +菅 +剧 +崆 +智 +坯 +臧 +霍 +墅 +攻 +眯 +倘 +拢 +骠 +铐 +庭 +岙 +瓠 +′ +缺 +泥 +迢 +捶 +? +? +郏 +喙 +掷 +沌 +纯 +秘 +种 +听 +绘 +固 +螨 +团 +香 +盗 +妒 +埚 +蓝 +拖 +旱 +荞 +铀 +血 +遏 +汲 +辰 +叩 +拽 +幅 +硬 +惶 +桀 +漠 +措 +泼 +唑 +齐 +肾 +念 +酱 +虚 +屁 +耶 +旗 +砦 +闵 +婉 +馆 +拭 +绅 +韧 +忏 +窝 +醋 +葺 +顾 +辞 +倜 +堆 +辋 +逆 +玟 +贱 +疾 +董 +惘 +倌 +锕 +淘 +嘀 +莽 +俭 +笏 +绑 +鲷 +杈 +择 +蟀 +粥 +嗯 +驰 +逾 +案 +谪 +褓 +胫 +哩 +昕 +颚 +鲢 +绠 +躺 +鹄 +崂 +儒 +俨 +丝 +尕 +泌 +啊 +萸 +彰 +幺 +吟 +骄 +苣 +弦 +脊 +瑰 +〈 +诛 +镁 +析 +闪 +剪 +侧 +哟 +框 +螃 +守 +嬗 +燕 +狭 +铈 +缮 +概 +迳 +痧 +鲲 +俯 +售 +笼 +痣 +扉 +挖 +满 +咋 +援 +邱 +扇 +歪 +便 +玑 +绦 +峡 +蛇 +叨 +〖 +泽 +胃 +斓 +喋 +怂 +坟 +猪 +该 +蚬 +炕 +弥 +赞 +棣 +晔 +娠 +挲 +狡 +创 +疖 +铕 +镭 +稷 +挫 +弭 +啾 +翔 +粉 +履 +苘 +哦 +楼 +秕 +铂 +土 +锣 +瘟 +挣 +栉 +习 +享 +桢 +袅 +磨 +桂 +谦 +延 +坚 +蔚 +噗 +署 +谟 +猬 +钎 +恐 +嬉 +雒 +倦 +衅 +亏 +璩 +睹 +刻 +殿 +王 +算 +雕 +麻 +丘 +柯 +骆 +丸 +塍 +谚 +添 +鲈 +垓 +桎 +蚯 +芥 +予 +飕 +镦 +谌 +窗 +醚 +菀 +亮 +搪 +莺 +蒿 +羁 +足 +J +真 +轶 +悬 +衷 +靛 +翊 +掩 +哒 +炅 +掐 +冼 +妮 +l +谐 +稚 +荆 +擒 +犯 +陵 +虏 +浓 +崽 +刍 +陌 +傻 +孜 +千 +靖 +演 +矜 +钕 +煽 +杰 +酗 +渗 +伞 +栋 +俗 +泫 +戍 +罕 +沾 +疽 +灏 +煦 +芬 +磴 +叱 +阱 +榉 +湃 +蜀 +叉 +醒 +彪 +租 +郡 +篷 +屎 +良 +垢 +隗 +弱 +陨 +峪 +砷 +掴 +颁 +胎 +雯 +绵 +贬 +沐 +撵 +隘 +篙 +暖 +曹 +陡 +栓 +填 +臼 +彦 +瓶 +琪 +潼 +哪 +鸡 +摩 +啦 +俟 +锋 +域 +耻 +蔫 +疯 +纹 +撇 +毒 +绶 +痛 +酯 +忍 +爪 +赳 +歆 +嘹 +辕 +烈 +册 +朴 +钱 +吮 +毯 +癜 +娃 +谀 +邵 +厮 +炽 +璞 +邃 +丐 +追 +词 +瓒 +忆 +轧 +芫 +谯 +喷 +弟 +半 +冕 +裙 +掖 +墉 +绮 +寝 +苔 +势 +顷 +褥 +切 +衮 +君 +佳 +嫒 +蚩 +霞 +佚 +洙 +逊 +镖 +暹 +唛 +& +殒 +顶 +碗 +獗 +轭 +铺 +蛊 +废 +恹 +汨 +崩 +珍 +那 +杵 +曲 +纺 +夏 +薰 +傀 +闳 +淬 +姘 +舀 +拧 +卷 +楂 +恍 +讪 +厩 +寮 +篪 +赓 +乘 +灭 +盅 +鞣 +沟 +慎 +挂 +饺 +鼾 +杳 +树 +缨 +丛 +絮 +娌 +臻 +嗳 +篡 +侩 +述 +衰 +矛 +圈 +蚜 +匕 +筹 +匿 +濞 +晨 +叶 +骋 +郝 +挚 +蚴 +滞 +增 +侍 +描 +瓣 +吖 +嫦 +蟒 +匾 +圣 +赌 +毡 +癞 +恺 +百 +曳 +需 +篓 +肮 +庖 +帏 +卿 +驿 +遗 +蹬 +鬓 +骡 +歉 +芎 +胳 +屐 +禽 +烦 +晌 +寄 +媾 +狄 +翡 +苒 +船 +廉 +终 +痞 +殇 +々 +畦 +饶 +改 +拆 +悻 +萄 +£ +瓿 +乃 +訾 +桅 +匮 +溧 +拥 +纱 +铍 +骗 +蕃 +龋 +缬 +父 +佐 +疚 +栎 +醍 +掳 +蓄 +x +惆 +颜 +鲆 +榆 +〔 +猎 +敌 +暴 +谥 +鲫 +贾 +罗 +玻 +缄 +扦 +芪 +癣 +落 +徒 +臾 +恿 +猩 +托 +邴 +肄 +牵 +春 +陛 +耀 +刊 +拓 +蓓 +邳 +堕 +寇 +枉 +淌 +啡 +湄 +兽 +酷 +萼 +碚 +濠 +萤 +夹 +旬 +戮 +梭 +琥 +椭 +昔 +勺 +蜊 +绐 +晚 +孺 +僵 +宣 +摄 +冽 +旨 +萌 +忙 +蚤 +眉 +噼 +蟑 +付 +契 +瓜 +悼 +颡 +壁 +曾 +窕 +颢 +澎 +仿 +俑 +浑 +嵌 +浣 +乍 +碌 +褪 +乱 +蔟 +隙 +玩 +剐 +葫 +箫 +纲 +围 +伐 +决 +伙 +漩 +瑟 +刑 +肓 +镳 +缓 +蹭 +氨 +皓 +典 +畲 +坍 +铑 +檐 +塑 +洞 +倬 +储 +胴 +淳 +戾 +吐 +灼 +惺 +妙 +毕 +珐 +缈 +虱 +盖 +羰 +鸿 +磅 +谓 +髅 +娴 +苴 +唷 +蚣 +霹 +抨 +贤 +唠 +犬 +誓 +逍 +庠 +逼 +麓 +籼 +釉 +呜 +碧 +秧 +氩 +摔 +霄 +穸 +纨 +辟 +妈 +映 +完 +牛 +缴 +嗷 +炊 +恩 +荔 +茆 +掉 +紊 +慌 +莓 +羟 +阙 +萁 +磐 +另 +蕹 +辱 +鳐 +湮 +吡 +吩 +唐 +睦 +垠 +舒 +圜 +冗 +瞿 +溺 +芾 +囱 +匠 +僳 +汐 +菩 +饬 +漓 +黑 +霰 +浸 +濡 +窥 +毂 +蒡 +兢 +驻 +鹉 +芮 +诙 +迫 +雳 +厂 +忐 +臆 +猴 +鸣 +蚪 +栈 +箕 +羡 +渐 +莆 +捍 +眈 +哓 +趴 +蹼 +埕 +嚣 +骛 +宏 +淄 +斑 +噜 +严 +瑛 +垃 +椎 +诱 +压 +庾 +绞 +焘 +廿 +抡 +迄 +棘 +夫 +纬 +锹 +眨 +瞌 +侠 +脐 +竞 +瀑 +孳 +骧 +遁 +姜 +颦 +荪 +滚 +萦 +伪 +逸 +粳 +爬 +锁 +矣 +役 +趣 +洒 +颔 +诏 +逐 +奸 +甭 +惠 +攀 +蹄 +泛 +尼 +拼 +阮 +鹰 +亚 +颈 +惑 +勒 +〉 +际 +肛 +爷 +刚 +钨 +丰 +养 +冶 +鲽 +辉 +蔻 +画 +覆 +皴 +妊 +麦 +返 +醉 +皂 +擀 +〗 +酶 +凑 +粹 +悟 +诀 +硖 +港 +卜 +z +杀 +涕 +± +舍 +铠 +抵 +弛 +段 +敝 +镐 +奠 +拂 +轴 +跛 +袱 +e +t +沉 +菇 +俎 +薪 +峦 +秭 +蟹 +历 +盟 +菠 +寡 +液 +肢 +喻 +染 +裱 +悱 +抱 +氙 +赤 +捅 +猛 +跑 +氮 +谣 +仁 +尺 +辊 +窍 +烙 +衍 +架 +擦 +倏 +璐 +瑁 +币 +楞 +胖 +夔 +趸 +邛 +惴 +饕 +虔 +蝎 +§ +哉 +贝 +宽 +辫 +炮 +扩 +饲 +籽 +魏 +菟 +锰 +伍 +猝 +末 +琳 +哚 +蛎 +邂 +呀 +姿 +鄞 +却 +歧 +仙 +恸 +椐 +森 +牒 +寤 +袒 +婆 +虢 +雅 +钉 +朵 +贼 +欲 +苞 +寰 +故 +龚 +坭 +嘘 +咫 +礼 +硷 +兀 +睢 +汶 +’ +铲 +烧 +绕 +诃 +浃 +钿 +哺 +柜 +讼 +颊 +璁 +腔 +洽 +咐 +脲 +簌 +筠 +镣 +玮 +鞠 +谁 +兼 +姆 +挥 +梯 +蝴 +谘 +漕 +刷 +躏 +宦 +弼 +b +垌 +劈 +麟 +莉 +揭 +笙 +渎 +仕 +嗤 +仓 +配 +怏 +抬 +错 +泯 +镊 +孰 +猿 +邪 +仍 +秋 +鼬 +壹 +歇 +吵 +炼 +< +尧 +射 +柬 +廷 +胧 +霾 +凳 +隋 +肚 +浮 +梦 +祥 +株 +堵 +退 +L +鹫 +跎 +凶 +毽 +荟 +炫 +栩 +玳 +甜 +沂 +鹿 +顽 +伯 +爹 +赔 +蛴 +徐 +匡 +欣 +狰 +缸 +雹 +蟆 +疤 +默 +沤 +啜 +痂 +衣 +禅 +w +i +h +辽 +葳 +黝 +钗 +停 +沽 +棒 +馨 +颌 +肉 +吴 +硫 +悯 +劾 +娈 +马 +啧 +吊 +悌 +镑 +峭 +帆 +瀣 +涉 +咸 +疸 +滋 +泣 +翦 +拙 +癸 +钥 +蜒 ++ +尾 +庄 +凝 +泉 +婢 +渴 +谊 +乞 +陆 +锉 +糊 +鸦 +淮 +I +B +N +晦 +弗 +乔 +庥 +葡 +尻 +席 +橡 +傣 +渣 +拿 +惩 +麋 +斛 +缃 +矮 +蛏 +岘 +鸽 +姐 +膏 +催 +奔 +镒 +喱 +蠡 +摧 +钯 +胤 +柠 +拐 +璋 +鸥 +卢 +荡 +倾 +^ +_ +珀 +逄 +萧 +塾 +掇 +贮 +笆 +聂 +圃 +冲 +嵬 +M +滔 +笕 +值 +炙 +偶 +蜱 +搐 +梆 +汪 +蔬 +腑 +鸯 +蹇 +敞 +绯 +仨 +祯 +谆 +梧 +糗 +鑫 +啸 +豺 +囹 +猾 +巢 +柄 +瀛 +筑 +踌 +沭 +暗 +苁 +鱿 +蹉 +脂 +蘖 +牢 +热 +木 +吸 +溃 +宠 +序 +泞 +偿 +拜 +檩 +厚 +朐 +毗 +螳 +吞 +媚 +朽 +担 +蝗 +橘 +畴 +祈 +糟 +盱 +隼 +郜 +惜 +珠 +裨 +铵 +焙 +琚 +唯 +咚 +噪 +骊 +丫 +滢 +勤 +棉 +呸 +咣 +淀 +隔 +蕾 +窈 +饨 +挨 +煅 +短 +匙 +粕 +镜 +赣 +撕 +墩 +酬 +馁 +豌 +颐 +抗 +酣 +氓 +佑 +搁 +哭 +递 +耷 +涡 +桃 +贻 +碣 +截 +瘦 +昭 +镌 +蔓 +氚 +甲 +猕 +蕴 +蓬 +散 +拾 +纛 +狼 +猷 +铎 +埋 +旖 +矾 +讳 +囊 +糜 +迈 +粟 +蚂 +紧 +鲳 +瘢 +栽 +稼 +羊 +锄 +斟 +睁 +桥 +瓮 +蹙 +祉 +醺 +鼻 +昱 +剃 +跳 +篱 +跷 +蒜 +翎 +宅 +晖 +嗑 +壑 +峻 +癫 +屏 +狠 +陋 +袜 +途 +憎 +祀 +莹 +滟 +佶 +溥 +臣 +约 +盛 +峰 +磁 +慵 +婪 +拦 +莅 +朕 +鹦 +粲 +裤 +哎 +疡 +嫖 +琵 +窟 +堪 +谛 +嘉 +儡 +鳝 +斩 +郾 +驸 +酊 +妄 +胜 +贺 +徙 +傅 +噌 +钢 +栅 +庇 +恋 +匝 +巯 +邈 +尸 +锚 +粗 +佟 +蛟 +薹 +纵 +蚊 +郅 +绢 +锐 +苗 +俞 +篆 +淆 +膀 +鲜 +煎 +诶 +秽 +寻 +涮 +刺 +怀 +噶 +巨 +褰 +魅 +灶 +灌 +桉 +藕 +谜 +舸 +薄 +搀 +恽 +借 +牯 +痉 +渥 +愿 +亓 +耘 +杠 +柩 +锔 +蚶 +钣 +珈 +喘 +蹒 +幽 +赐 +稗 +晤 +莱 +泔 +扯 +肯 +菪 +裆 +腩 +豉 +疆 +骜 +腐 +倭 +珏 +唔 +粮 +亡 +润 +慰 +伽 +橄 +玄 +誉 +醐 +胆 +龊 +粼 +塬 +陇 +彼 +削 +嗣 +绾 +芽 +妗 +垭 +瘴 +爽 +薏 +寨 +龈 +泠 +弹 +赢 +漪 +猫 +嘧 +涂 +恤 +圭 +茧 +烽 +屑 +痕 +巾 +赖 +荸 +凰 +腮 +畈 +亵 +蹲 +偃 +苇 +澜 +艮 +换 +骺 +烘 +苕 +梓 +颉 +肇 +哗 +悄 +氤 +涠 +葬 +屠 +鹭 +植 +竺 +佯 +诣 +鲇 +瘀 +鲅 +邦 +移 +滁 +冯 +耕 +癔 +戌 +茬 +沁 +巩 +悠 +湘 +洪 +痹 +锟 +循 +谋 +腕 +鳃 +钠 +捞 +焉 +迎 +碱 +伫 +急 +榷 +奈 +邝 +卯 +辄 +皲 +卟 +醛 +畹 +忧 +稳 +雄 +昼 +缩 +阈 +睑 +扌 +耗 +曦 +涅 +捏 +瞧 +邕 +淖 +漉 +铝 +耦 +禹 +湛 +喽 +莼 +琅 +诸 +苎 +纂 +硅 +始 +嗨 +傥 +燃 +臂 +赅 +嘈 +呆 +贵 +屹 +壮 +肋 +亍 +蚀 +卅 +豹 +腆 +邬 +迭 +浊 +} +童 +螂 +捐 +圩 +勐 +触 +寞 +汊 +壤 +荫 +膺 +渌 +芳 +懿 +遴 +螈 +泰 +蓼 +蛤 +茜 +舅 +枫 +朔 +膝 +眙 +避 +梅 +判 +鹜 +璜 +牍 +缅 +垫 +藻 +黔 +侥 +惚 +懂 +踩 +腰 +腈 +札 +丞 +唾 +慈 +顿 +摹 +荻 +琬 +~ +斧 +沈 +滂 +胁 +胀 +幄 +莜 +Z +匀 +鄄 +掌 +绰 +茎 +焚 +赋 +萱 +谑 +汁 +铒 +瞎 +夺 +蜗 +野 +娆 +冀 +弯 +篁 +懵 +灞 +隽 +芡 +脘 +俐 +辩 +芯 +掺 +喏 +膈 +蝈 +觐 +悚 +踹 +蔗 +熠 +鼠 +呵 +抓 +橼 +峨 +畜 +缔 +禾 +崭 +弃 +熊 +摒 +凸 +拗 +穹 +蒙 +抒 +祛 +劝 +闫 +扳 +阵 +醌 +踪 +喵 +侣 +搬 +仅 +荧 +赎 +蝾 +琦 +买 +婧 +瞄 +寓 +皎 +冻 +赝 +箩 +莫 +瞰 +郊 +笫 +姝 +筒 +枪 +遣 +煸 +袋 +舆 +痱 +涛 +母 +〇 +启 +践 +耙 +绲 +盘 +遂 +昊 +搞 +槿 +诬 +纰 +泓 +惨 +檬 +亻 +越 +C +o +憩 +熵 +祷 +钒 +暧 +塔 +阗 +胰 +咄 +娶 +魔 +琶 +钞 +邻 +扬 +杉 +殴 +咽 +弓 +〆 +髻 +】 +吭 +揽 +霆 +拄 +殖 +脆 +彻 +岩 +芝 +勃 +辣 +剌 +钝 +嘎 +甄 +佘 +皖 +伦 +授 +徕 +憔 +挪 +皇 +庞 +稔 +芜 +踏 +溴 +兖 +卒 +擢 +饥 +鳞 +煲 +‰ +账 +颗 +叻 +斯 +捧 +鳍 +琮 +讹 +蛙 +纽 +谭 +酸 +兔 +莒 +睇 +伟 +觑 +羲 +嗜 +宜 +褐 +旎 +辛 +卦 +诘 +筋 +鎏 +溪 +挛 +熔 +阜 +晰 +鳅 +丢 +奚 +灸 +呱 +献 +陉 +黛 +鸪 +甾 +萨 +疮 +拯 +洲 +疹 +辑 +叙 +恻 +谒 +允 +柔 +烂 +氏 +逅 +漆 +拎 +惋 +扈 +湟 +纭 +啕 +掬 +擞 +哥 +忽 +涤 +鸵 +靡 +郗 +瓷 +扁 +廊 +怨 +雏 +钮 +敦 +E +懦 +憋 +汀 +拚 +啉 +腌 +岸 +f +痼 +瞅 +尊 +咀 +眩 +飙 +忌 +仝 +迦 +熬 +毫 +胯 +篑 +茄 +腺 +凄 +舛 +碴 +锵 +诧 +羯 +後 +漏 +汤 +宓 +仞 +蚁 +壶 +谰 +皑 +铄 +棰 +罔 +辅 +晶 +苦 +牟 +闽 +\ +烃 +饮 +聿 +丙 +蛳 +朱 +煤 +涔 +鳖 +犁 +罐 +荼 +砒 +淦 +妤 +黏 +戎 +孑 +婕 +瑾 +戢 +钵 +枣 +捋 +砥 +衩 +狙 +桠 +稣 +阎 +肃 +梏 +诫 +孪 +昶 +婊 +衫 +嗔 +侃 +塞 +蜃 +樵 +峒 +貌 +屿 +欺 +缫 +阐 +栖 +诟 +珞 +荭 +吝 +萍 +嗽 +恂 +啻 +蜴 +磬 +峋 +俸 +豫 +谎 +徊 +镍 +韬 +魇 +晴 +U +囟 +猜 +蛮 +坐 +囿 +伴 +亭 +肝 +佗 +蝠 +妃 +胞 +滩 +榴 +氖 +垩 +苋 +砣 +扪 +馏 +姓 +轩 +厉 +夥 +侈 +禀 +垒 +岑 +赏 +钛 +辐 +痔 +披 +纸 +碳 +“ +坞 +蠓 +挤 +荥 +沅 +悔 +铧 +帼 +蒌 +蝇 +a +p +y +n +g +哀 +浆 +瑶 +凿 +桶 +馈 +皮 +奴 +苜 +佤 +伶 +晗 +铱 +炬 +优 +弊 +氢 +恃 +甫 +攥 +端 +锌 +灰 +稹 +炝 +曙 +邋 +亥 +眶 +碾 +拉 +萝 +绔 +捷 +浍 +腋 +姑 +菖 +凌 +涞 +麽 +锢 +桨 +潢 +绎 +镰 +殆 +锑 +渝 +铬 +困 +绽 +觎 +匈 +糙 +暑 +裹 +鸟 +盔 +肽 +迷 +綦 +『 +亳 +佝 +俘 +钴 +觇 +骥 +仆 +疝 +跪 +婶 +郯 +瀹 +唉 +脖 +踞 +针 +晾 +忒 +扼 +瞩 +叛 +椒 +疟 +嗡 +邗 +肆 +跆 +玫 +忡 +捣 +咧 +唆 +艄 +蘑 +潦 +笛 +阚 +沸 +泻 +掊 +菽 +贫 +斥 +髂 +孢 +镂 +赂 +麝 +鸾 +屡 +衬 +苷 +恪 +叠 +希 +粤 +爻 +喝 +茫 +惬 +郸 +绻 +庸 +撅 +碟 +宄 +妹 +膛 +叮 +饵 +崛 +嗲 +椅 +冤 +搅 +咕 +敛 +尹 +垦 +闷 +蝉 +霎 +勰 +败 +蓑 +泸 +肤 +鹌 +幌 +焦 +浠 +鞍 +刁 +舰 +乙 +竿 +裔 +。 +茵 +函 +伊 +兄 +丨 +娜 +匍 +謇 +莪 +宥 +似 +蝽 +翳 +酪 +翠 +粑 +薇 +祢 +骏 +赠 +叫 +Q +噤 +噻 +竖 +芗 +莠 +潭 +俊 +羿 +耜 +O +郫 +趁 +嗪 +囚 +蹶 +芒 +洁 +笋 +鹑 +敲 +硝 +啶 +堡 +渲 +揩 +』 +携 +宿 +遒 +颍 +扭 +棱 +割 +萜 +蔸 +葵 +琴 +捂 +饰 +衙 +耿 +掠 +募 +岂 +窖 +涟 +蔺 +瘤 +柞 +瞪 +怜 +匹 +距 +楔 +炜 +哆 +秦 +缎 +幼 +茁 +绪 +痨 +恨 +楸 +娅 +瓦 +桩 +雪 +嬴 +伏 +榔 +妥 +铿 +拌 +眠 +雍 +缇 +‘ +卓 +搓 +哌 +觞 +噩 +屈 +哧 +髓 +咦 +巅 +娑 +侑 +淫 +膳 +祝 +勾 +姊 +莴 +胄 +疃 +薛 +蜷 +胛 +巷 +芙 +芋 +熙 +闰 +勿 +窃 +狱 +剩 +钏 +幢 +陟 +铛 +慧 +靴 +耍 +k +浙 +浇 +飨 +惟 +绗 +祜 +澈 +啼 +咪 +磷 +摞 +诅 +郦 +抹 +跃 +壬 +吕 +肖 +琏 +颤 +尴 +剡 +抠 +凋 +赚 +泊 +津 +宕 +殷 +倔 +氲 +漫 +邺 +涎 +怠 +$ +垮 +荬 +遵 +俏 +叹 +噢 +饽 +蜘 +孙 +筵 +疼 +鞭 +羧 +牦 +箭 +潴 +c +眸 +祭 +髯 +啖 +坳 +愁 +芩 +驮 +倡 +巽 +穰 +沃 +胚 +怒 +凤 +槛 +剂 +趵 +嫁 +v +邢 +灯 +鄢 +桐 +睽 +檗 +锯 +槟 +婷 +嵋 +圻 +诗 +蕈 +颠 +遭 +痢 +芸 +怯 +馥 +竭 +锗 +徜 +恭 +遍 +籁 +剑 +嘱 +苡 +龄 +僧 +桑 +潸 +弘 +澶 +楹 +悲 +讫 +愤 +腥 +悸 +谍 +椹 +呢 +桓 +葭 +攫 +阀 +翰 +躲 +敖 +柑 +郎 +笨 +橇 +呃 +魁 +燎 +脓 +葩 +磋 +垛 +玺 +狮 +沓 +砜 +蕊 +锺 +罹 +蕉 +翱 +虐 +闾 +巫 +旦 +茱 +嬷 +枯 +鹏 +贡 +芹 +汛 +矫 +绁 +拣 +禺 +佃 +讣 +舫 +惯 +乳 +趋 +疲 +挽 +岚 +虾 +衾 +蠹 +蹂 +飓 +氦 +铖 +孩 +稞 +瑜 +壅 +掀 +勘 +妓 +畅 +髋 +W +庐 +牲 +蓿 +榕 +练 +垣 +唱 +邸 +菲 +昆 +婺 +穿 +绡 +麒 +蚱 +掂 +愚 +泷 +涪 +漳 +妩 +娉 +榄 +讷 +觅 +旧 +藤 +煮 +呛 +柳 +腓 +叭 +庵 +烷 +阡 +罂 +蜕 +擂 +猖 +咿 +媲 +脉 +【 +沏 +貅 +黠 +熏 +哲 +烁 +坦 +酵 +兜 +× +潇 +撒 +剽 +珩 +圹 +乾 +摸 +樟 +帽 +嗒 +襄 +魂 +轿 +憬 +锡 +〕 +喃 +皆 +咖 +隅 +脸 +残 +泮 +袂 +鹂 +珊 +囤 +捆 +咤 +误 +徨 +闹 +淙 +芊 +淋 +怆 +囗 +拨 +梳 +渤 +R +G +绨 +蚓 +婀 +幡 +狩 +麾 +谢 +唢 +裸 +旌 +伉 +纶 +裂 +驳 +砼 +咛 +澄 +樨 +蹈 +宙 +澍 +倍 +貔 +操 +勇 +蟠 +摈 +砧 +虬 +够 +缁 +悦 +藿 +撸 +艹 +摁 +淹 +豇 +虎 +榭 +ˉ +吱 +d +° +喧 +荀 +踱 +侮 +奋 +偕 +饷 +犍 +惮 +坑 +璎 +徘 +宛 +妆 +袈 +倩 +窦 +昂 +荏 +乖 +K +怅 +撰 +鳙 +牙 +袁 +酞 +X +痿 +琼 +闸 +雁 +趾 +荚 +虻 +涝 +《 +杏 +韭 +偈 +烤 +绫 +鞘 +卉 +症 +遢 +蓥 +诋 +杭 +荨 +匆 +竣 +簪 +辙 +敕 +虞 +丹 +缭 +咩 +黟 +m +淤 +瑕 +咂 +铉 +硼 +茨 +嶂 +痒 +畸 +敬 +涿 +粪 +窘 +熟 +叔 +嫔 +盾 +忱 +裘 +憾 +梵 +赡 +珙 +咯 +娘 +庙 +溯 +胺 +葱 +痪 +摊 +荷 +卞 +乒 +髦 +寐 +铭 +坩 +胗 +枷 +爆 +溟 +嚼 +羚 +砬 +轨 +惊 +挠 +罄 +竽 +菏 +氧 +浅 +楣 +盼 +枢 +炸 +阆 +杯 +谏 +噬 +淇 +渺 +俪 +秆 +墓 +泪 +跻 +砌 +痰 +垡 +渡 +耽 +釜 +讶 +鳎 +煞 +呗 +韶 +舶 +绷 +鹳 +缜 +旷 +铊 +皱 +龌 +檀 +霖 +奄 +槐 +艳 +蝶 +旋 +哝 +赶 +骞 +蚧 +腊 +盈 +丁 +` +蜚 +矸 +蝙 +睨 +嚓 +僻 +鬼 +醴 +夜 +彝 +磊 +笔 +拔 +栀 +糕 +厦 +邰 +纫 +逭 +纤 +眦 +膊 +馍 +躇 +烯 +蘼 +冬 +诤 +暄 +骶 +哑 +瘠 +」 +臊 +丕 +愈 +咱 +螺 +擅 +跋 +搏 +硪 +谄 +笠 +淡 +嘿 +骅 +谧 +鼎 +皋 +姚 +歼 +蠢 +驼 +耳 +胬 +挝 +涯 +狗 +蒽 +孓 +犷 +凉 +芦 +箴 +铤 +孤 +嘛 +坤 +V +茴 +朦 +挞 +尖 +橙 +诞 +搴 +碇 +洵 +浚 +帚 +蜍 +漯 +柘 +嚎 +讽 +芭 +荤 +咻 +祠 +秉 +跖 +埃 +吓 +糯 +眷 +馒 +惹 +娼 +鲑 +嫩 +讴 +轮 +瞥 +靶 +褚 +乏 +缤 +宋 +帧 +删 +驱 +碎 +扑 +俩 +俄 +偏 +涣 +竹 +噱 +皙 +佰 +渚 +唧 +斡 +# +镉 +刀 +崎 +筐 +佣 +夭 +贰 +肴 +峙 +哔 +艿 +匐 +牺 +镛 +缘 +仡 +嫡 +劣 +枸 +堀 +梨 +簿 +鸭 +蒸 +亦 +稽 +浴 +{ +衢 +束 +槲 +j +阁 +揍 +疥 +棋 +潋 +聪 +窜 +乓 +睛 +插 +冉 +阪 +苍 +搽 +「 +蟾 +螟 +幸 +仇 +樽 +撂 +慢 +跤 +幔 +俚 +淅 +覃 +觊 +溶 +妖 +帛 +侨 +曰 +妾 +泗 +· +: +瀘 +風 +Ë +( +) +∶ +紅 +紗 +瑭 +雲 +頭 +鶏 +財 +許 +• +¥ +樂 +焗 +麗 +— +; +滙 +東 +榮 +繪 +興 +… +門 +業 +π +楊 +國 +顧 +é +盤 +寳 +Λ +龍 +鳳 +島 +誌 +緣 +結 +銭 +萬 +勝 +祎 +璟 +優 +歡 +臨 +時 +購 += +★ +藍 +昇 +鐵 +觀 +勅 +農 +聲 +畫 +兿 +術 +發 +劉 +記 +專 +耑 +園 +書 +壴 +種 +Ο +● +褀 +號 +銀 +匯 +敟 +锘 +葉 +橪 +廣 +進 +蒄 +鑽 +阝 +祙 +貢 +鍋 +豊 +夬 +喆 +團 +閣 +開 +燁 +賓 +館 +酡 +沔 +順 ++ +硚 +劵 +饸 +陽 +車 +湓 +復 +萊 +氣 +軒 +華 +堃 +迮 +纟 +戶 +馬 +學 +裡 +電 +嶽 +獨 +マ +シ +サ +ジ +燘 +袪 +環 +❤ +臺 +灣 +専 +賣 +孖 +聖 +攝 +線 +▪ +α +傢 +俬 +夢 +達 +莊 +喬 +貝 +薩 +劍 +羅 +壓 +棛 +饦 +尃 +璈 +囍 +醫 +G +I +A +# +N +鷄 +髙 +嬰 +啓 +約 +隹 +潔 +賴 +藝 +~ +寶 +籣 +麺 +  +嶺 +√ +義 +網 +峩 +長 +∧ +魚 +機 +構 +② +鳯 +偉 +L +B +㙟 +畵 +鴿 +' +詩 +溝 +嚞 +屌 +藔 +佧 +玥 +蘭 +織 +1 +3 +9 +0 +7 +點 +砭 +鴨 +鋪 +銘 +廳 +弍 +‧ +創 +湯 +坶 +℃ +卩 +骝 +& +烜 +荘 +當 +潤 +扞 +係 +懷 +碶 +钅 +蚨 +讠 +☆ +叢 +爲 +埗 +涫 +塗 +→ +楽 +現 +鯨 +愛 +瑪 +鈺 +忄 +悶 +藥 +飾 +樓 +視 +孬 +ㆍ +燚 +苪 +師 +① +丼 +锽 +│ +韓 +標 +è +兒 +閏 +匋 +張 +漢 +Ü +髪 +會 +閑 +檔 +習 +裝 +の +峯 +菘 +輝 +И +雞 +釣 +億 +浐 +K +O +R +8 +H +E +P +T +W +D +S +C +M +F +姌 +饹 +» +晞 +廰 +ä +嵯 +鷹 +負 +飲 +絲 +冚 +楗 +澤 +綫 +區 +❋ +← +質 +靑 +揚 +③ +滬 +統 +産 +協 +﹑ +乸 +畐 +經 +運 +際 +洺 +岽 +為 +粵 +諾 +崋 +豐 +碁 +ɔ +V +2 +6 +齋 +誠 +訂 +´ +勑 +雙 +陳 +無 +í +泩 +媄 +夌 +刂 +i +c +t +o +r +a +嘢 +耄 +燴 +暃 +壽 +媽 +靈 +抻 +體 +唻 +É +冮 +甹 +鎮 +錦 +ʌ +蜛 +蠄 +尓 +駕 +戀 +飬 +逹 +倫 +貴 +極 +Я +Й +寬 +磚 +嶪 +郎 +職 +| +間 +n +d +剎 +伈 +課 +飛 +橋 +瘊 +№ +譜 +骓 +圗 +滘 +縣 +粿 +咅 +養 +濤 +彳 +® +% +Ⅱ +啰 +㴪 +見 +矞 +薬 +糁 +邨 +鲮 +顔 +罱 +З +選 +話 +贏 +氪 +俵 +競 +瑩 +繡 +枱 +β +綉 +á +獅 +爾 +™ +麵 +戋 +淩 +徳 +個 +劇 +場 +務 +簡 +寵 +h +實 +膠 +轱 +圖 +築 +嘣 +樹 +㸃 +營 +耵 +孫 +饃 +鄺 +飯 +麯 +遠 +輸 +坫 +孃 +乚 +閃 +鏢 +㎡ +題 +廠 +關 +↑ +爺 +將 +軍 +連 +篦 +覌 +參 +箸 +- +窠 +棽 +寕 +夀 +爰 +歐 +呙 +閥 +頡 +熱 +雎 +垟 +裟 +凬 +勁 +帑 +馕 +夆 +疌 +枼 +馮 +貨 +蒤 +樸 +彧 +旸 +靜 +龢 +暢 +㐱 +鳥 +珺 +鏡 +灡 +爭 +堷 +廚 +Ó +騰 +診 +┅ +蘇 +褔 +凱 +頂 +豕 +亞 +帥 +嘬 +⊥ +仺 +桖 +複 +饣 +絡 +穂 +顏 +棟 +納 +▏ +濟 +親 +設 +計 +攵 +埌 +烺 +ò +頤 +燦 +蓮 +撻 +節 +講 +濱 +濃 +娽 +洳 +朿 +燈 +鈴 +護 +膚 +铔 +過 +補 +Z +U +5 +4 +坋 +闿 +䖝 +餘 +缐 +铞 +貿 +铪 +桼 +趙 +鍊 +[ +㐂 +垚 +菓 +揸 +捲 +鐘 +滏 +𣇉 +爍 +輪 +燜 +鴻 +鮮 +動 +鹞 +鷗 +丄 +慶 +鉌 +翥 +飮 +腸 +⇋ +漁 +覺 +來 +熘 +昴 +翏 +鲱 +圧 +鄉 +萭 +頔 +爐 +嫚 +г +貭 +類 +聯 +幛 +輕 +訓 +鑒 +夋 +锨 +芃 +珣 +䝉 +扙 +嵐 +銷 +處 +ㄱ +語 +誘 +苝 +歸 +儀 +燒 +楿 +內 +粢 +葒 +奧 +麥 +礻 +滿 +蠔 +穵 +瞭 +態 +鱬 +榞 +硂 +鄭 +黃 +煙 +祐 +奓 +逺 +* +瑄 +獲 +聞 +薦 +讀 +這 +樣 +決 +問 +啟 +們 +執 +説 +轉 +單 +隨 +唘 +帶 +倉 +庫 +還 +贈 +尙 +皺 +■ +餅 +產 +○ +∈ +報 +狀 +楓 +賠 +琯 +嗮 +禮 +` +傳 +> +≤ +嗞 +Φ +≥ +換 +咭 +∣ +↓ +曬 +ε +応 +寫 +″ +終 +様 +純 +費 +療 +聨 +凍 +壐 +郵 +ü +黒 +∫ +製 +塊 +調 +軽 +確 +撃 +級 +馴 +Ⅲ +涇 +繹 +數 +碼 +證 +狒 +処 +劑 +< +晧 +賀 +衆 +] +櫥 +兩 +陰 +絶 +對 +鯉 +憶 +◎ +p +e +Y +蕒 +煖 +頓 +測 +試 +鼽 +僑 +碩 +妝 +帯 +≈ +鐡 +舖 +權 +喫 +倆 +ˋ +該 +悅 +ā +俫 +. +f +s +b +m +k +g +u +j +貼 +淨 +濕 +針 +適 +備 +l +/ +給 +謢 +強 +觸 +衛 +與 +⊙ +$ +緯 +變 +⑴ +⑵ +⑶ +㎏ +殺 +∩ +幚 +─ +價 +▲ +離 +ú +ó +飄 +烏 +関 +閟 +﹝ +﹞ +邏 +輯 +鍵 +驗 +訣 +導 +歷 +屆 +層 +▼ +儱 +錄 +熳 +ē +艦 +吋 +錶 +辧 +飼 +顯 +④ +禦 +販 +気 +対 +枰 +閩 +紀 +幹 +瞓 +貊 +淚 +△ +眞 +墊 +Ω +獻 +褲 +縫 +緑 +亜 +鉅 +餠 +{ +} +◆ +蘆 +薈 +█ +◇ +溫 +彈 +晳 +粧 +犸 +穩 +訊 +崬 +凖 +熥 +П +舊 +條 +紋 +圍 +Ⅳ +筆 +尷 +難 +雜 +錯 +綁 +識 +頰 +鎖 +艶 +□ +殁 +殼 +⑧ +├ +▕ +鵬 +ǐ +ō +ǒ +糝 +綱 +▎ +μ +盜 +饅 +醬 +籤 +蓋 +釀 +鹽 +據 +à +ɡ +辦 +◥ +彐 +┌ +婦 +獸 +鲩 +伱 +ī +蒟 +蒻 +齊 +袆 +腦 +寧 +凈 +妳 +煥 +詢 +偽 +謹 +啫 +鯽 +騷 +鱸 +損 +傷 +鎻 +髮 +買 +冏 +儥 +両 +﹢ +∞ +載 +喰 +z +羙 +悵 +燙 +曉 +員 +組 +徹 +艷 +痠 +鋼 +鼙 +縮 +細 +嚒 +爯 +≠ +維 +" +鱻 +壇 +厍 +帰 +浥 +犇 +薡 +軎 +² +應 +醜 +刪 +緻 +鶴 +賜 +噁 +軌 +尨 +镔 +鷺 +槗 +彌 +葚 +濛 +請 +溇 +緹 +賢 +訪 +獴 +瑅 +資 +縤 +陣 +蕟 +栢 +韻 +祼 +恁 +伢 +謝 +劃 +涑 +總 +衖 +踺 +砋 +凉 +籃 +駿 +苼 +瘋 +昽 +紡 +驊 +腎 +﹗ +響 +杋 +剛 +嚴 +禪 +歓 +槍 +傘 +檸 +檫 +炣 +勢 +鏜 +鎢 +銑 +尐 +減 +奪 +惡 +θ +僮 +婭 +臘 +ū +ì +殻 +鉄 +∑ +蛲 +焼 +緖 +續 +紹 +懮 diff --git a/examples/vision/detection/paddledetection/android/app/src/main/cpp/CMakeLists.txt b/examples/vision/detection/paddledetection/android/app/src/main/cpp/CMakeLists.txt deleted file mode 100644 index b3f560b9e..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/cpp/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -# For more information about using CMake with Android Studio, read the -# documentation: https://d.android.com/studio/projects/add-native-code.html - -# Sets the minimum version of CMake required to build the native library. -cmake_minimum_required(VERSION 3.10.2) - -# Declares and names the project. -project("fastdeploy_jni") - -# Creates and names a library, sets it as either STATIC -# or SHARED, and provides the relative paths to its source code. -# You can define multiple libraries, and CMake builds them for you. -# Gradle automatically packages shared libraries with your APK. - -set(FastDeploy_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/fastdeploy-android-0.4.0-shared") - -find_package(FastDeploy REQUIRED) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories(${FastDeploy_INCLUDE_DIRS}) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffast-math -Ofast -Os -DNDEBUG -fno-exceptions -fomit-frame-pointer -fno-asynchronous-unwind-tables -fno-unwind-tables") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -fdata-sections -ffunction-sections") -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections -Wl,-z,nocopyreloc") - -add_library( - fastdeploy_jni - SHARED - utils_jni.cc - bitmap_jni.cc - vision/results_jni.cc - vision/visualize_jni.cc - vision/detection/picodet_jni.cc - vision/classification/paddleclas_model_jni.cc) - -# Searches for a specified prebuilt library and stores the path as a -# variable. Because CMake includes system libraries in the search path by -# default, you only need to specify the name of the public NDK library -# you want to add. CMake verifies that the library exists before -# completing its build. - -find_library( # Sets the name of the path variable. - log-lib - # Specifies the name of the NDK library that - # you want CMake to locate. - log) - -# Specifies libraries CMake should link to your target library. You can link -# multiple libraries, such as libraries you define in this build script, -# prebuilt third-party libraries, or system libraries. - -target_link_libraries( - # Specifies the target library. - fastdeploy_jni - jnigraphics - ${FASTDEPLOY_LIBS} - GLESv2 - EGL - ${log-lib} -) diff --git a/examples/vision/detection/paddledetection/android/app/src/main/cpp/bitmap_jni.cc b/examples/vision/detection/paddledetection/android/app/src/main/cpp/bitmap_jni.cc deleted file mode 100644 index 5a3060911..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/cpp/bitmap_jni.cc +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "bitmap_jni.h" // NOLINT - -#include // NOLINT - -#include "utils_jni.h" // NOLINT - -namespace fastdeploy { -namespace jni { - -jboolean ARGB888Bitmap2RGBA(JNIEnv *env, jobject j_argb8888_bitmap, - cv::Mat *c_rgba) { - // Convert the android bitmap(ARGB8888) to the OpenCV RGBA image. Actually, - // the data layout of ARGB8888 is R, G, B, A, it's the same as CV RGBA image, - // so it is unnecessary to do the conversion of color format, check - // https://developer.android.com/reference/android/graphics/Bitmap.Config#ARGB_8888 - // to get the more details about Bitmap.Config.ARGB8888 - AndroidBitmapInfo j_bitmap_info; - if (AndroidBitmap_getInfo(env, j_argb8888_bitmap, &j_bitmap_info) < 0) { - LOGE("Invoke AndroidBitmap_getInfo() failed!"); - return JNI_FALSE; - } - if (j_bitmap_info.format != ANDROID_BITMAP_FORMAT_RGBA_8888) { - LOGE("Only Bitmap.Config.ARGB8888 color format is supported!"); - return JNI_FALSE; - } - void *j_bitmap_pixels; - if (AndroidBitmap_lockPixels(env, j_argb8888_bitmap, &j_bitmap_pixels) < 0) { - LOGE("Invoke AndroidBitmap_lockPixels() failed!"); - return JNI_FALSE; - } - cv::Mat j_bitmap_im(static_cast(j_bitmap_info.height), - static_cast(j_bitmap_info.width), CV_8UC4, - j_bitmap_pixels); - j_bitmap_im.copyTo(*(c_rgba)); - if (AndroidBitmap_unlockPixels(env, j_argb8888_bitmap) < 0) { - LOGE("Invoke AndroidBitmap_unlockPixels() failed!"); - return JNI_FALSE; - } - return JNI_TRUE; -} - -jboolean ARGB888Bitmap2BGR(JNIEnv *env, jobject j_argb8888_bitmap, - cv::Mat *c_bgr) { - cv::Mat c_rgba; - if (!ARGB888Bitmap2RGBA(env, j_argb8888_bitmap, &c_rgba)) { - return JNI_FALSE; - } - cv::cvtColor(c_rgba, *(c_bgr), cv::COLOR_RGBA2BGR); - return JNI_TRUE; -} - -jboolean RGBA2ARGB888Bitmap(JNIEnv *env, jobject j_argb8888_bitmap, - const cv::Mat &c_rgba) { - AndroidBitmapInfo j_bitmap_info; - if (AndroidBitmap_getInfo(env, j_argb8888_bitmap, &j_bitmap_info) < 0) { - LOGE("Invoke AndroidBitmap_getInfo() failed!"); - return JNI_FALSE; - } - void *j_bitmap_pixels; - if (AndroidBitmap_lockPixels(env, j_argb8888_bitmap, &j_bitmap_pixels) < 0) { - LOGE("Invoke AndroidBitmap_lockPixels() failed!"); - return JNI_FALSE; - } - cv::Mat j_bitmap_im(static_cast(j_bitmap_info.height), - static_cast(j_bitmap_info.width), CV_8UC4, - j_bitmap_pixels); - c_rgba.copyTo(j_bitmap_im); - if (AndroidBitmap_unlockPixels(env, j_argb8888_bitmap) < 0) { - LOGE("Invoke AndroidBitmap_unlockPixels() failed!"); - return JNI_FALSE; - } - return JNI_TRUE; -} - -jboolean BGR2ARGB888Bitmap(JNIEnv *env, jobject j_argb8888_bitmap, - const cv::Mat &c_bgr) { - if (c_bgr.empty()) { - return JNI_FALSE; - } - cv::Mat c_rgba; - cv::cvtColor(c_bgr, c_rgba, cv::COLOR_BGR2RGBA); - return RGBA2ARGB888Bitmap(env, j_argb8888_bitmap, c_rgba); -} - -} // namespace jni -} // namespace fastdeploy diff --git a/examples/vision/detection/paddledetection/android/app/src/main/cpp/bitmap_jni.h b/examples/vision/detection/paddledetection/android/app/src/main/cpp/bitmap_jni.h deleted file mode 100644 index 5bd8b195a..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/cpp/bitmap_jni.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include // NOLINT - -#include "fastdeploy/vision.h" // NOLINT - -namespace fastdeploy { -namespace jni { - -// Convert the android bitmap(ARGB8888) to the OpenCV RGBA image. Actually, -// the data layout of ARGB8888 is R, G, B, A, it's the same as CV RGBA image, -// so it is unnecessary to do the conversion of color format, check -// https://developer.android.com/reference/android/graphics/Bitmap.Config#ARGB_8888 -// to get the more details about Bitmap.Config.ARGB8888 -jboolean ARGB888Bitmap2RGBA(JNIEnv *env, jobject j_argb8888_bitmap, - cv::Mat *c_rgba); -jboolean RGBA2ARGB888Bitmap(JNIEnv *env, jobject j_argb8888_bitmap, - const cv::Mat &c_rgba); -jboolean ARGB888Bitmap2BGR(JNIEnv *env, jobject j_argb8888_bitmap, - cv::Mat *c_bgr); -jboolean BGR2ARGB888Bitmap(JNIEnv *env, jobject j_argb8888_bitmap, - const cv::Mat &c_bgr); - -} // namespace jni -} // namespace fastdeploy diff --git a/examples/vision/detection/paddledetection/android/app/src/main/cpp/convert_jni.h b/examples/vision/detection/paddledetection/android/app/src/main/cpp/convert_jni.h deleted file mode 100644 index 31ee92fe7..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/cpp/convert_jni.h +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#include // NOLINT - -#include // NOLINT -#include // NOLINT - -namespace fastdeploy { -namespace jni { - -template -OutputType ConvertTo(JNIEnv *env, InputType input); - -template -OutputType ConvertTo(JNIEnv *env, const InputType *input, int64_t len); - -/// jstring -> std::string -template <> -inline std::string ConvertTo(JNIEnv *env, jstring jstr) { - // In java, a unicode char will be encoded using 2 bytes (utf16). - // so jstring will contain characters utf16. std::string in c++ is - // essentially a string of bytes, not characters, so if we want to - // pass jstring from JNI to c++, we have convert utf16 to bytes. - if (!jstr) { - return ""; - } - const jclass jstring_clazz = env->GetObjectClass(jstr); - const jmethodID getBytesID = - env->GetMethodID(jstring_clazz, "getBytes", "(Ljava/lang/String;)[B"); - const jbyteArray jstring_bytes = (jbyteArray)env->CallObjectMethod( - jstr, getBytesID, env->NewStringUTF("UTF-8")); - - size_t length = static_cast(env->GetArrayLength(jstring_bytes)); - jbyte *jstring_bytes_ptr = env->GetByteArrayElements(jstring_bytes, NULL); - - std::string res = - std::string(reinterpret_cast(jstring_bytes_ptr), length); - env->ReleaseByteArrayElements(jstring_bytes, jstring_bytes_ptr, JNI_ABORT); - - env->DeleteLocalRef(jstring_bytes); - env->DeleteLocalRef(jstring_clazz); - return res; -} - -/// std::string -> jstring -template <> -inline jstring ConvertTo(JNIEnv *env, std::string str) { - auto *cstr_data_ptr = str.c_str(); - jclass jstring_clazz = env->FindClass("java/lang/String"); - jmethodID initID = - env->GetMethodID(jstring_clazz, "", "([BLjava/lang/String;)V"); - - jbyteArray jstring_bytes = env->NewByteArray(strlen(cstr_data_ptr)); - env->SetByteArrayRegion(jstring_bytes, 0, strlen(cstr_data_ptr), - reinterpret_cast(cstr_data_ptr)); - - jstring jstring_encoding = env->NewStringUTF("UTF-8"); - jstring res = (jstring)(env->NewObject(jstring_clazz, initID, jstring_bytes, - jstring_encoding)); - - env->DeleteLocalRef(jstring_clazz); - env->DeleteLocalRef(jstring_bytes); - env->DeleteLocalRef(jstring_encoding); - - return res; -} - -/// jlongArray -> std::vector -template <> -inline std::vector ConvertTo(JNIEnv *env, jlongArray jdata) { - int jdata_size = env->GetArrayLength(jdata); - jlong *jdata_ptr = env->GetLongArrayElements(jdata, nullptr); - std::vector res(jdata_ptr, jdata_ptr + jdata_size); - env->ReleaseLongArrayElements(jdata, jdata_ptr, 0); - return res; -} - -/// jfloatArray -> std::vector -template <> -inline std::vector ConvertTo(JNIEnv *env, jfloatArray jdata) { - int jdata_size = env->GetArrayLength(jdata); - jfloat *jdata_ptr = env->GetFloatArrayElements(jdata, nullptr); - std::vector res(jdata_ptr, jdata_ptr + jdata_size); - env->ReleaseFloatArrayElements(jdata, jdata_ptr, 0); - return res; -} - -/// std::vector -> jlongArray -template <> -inline jlongArray ConvertTo(JNIEnv *env, const std::vector &cvec) { - jlongArray res = env->NewLongArray(cvec.size()); - jlong *jbuf = new jlong[cvec.size()]; - for (size_t i = 0; i < cvec.size(); ++i) { - jbuf[i] = (jlong)cvec[i]; - } - env->SetLongArrayRegion(res, 0, cvec.size(), jbuf); - delete[] jbuf; - return res; -} - -/// cxx float buffer -> jfloatArray -template <> -inline jfloatArray ConvertTo(JNIEnv *env, const float *cbuf, int64_t len) { - jfloatArray res = env->NewFloatArray(len); - env->SetFloatArrayRegion(res, 0, len, cbuf); - return res; -} - -/// cxx int buffer -> jintArray -template <> -inline jintArray ConvertTo(JNIEnv *env, const int *cbuf, int64_t len) { - jintArray res = env->NewIntArray(len); - env->SetIntArrayRegion(res, 0, len, cbuf); - return res; -} - -/// cxx int8_t buffer -> jbyteArray -template <> -inline jbyteArray ConvertTo(JNIEnv *env, const int8_t *cbuf, int64_t len) { - jbyteArray res = env->NewByteArray(len); - env->SetByteArrayRegion(res, 0, len, cbuf); - return res; -} - -} // namespace jni -} // namespace fastdeploy diff --git a/examples/vision/detection/paddledetection/android/app/src/main/cpp/fastdeploy_jni.h b/examples/vision/detection/paddledetection/android/app/src/main/cpp/fastdeploy_jni.h deleted file mode 100644 index 2b40a87d2..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/cpp/fastdeploy_jni.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once -#include "bitmap_jni.h" // NOLINT -#include "convert_jni.h" // NOLINT -#include "utils_jni.h" // NOLINT diff --git a/examples/vision/detection/paddledetection/android/app/src/main/cpp/utils_jni.cc b/examples/vision/detection/paddledetection/android/app/src/main/cpp/utils_jni.cc deleted file mode 100644 index 47775f03c..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/cpp/utils_jni.cc +++ /dev/null @@ -1,82 +0,0 @@ -// -// Created by qiuyanjun on 2022/10/19. -// - -// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "utils_jni.h" - -namespace fastdeploy { -namespace jni { - -// Assets Loader Utils. -bool AssetsLoaderUtils::detection_labels_loaded_ = false; -bool AssetsLoaderUtils::classification_labels_loaded_ = false; -std::vector AssetsLoaderUtils::detection_labels_ = {}; -std::vector AssetsLoaderUtils::classification_labels_ = {}; - -bool AssetsLoaderUtils::IsDetectionLabelsLoaded() { - return detection_labels_loaded_; -} - -bool AssetsLoaderUtils::IsClassificationLabelsLoaded() { - return classification_labels_loaded_; -} - -const std::vector& AssetsLoaderUtils::GetDetectionLabels() { - return detection_labels_; -} - -const std::vector& AssetsLoaderUtils::GetClassificationLabels() { - return classification_labels_; -} - -void AssetsLoaderUtils::LoadClassificationLabels(const std::string& path, - bool force_reload) { - if (force_reload || (!classification_labels_loaded_)) { - classification_labels_loaded_ = - LoadLabelsFromTxt(path, &classification_labels_); - } -} - -void AssetsLoaderUtils::LoadDetectionLabels(const std::string& path, - bool force_reload) { - if (force_reload || (!detection_labels_loaded_)) { - detection_labels_loaded_ = LoadLabelsFromTxt(path, &detection_labels_); - } -} - -bool AssetsLoaderUtils::LoadLabelsFromTxt(const std::string& txt_path, - std::vector* labels) { - labels->clear(); - std::ifstream file; - file.open(txt_path); - if (!file.is_open()) { - return false; - } - while (file) { - std::string line; - std::getline(file, line); - if (!line.empty() && line != "\n") { - labels->push_back(line); - } - } - file.clear(); - file.close(); - return labels->size() > 0; -} - -} // namespace jni -} // namespace fastdeploy \ No newline at end of file diff --git a/examples/vision/detection/paddledetection/android/app/src/main/cpp/utils_jni.h b/examples/vision/detection/paddledetection/android/app/src/main/cpp/utils_jni.h deleted file mode 100644 index 8aeabe10a..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/cpp/utils_jni.h +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#pragma once - -#ifdef __ANDROID__ -#include // NOLINT -#endif -#include // NOLINT -#include // NOLINT -#include // NOLINT - -#define TAG "[FastDeploy][JNI]" -#ifdef __ANDROID__ -#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__) -#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__) -#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__) -#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__) -#define LOGF(...) __android_log_print(ANDROID_LOG_FATAL, TAG, __VA_ARGS__) -#else -#define LOGD(...) \ - {} -#define LOGI(...) \ - {} -#define LOGW(...) \ - {} -#define LOGE(...) \ - {} -#define LOGF(...) \ - {} -#endif - -namespace fastdeploy { -namespace jni { - -inline int64_t GetCurrentTime() { - struct timeval time; - gettimeofday(&time, NULL); - return 1000000LL * (int64_t)time.tv_sec + (int64_t)time.tv_usec; -} - -inline double GetElapsedTime(int64_t time) { - return (GetCurrentTime() - time) / 1000.0f; -} - -class AssetsLoaderUtils { - public: - static bool detection_labels_loaded_; - static bool classification_labels_loaded_; - static std::vector detection_labels_; - static std::vector classification_labels_; - - public: - static bool IsDetectionLabelsLoaded(); - static bool IsClassificationLabelsLoaded(); - static const std::vector& GetDetectionLabels(); - static const std::vector& GetClassificationLabels(); - static void LoadClassificationLabels(const std::string& path, - bool force_reload = false); - static void LoadDetectionLabels(const std::string& path, - bool force_reload = false); - - private: - static bool LoadLabelsFromTxt(const std::string& txt_path, - std::vector* labels); -}; - -} // namespace jni -} // namespace fastdeploy diff --git a/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/classification/paddleclas_model_jni.cc b/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/classification/paddleclas_model_jni.cc deleted file mode 100644 index 11600d9a0..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/classification/paddleclas_model_jni.cc +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include // NOLINT - -#include "fastdeploy_jni.h" // NOLINT - -#ifdef __cplusplus -extern "C" { -#endif - -JNIEXPORT jlong JNICALL -Java_com_baidu_paddle_fastdeploy_vision_classification_PaddleClasModel_bindNative( - JNIEnv *env, jclass clazz, jstring model_file, jstring params_file, - jstring config_file, jint cpu_num_thread, jboolean enable_lite_fp16, - jint lite_power_mode, jstring lite_optimized_model_dir, - jboolean enable_record_time_of_runtime, jstring label_file) { - std::string c_model_file = - fastdeploy::jni::ConvertTo(env, model_file); - std::string c_params_file = - fastdeploy::jni::ConvertTo(env, params_file); - std::string c_config_file = - fastdeploy::jni::ConvertTo(env, config_file); - std::string c_label_file = - fastdeploy::jni::ConvertTo(env, label_file); - std::string c_lite_optimized_model_dir = - fastdeploy::jni::ConvertTo(env, lite_optimized_model_dir); - auto c_cpu_num_thread = static_cast(cpu_num_thread); - auto c_enable_lite_fp16 = static_cast(enable_lite_fp16); - auto c_lite_power_mode = - static_cast(lite_power_mode); - fastdeploy::RuntimeOption c_option; - c_option.UseCpu(); - c_option.UseLiteBackend(); - c_option.SetCpuThreadNum(c_cpu_num_thread); - c_option.SetLitePowerMode(c_lite_power_mode); - c_option.SetLiteOptimizedModelDir(c_lite_optimized_model_dir); - if (c_enable_lite_fp16) { - c_option.EnableLiteFP16(); - } - auto c_model_ptr = new fastdeploy::vision::classification::PaddleClasModel( - c_model_file, c_params_file, c_config_file, c_option); - // Enable record Runtime time costs. - if (enable_record_time_of_runtime) { - c_model_ptr->EnableRecordTimeOfRuntime(); - } - // Load classification labels if label path is not empty. - if ((!fastdeploy::jni::AssetsLoaderUtils::IsClassificationLabelsLoaded()) && - (!c_label_file.empty())) { - fastdeploy::jni::AssetsLoaderUtils::LoadClassificationLabels(c_label_file); - } - // WARN: need to release manually in Java ! - return reinterpret_cast(c_model_ptr); // native model context -} - -JNIEXPORT jlong JNICALL -Java_com_baidu_paddle_fastdeploy_vision_classification_PaddleClasModel_predictNative( - JNIEnv *env, jclass clazz, jlong native_model_context, - jobject argb8888_bitmap, jboolean saved, jstring saved_image_path, - jfloat score_threshold, jboolean rendering) { - if (native_model_context == 0) { - return 0; - } - cv::Mat c_bgr; - auto t = fastdeploy::jni::GetCurrentTime(); - if (!fastdeploy::jni::ARGB888Bitmap2BGR(env, argb8888_bitmap, &c_bgr)) { - return 0; - } - LOGD("Read from bitmap costs %f ms", fastdeploy::jni::GetElapsedTime(t)); - auto c_model_ptr = - reinterpret_cast( - native_model_context); - auto c_result_ptr = new fastdeploy::vision::ClassifyResult(); - t = fastdeploy::jni::GetCurrentTime(); - if (!c_model_ptr->Predict(&c_bgr, c_result_ptr, 100)) { - delete c_result_ptr; - return 0; - } - LOGD("Predict from native costs %f ms", fastdeploy::jni::GetElapsedTime(t)); - if (c_model_ptr->EnabledRecordTimeOfRuntime()) { - auto info_of_runtime = c_model_ptr->PrintStatisInfoOfRuntime(); - LOGD("Avg runtime costs %f ms", info_of_runtime["avg_time"] * 1000.0f); - } - if (!c_result_ptr->scores.empty() && rendering) { - t = fastdeploy::jni::GetCurrentTime(); - cv::Mat c_vis_im; - if (fastdeploy::jni::AssetsLoaderUtils::IsClassificationLabelsLoaded()) { - c_vis_im = fastdeploy::vision::VisClassification( - c_bgr, *(c_result_ptr), - fastdeploy::jni::AssetsLoaderUtils::GetClassificationLabels(), 5, - score_threshold, 1.0f); - } else { - c_vis_im = fastdeploy::vision::VisClassification( - c_bgr, *(c_result_ptr), 5, score_threshold, 1.0f); - } - LOGD("Visualize from native costs %f ms", - fastdeploy::jni::GetElapsedTime(t)); - // Rendering to bitmap - t = fastdeploy::jni::GetCurrentTime(); - if (!fastdeploy::jni::BGR2ARGB888Bitmap(env, argb8888_bitmap, c_vis_im)) { - delete c_result_ptr; - return 0; - } - LOGD("Write to bitmap from native costs %f ms", - fastdeploy::jni::GetElapsedTime(t)); - std::string c_saved_image_path = - fastdeploy::jni::ConvertTo(env, saved_image_path); - if (!c_saved_image_path.empty() && saved) { - t = fastdeploy::jni::GetCurrentTime(); - cv::imwrite(c_saved_image_path, c_bgr); - LOGD("Save image from native costs %f ms, path: %s", - fastdeploy::jni::GetElapsedTime(t), c_saved_image_path.c_str()); - } - } - // WARN: need to release it manually in Java ! - return reinterpret_cast(c_result_ptr); // native result context -} - -JNIEXPORT jboolean JNICALL -Java_com_baidu_paddle_fastdeploy_vision_classification_PaddleClasModel_releaseNative( - JNIEnv *env, jclass clazz, jlong native_model_context) { - auto c_model_ptr = - reinterpret_cast( - native_model_context); - if (c_model_ptr->EnabledRecordTimeOfRuntime()) { - auto info_of_runtime = c_model_ptr->PrintStatisInfoOfRuntime(); - LOGD("[End] Avg runtime costs %f ms", - info_of_runtime["avg_time"] * 1000.0f); - } - delete c_model_ptr; - LOGD("[End] Release PaddleClasModel in native !"); - return JNI_TRUE; -} - -#ifdef __cplusplus -} -#endif diff --git a/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/detection/picodet_jni.cc b/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/detection/picodet_jni.cc deleted file mode 100644 index 1e4d790e3..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/detection/picodet_jni.cc +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include // NOLINT - -#include "fastdeploy_jni.h" // NOLINT - -#ifdef __cplusplus -extern "C" { -#endif - -JNIEXPORT jlong JNICALL -Java_com_baidu_paddle_fastdeploy_vision_detection_PicoDet_bindNative( - JNIEnv *env, jclass clazz, jstring model_file, jstring params_file, - jstring config_file, jint cpu_num_thread, jboolean enable_lite_fp16, - jint lite_power_mode, jstring lite_optimized_model_dir, - jboolean enable_record_time_of_runtime, jstring label_file) { - std::string c_model_file = - fastdeploy::jni::ConvertTo(env, model_file); - std::string c_params_file = - fastdeploy::jni::ConvertTo(env, params_file); - std::string c_config_file = - fastdeploy::jni::ConvertTo(env, config_file); - std::string c_label_file = - fastdeploy::jni::ConvertTo(env, label_file); - std::string c_lite_optimized_model_dir = - fastdeploy::jni::ConvertTo(env, lite_optimized_model_dir); - auto c_cpu_num_thread = static_cast(cpu_num_thread); - auto c_enable_lite_fp16 = static_cast(enable_lite_fp16); - auto c_lite_power_mode = - static_cast(lite_power_mode); - fastdeploy::RuntimeOption c_option; - c_option.UseCpu(); - c_option.UseLiteBackend(); - c_option.SetCpuThreadNum(c_cpu_num_thread); - c_option.SetLitePowerMode(c_lite_power_mode); - c_option.SetLiteOptimizedModelDir(c_lite_optimized_model_dir); - if (c_enable_lite_fp16) { - c_option.EnableLiteFP16(); - } - auto c_model_ptr = new fastdeploy::vision::detection::PicoDet( - c_model_file, c_params_file, c_config_file, c_option); - // Enable record Runtime time costs. - if (enable_record_time_of_runtime) { - c_model_ptr->EnableRecordTimeOfRuntime(); - } - // Load detection labels if label path is not empty. - if ((!fastdeploy::jni::AssetsLoaderUtils::IsDetectionLabelsLoaded()) && - (!c_label_file.empty())) { - fastdeploy::jni::AssetsLoaderUtils::LoadDetectionLabels(c_label_file); - } - // WARN: need to release manually in Java ! - return reinterpret_cast(c_model_ptr); // native model context -} - -JNIEXPORT jlong JNICALL -Java_com_baidu_paddle_fastdeploy_vision_detection_PicoDet_predictNative( - JNIEnv *env, jclass clazz, jlong native_model_context, - jobject argb8888_bitmap, jboolean saved, jstring saved_image_path, - jfloat score_threshold, jboolean rendering) { - if (native_model_context == 0) { - return 0; - } - cv::Mat c_bgr; - auto t = fastdeploy::jni::GetCurrentTime(); - if (!fastdeploy::jni::ARGB888Bitmap2BGR(env, argb8888_bitmap, &c_bgr)) { - return 0; - } - LOGD("Read from bitmap costs %f ms", fastdeploy::jni::GetElapsedTime(t)); - auto c_model_ptr = reinterpret_cast( - native_model_context); - auto c_result_ptr = new fastdeploy::vision::DetectionResult(); - t = fastdeploy::jni::GetCurrentTime(); - if (!c_model_ptr->Predict(&c_bgr, c_result_ptr)) { - delete c_result_ptr; - return 0; - } - LOGD("Predict from native costs %f ms", fastdeploy::jni::GetElapsedTime(t)); - if (c_model_ptr->EnabledRecordTimeOfRuntime()) { - auto info_of_runtime = c_model_ptr->PrintStatisInfoOfRuntime(); - LOGD("Avg runtime costs %f ms", info_of_runtime["avg_time"] * 1000.0f); - } - if (!c_result_ptr->boxes.empty() && rendering) { - t = fastdeploy::jni::GetCurrentTime(); - cv::Mat c_vis_im; - if (fastdeploy::jni::AssetsLoaderUtils::IsDetectionLabelsLoaded()) { - c_vis_im = fastdeploy::vision::VisDetection( - c_bgr, *(c_result_ptr), - fastdeploy::jni::AssetsLoaderUtils::GetDetectionLabels(), - score_threshold, 2, 1.0f); - } else { - c_vis_im = fastdeploy::vision::VisDetection(c_bgr, *(c_result_ptr), - score_threshold, 2, 1.0f); - } - LOGD("Visualize from native costs %f ms", - fastdeploy::jni::GetElapsedTime(t)); - // Rendering to bitmap - t = fastdeploy::jni::GetCurrentTime(); - if (!fastdeploy::jni::BGR2ARGB888Bitmap(env, argb8888_bitmap, c_vis_im)) { - delete c_result_ptr; - return 0; - } - LOGD("Write to bitmap from native costs %f ms", - fastdeploy::jni::GetElapsedTime(t)); - std::string c_saved_image_path = - fastdeploy::jni::ConvertTo(env, saved_image_path); - if (!c_saved_image_path.empty() && saved) { - t = fastdeploy::jni::GetCurrentTime(); - cv::imwrite(c_saved_image_path, c_vis_im); - LOGD("Save image from native costs %f ms, path: %s", - fastdeploy::jni::GetElapsedTime(t), c_saved_image_path.c_str()); - } - } - // WARN: need to release it manually in Java ! - return reinterpret_cast(c_result_ptr); // native result context -} - -JNIEXPORT jboolean JNICALL -Java_com_baidu_paddle_fastdeploy_vision_detection_PicoDet_releaseNative( - JNIEnv *env, jclass clazz, jlong native_model_context) { - if (native_model_context == 0) { - return JNI_FALSE; - } - auto c_model_ptr = reinterpret_cast( - native_model_context); - if (c_model_ptr->EnabledRecordTimeOfRuntime()) { - auto info_of_runtime = c_model_ptr->PrintStatisInfoOfRuntime(); - LOGD("[End] Avg runtime costs %f ms", - info_of_runtime["avg_time"] * 1000.0f); - } - delete c_model_ptr; - LOGD("[End] Release PicoDet in native !"); - return JNI_TRUE; -} - -#ifdef __cplusplus -} -#endif diff --git a/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/results_jni.cc b/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/results_jni.cc deleted file mode 100644 index 8fd224de9..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/results_jni.cc +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include // NOLINT -#include // NOLINT - -#include "fastdeploy/vision.h" // NOLINT -#include "fastdeploy_jni.h" // NOLINT - -#ifdef __cplusplus -extern "C" { -#endif - -/// Native DetectionResult for vision::DetectionResult. -JNIEXPORT jint JNICALL -Java_com_baidu_paddle_fastdeploy_vision_DetectionResult_copyBoxesNumFromNative( - JNIEnv *env, jclass clazz, jlong native_result_context) { - auto c_result_ptr = reinterpret_cast( - native_result_context); - return static_cast(c_result_ptr->boxes.size()); -} - -JNIEXPORT jfloatArray JNICALL -Java_com_baidu_paddle_fastdeploy_vision_DetectionResult_copyBoxesFromNative( - JNIEnv *env, jclass clazz, jlong native_result_context) { - auto c_result_ptr = reinterpret_cast( - native_result_context); - if (c_result_ptr->boxes.empty()) { - return {}; - } - const auto len = static_cast(c_result_ptr->boxes.size()); - float buffer[len * 4]; - const auto &boxes = c_result_ptr->boxes; - for (int64_t i = 0; i < len; ++i) { - std::memcpy((buffer + i * 4), (boxes.at(i).data()), 4 * sizeof(float)); - } - return fastdeploy::jni::ConvertTo(env, buffer, len * 4); -} - -JNIEXPORT jfloatArray JNICALL -Java_com_baidu_paddle_fastdeploy_vision_DetectionResult_copyScoresFromNative( - JNIEnv *env, jclass clazz, jlong native_result_context) { - auto c_result_ptr = reinterpret_cast( - native_result_context); - if (c_result_ptr->scores.empty()) { - return {}; - } - const auto len = static_cast(c_result_ptr->scores.size()); - const float *buffer = static_cast(c_result_ptr->scores.data()); - return fastdeploy::jni::ConvertTo(env, buffer, len); -} - -JNIEXPORT jintArray JNICALL -Java_com_baidu_paddle_fastdeploy_vision_DetectionResult_copyLabelIdsFromNative( - JNIEnv *env, jclass clazz, jlong native_result_context) { - auto c_result_ptr = reinterpret_cast( - native_result_context); - if (c_result_ptr->label_ids.empty()) { - return {}; - } - const auto len = static_cast(c_result_ptr->label_ids.size()); - const int *buffer = static_cast(c_result_ptr->label_ids.data()); - return fastdeploy::jni::ConvertTo(env, buffer, len); -} - -JNIEXPORT jboolean JNICALL -Java_com_baidu_paddle_fastdeploy_vision_DetectionResult_releaseNative( - JNIEnv *env, jclass clazz, jlong native_result_context) { - if (native_result_context == 0) { - return JNI_FALSE; - } - auto c_result_ptr = reinterpret_cast( - native_result_context); - delete c_result_ptr; - LOGD("Release DetectionResult in native !"); - return JNI_TRUE; -} - -/// Native ClassifyResult for vision::ClassifyResult. -JNIEXPORT jfloatArray JNICALL -Java_com_baidu_paddle_fastdeploy_vision_ClassifyResult_copyScoresFromNative( - JNIEnv *env, jclass clazz, jlong native_result_context) { - auto c_result_ptr = reinterpret_cast( - native_result_context); - if (c_result_ptr->scores.empty()) { - return {}; - } - const auto len = static_cast(c_result_ptr->scores.size()); - const float *buffer = static_cast(c_result_ptr->scores.data()); - return fastdeploy::jni::ConvertTo(env, buffer, len); -} - -JNIEXPORT jintArray JNICALL -Java_com_baidu_paddle_fastdeploy_vision_ClassifyResult_copyLabelIdsFromNative( - JNIEnv *env, jclass clazz, jlong native_result_context) { - auto c_result_ptr = reinterpret_cast( - native_result_context); - if (c_result_ptr->label_ids.empty()) { - return {}; - } - const auto len = static_cast(c_result_ptr->label_ids.size()); - const int *buffer = static_cast(c_result_ptr->label_ids.data()); - return fastdeploy::jni::ConvertTo(env, buffer, len); -} - -JNIEXPORT jboolean JNICALL -Java_com_baidu_paddle_fastdeploy_vision_ClassifyResult_releaseNative( - JNIEnv *env, jclass clazz, jlong native_result_context) { - if (native_result_context == 0) { - return JNI_FALSE; - } - auto c_result_ptr = reinterpret_cast( - native_result_context); - delete c_result_ptr; - LOGD("Release ClassifyResult in native !"); - return JNI_TRUE; -} - -#ifdef __cplusplus -} -#endif diff --git a/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/visualize_jni.cc b/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/visualize_jni.cc deleted file mode 100644 index 8f5407300..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/cpp/vision/visualize_jni.cc +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -#include - -#include "fastdeploy_jni.h" - -#ifdef __cplusplus -extern "C" { -#endif - -JNIEXPORT jboolean JNICALL -Java_com_baidu_paddle_fastdeploy_vision_Visualize_visDetectionNative( - JNIEnv *env, jclass clazz, jobject argb8888_bitmap, jobjectArray boxes, - jfloatArray scores, jintArray label_ids, jfloat score_threshold, - jint line_size, jfloat font_size, jobjectArray labels) { - // Draw DetectionResult to ARGB8888 Bitmap - int len = env->GetArrayLength(boxes); - if ((len == 0) || (len != env->GetArrayLength(scores)) || - (len != env->GetArrayLength(label_ids))) { - return JNI_FALSE; - } - fastdeploy::vision::DetectionResult c_result; - c_result.Resize(len); - bool check_validation = true; - for (int i = 0; i < len; ++i) { - auto j_box = - reinterpret_cast(env->GetObjectArrayElement(boxes, i)); - if (env->GetArrayLength(j_box) == 4) { - jfloat *j_box_ptr = env->GetFloatArrayElements(j_box, nullptr); - std::memcpy(c_result.boxes[i].data(), j_box_ptr, 4 * sizeof(float)); - env->ReleaseFloatArrayElements(j_box, j_box_ptr, 0); - } else { - check_validation = false; - break; - } - } - if (!check_validation) { - return JNI_FALSE; - } - jfloat *j_scores_ptr = env->GetFloatArrayElements(scores, nullptr); - std::memcpy(c_result.scores.data(), j_scores_ptr, len * sizeof(float)); - env->ReleaseFloatArrayElements(scores, j_scores_ptr, 0); - jint *j_label_ids_ptr = env->GetIntArrayElements(label_ids, nullptr); - std::memcpy(c_result.label_ids.data(), j_label_ids_ptr, len * sizeof(int)); - env->ReleaseIntArrayElements(label_ids, j_label_ids_ptr, 0); - - // Get labels from Java - std::vector c_labels; - int label_len = env->GetArrayLength(labels); - if (label_len > 0) { - c_labels.reserve(label_len); - for (int i = 0; i < label_len; ++i) { - auto j_str = - reinterpret_cast(env->GetObjectArrayElement(labels, i)); - c_labels.push_back(fastdeploy::jni::ConvertTo(env, j_str)); - } - } - - cv::Mat c_bgr; - // From ARGB Bitmap to BGR - if (!fastdeploy::jni::ARGB888Bitmap2BGR(env, argb8888_bitmap, &c_bgr)) { - return JNI_FALSE; - } - cv::Mat c_vis_im; - if (!c_labels.empty()) { - c_vis_im = fastdeploy::vision::VisDetection( - c_bgr, c_result, c_labels, score_threshold, line_size, font_size); - } else { - c_vis_im = fastdeploy::vision::VisDetection( - c_bgr, c_result, score_threshold, line_size, font_size); - } - // Rendering to bitmap - if (!fastdeploy::jni::BGR2ARGB888Bitmap(env, argb8888_bitmap, c_vis_im)) { - return JNI_FALSE; - } - return JNI_TRUE; -} - -#ifdef __cplusplus -} -#endif diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/FDModelTag.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/FDModelTag.java deleted file mode 100644 index 19ee71cd3..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/FDModelTag.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baidu.paddle.fastdeploy; - -public enum FDModelTag { - UNKNOWN, - VISION_DETECTION_PICODET, - VISION_DETECTION_PPYOLOE, - VISION_CLASSIFICATION_PPCLS -} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/FastDeployInitializer.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/FastDeployInitializer.java deleted file mode 100644 index e69ac3036..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/FastDeployInitializer.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baidu.paddle.fastdeploy; - -/** - * Initializer for FastDeploy. The initialization methods are called by package - * classes only. Public users don't have to call them. Public users can get - * FastDeploy information constants such as JNI lib name in this class. - */ -public class FastDeployInitializer { - /** name of C++ JNI lib */ - public final static String JNI_LIB_NAME = "fastdeploy_jni"; - - /** - * loads the C++ JNI lib. We only call it in our package, so it shouldn't be - * visible to public users. - * - * @return true if initialize successfully. - */ - public static boolean init() { - System.loadLibrary(JNI_LIB_NAME); - return true; - } -} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/LitePowerMode.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/LitePowerMode.java deleted file mode 100644 index 4e0330da0..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/LitePowerMode.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baidu.paddle.fastdeploy; - -public enum LitePowerMode { - LITE_POWER_HIGH, - LITE_POWER_LOW, - LITE_POWER_FULL, - LITE_POWER_NO_BIND, - LITE_POWER_RAND_HIGH, - LITE_POWER_RAND_LOW -} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/RuntimeOption.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/RuntimeOption.java deleted file mode 100644 index 471673f59..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/RuntimeOption.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.baidu.paddle.fastdeploy; - -public class RuntimeOption { - public int mCpuThreadNum = 1; - public boolean mEnableLiteFp16 = false; - public boolean mEnableRecordTimeOfRuntime = false; - public LitePowerMode mLitePowerMode = LitePowerMode.LITE_POWER_NO_BIND; - public String mLiteOptimizedModelDir = ""; - - public RuntimeOption() { - mCpuThreadNum = 1; - mEnableLiteFp16 = false; - mEnableRecordTimeOfRuntime = false; - mLitePowerMode = LitePowerMode.LITE_POWER_NO_BIND; - mLiteOptimizedModelDir = ""; - } - - public void enableLiteFp16() { - mEnableLiteFp16 = true; - } - - public void disableLiteFP16() { - mEnableLiteFp16 = false; - } - - public void setCpuThreadNum(int threadNum) { - mCpuThreadNum = threadNum; - } - - public void setLitePowerMode(LitePowerMode mode) { - mLitePowerMode = mode; - } - - public void setLitePowerMode(String modeStr) { - mLitePowerMode = parseLitePowerModeFromString(modeStr); - } - - public void setLiteOptimizedModelDir(String modelDir) { - mLiteOptimizedModelDir = modelDir; - } - - public void enableRecordTimeOfRuntime() { - mEnableRecordTimeOfRuntime = true; - } - - // Helpers: parse lite power mode from string - public static LitePowerMode parseLitePowerModeFromString(String modeStr) { - if (modeStr.equalsIgnoreCase("LITE_POWER_HIGH")) { - return LitePowerMode.LITE_POWER_HIGH; - } else if (modeStr.equalsIgnoreCase("LITE_POWER_LOW")) { - return LitePowerMode.LITE_POWER_LOW; - } else if (modeStr.equalsIgnoreCase("LITE_POWER_FULL")) { - return LitePowerMode.LITE_POWER_FULL; - } else if (modeStr.equalsIgnoreCase("LITE_POWER_NO_BIND")) { - return LitePowerMode.LITE_POWER_NO_BIND; - } else if (modeStr.equalsIgnoreCase("LITE_POWER_RAND_HIGH")) { - return LitePowerMode.LITE_POWER_RAND_HIGH; - } else if (modeStr.equalsIgnoreCase("LITE_POWER_RAND_LOW")) { - return LitePowerMode.LITE_POWER_RAND_LOW; - } else { - return LitePowerMode.LITE_POWER_NO_BIND; - } - } -} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/detection/DetectionMainActivity.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/detection/DetectionMainActivity.java new file mode 100644 index 000000000..dbb76df83 --- /dev/null +++ b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/detection/DetectionMainActivity.java @@ -0,0 +1,474 @@ +package com.baidu.paddle.fastdeploy.app.examples.detection; + +import android.Manifest; +import android.annotation.SuppressLint; +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.pm.PackageManager; +import android.graphics.Bitmap; +import android.net.Uri; +import android.os.Bundle; +import android.os.SystemClock; +import android.preference.PreferenceManager; +import android.support.annotation.NonNull; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat; +import android.util.Log; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowManager; +import android.widget.ImageButton; +import android.widget.ImageView; +import android.widget.SeekBar; +import android.widget.TextView; + +import com.baidu.paddle.fastdeploy.RuntimeOption; +import com.baidu.paddle.fastdeploy.app.examples.R; +import com.baidu.paddle.fastdeploy.app.ui.view.CameraSurfaceView; +import com.baidu.paddle.fastdeploy.app.ui.view.ResultListView; +import com.baidu.paddle.fastdeploy.app.ui.Utils; +import com.baidu.paddle.fastdeploy.app.ui.view.adapter.BaseResultAdapter; +import com.baidu.paddle.fastdeploy.app.ui.view.model.BaseResultModel; +import com.baidu.paddle.fastdeploy.vision.DetectionResult; +import com.baidu.paddle.fastdeploy.vision.Visualize; +import com.baidu.paddle.fastdeploy.vision.detection.PicoDet; + +import static com.baidu.paddle.fastdeploy.app.ui.Utils.decodeBitmap; +import static com.baidu.paddle.fastdeploy.app.ui.Utils.getRealPathFromURI; +import static com.baidu.paddle.fastdeploy.app.ui.Utils.readTxt; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +public class DetectionMainActivity extends Activity implements View.OnClickListener, CameraSurfaceView.OnTextureChangedListener { + private static final String TAG = DetectionMainActivity.class.getSimpleName(); + + CameraSurfaceView svPreview; + TextView tvStatus; + ImageButton btnSwitch; + ImageButton btnShutter; + ImageButton btnSettings; + ImageView realtimeToggleButton; + boolean isRealtimeStatusRunning = false; + ImageView backInPreview; + private ImageView albumSelectButton; + private View cameraPageView; + private ViewGroup resultPageView; + private ImageView resultImage; + private ImageView backInResult; + private SeekBar confidenceSeekbar; + private TextView seekbarText; + private float resultNum = 1.0f; + private ResultListView resultView; + private Bitmap picBitmap; + private Bitmap shutterBitmap; + private Bitmap originPicBitmap; + private Bitmap originShutterBitmap; + private boolean isShutterBitmapCopied = false; + + public static final int TYPE_UNKNOWN = -1; + public static final int BTN_SHUTTER = 0; + public static final int ALBUM_SELECT = 1; + public static final int REALTIME_DETECT = 2; + private static int TYPE = REALTIME_DETECT; + + private static final int REQUEST_PERMISSION_CODE_STORAGE = 101; + private static final int INTENT_CODE_PICK_IMAGE = 100; + private static final int TIME_SLEEP_INTERVAL = 50; // ms + + long timeElapsed = 0; + long frameCounter = 0; + + // Call 'init' and 'release' manually later + PicoDet predictor = new PicoDet(); + + private float[] scores; + private int[] labelId; + private boolean initialized; + private List labelText; + private List results = new ArrayList<>(); + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Fullscreen + requestWindowFeature(Window.FEATURE_NO_TITLE); + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); + + setContentView(R.layout.detection_activity_main); + + // Clear all setting items to avoid app crashing due to the incorrect settings + initSettings(); + + // Check and request CAMERA and WRITE_EXTERNAL_STORAGE permissions + if (!checkAllPermissions()) { + requestAllPermissions(); + } + + // Init the camera preview and UI components + initView(); + } + + @SuppressLint("NonConstantResourceId") + @Override + public void onClick(View v) { + switch (v.getId()) { + case R.id.btn_switch: + svPreview.switchCamera(); + break; + case R.id.btn_shutter: + TYPE = BTN_SHUTTER; + shutterAndPauseCamera(); + resultView.setAdapter(null); + break; + case R.id.btn_settings: + startActivity(new Intent(DetectionMainActivity.this, DetectionSettingsActivity.class)); + break; + case R.id.realtime_toggle_btn: + toggleRealtimeStyle(); + break; + case R.id.back_in_preview: + finish(); + break; + case R.id.iv_select: + TYPE = ALBUM_SELECT; + // Judge whether authority has been granted. + if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { + // If this permission was requested before the application but the user refused the request, this method will return true. + ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, REQUEST_PERMISSION_CODE_STORAGE); + } else { + Intent intent = new Intent(Intent.ACTION_PICK); + intent.setType("image/*"); + startActivityForResult(intent, INTENT_CODE_PICK_IMAGE); + } + resultView.setAdapter(null); + break; + case R.id.back_in_result: + back(); + break; + } + } + + @Override + public void onBackPressed() { + super.onBackPressed(); + back(); + } + + private void back() { + resultPageView.setVisibility(View.GONE); + cameraPageView.setVisibility(View.VISIBLE); + TYPE = REALTIME_DETECT; + isShutterBitmapCopied = false; + svPreview.onResume(); + results.clear(); + if (scores != null) { + scores = null; + } + if (labelId != null) { + labelId = null; + } + } + + private void shutterAndPauseCamera() { + new Thread(new Runnable() { + @Override + public void run() { + try { + // Sleep some times to ensure picture has been correctly shut. + Thread.sleep(TIME_SLEEP_INTERVAL * 10); // 500ms + } catch (InterruptedException e) { + e.printStackTrace(); + } + runOnUiThread(new Runnable() { + @SuppressLint("SetTextI18n") + public void run() { + // These code will run in main thread. + svPreview.onPause(); + cameraPageView.setVisibility(View.GONE); + resultPageView.setVisibility(View.VISIBLE); + seekbarText.setText(resultNum + ""); + confidenceSeekbar.setProgress((int) (resultNum * 100)); + if (shutterBitmap != null && !shutterBitmap.isRecycled()) { + resultImage.setImageBitmap(shutterBitmap); + } else { + new AlertDialog.Builder(DetectionMainActivity.this) + .setTitle("Empty Result!") + .setMessage("Current picture is empty, please shutting it again!") + .setCancelable(true) + .show(); + } + } + }); + + } + }).start(); + } + + private void copyBitmapFromCamera(Bitmap ARGB8888ImageBitmap) { + if (isShutterBitmapCopied || ARGB8888ImageBitmap == null) { + return; + } + if (!ARGB8888ImageBitmap.isRecycled()) { + synchronized (this) { + shutterBitmap = ARGB8888ImageBitmap.copy(Bitmap.Config.ARGB_8888, true); + originShutterBitmap = ARGB8888ImageBitmap.copy(Bitmap.Config.ARGB_8888, true); + } + SystemClock.sleep(TIME_SLEEP_INTERVAL); + isShutterBitmapCopied = true; + } + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + if (requestCode == INTENT_CODE_PICK_IMAGE) { + if (resultCode == Activity.RESULT_OK) { + cameraPageView.setVisibility(View.GONE); + resultPageView.setVisibility(View.VISIBLE); + seekbarText.setText(resultNum + ""); + confidenceSeekbar.setProgress((int) (resultNum * 100)); + Uri uri = data.getData(); + String path = getRealPathFromURI(this, uri); + picBitmap = decodeBitmap(path, 720, 1280); + originPicBitmap = picBitmap.copy(Bitmap.Config.ARGB_8888, true); + resultImage.setImageBitmap(picBitmap); + } + } + } + + private void toggleRealtimeStyle() { + if (isRealtimeStatusRunning) { + isRealtimeStatusRunning = false; + realtimeToggleButton.setImageResource(R.drawable.realtime_stop_btn); + svPreview.setOnTextureChangedListener(this); + tvStatus.setVisibility(View.VISIBLE); + } else { + isRealtimeStatusRunning = true; + realtimeToggleButton.setImageResource(R.drawable.realtime_start_btn); + tvStatus.setVisibility(View.GONE); + isShutterBitmapCopied = false; + svPreview.setOnTextureChangedListener(new CameraSurfaceView.OnTextureChangedListener() { + @Override + public boolean onTextureChanged(Bitmap ARGB8888ImageBitmap) { + if (TYPE == BTN_SHUTTER) { + copyBitmapFromCamera(ARGB8888ImageBitmap); + } + return false; + } + }); + } + } + + @Override + public boolean onTextureChanged(Bitmap ARGB8888ImageBitmap) { + if (TYPE == BTN_SHUTTER) { + copyBitmapFromCamera(ARGB8888ImageBitmap); + return false; + } + + boolean modified = false; + + long tc = System.currentTimeMillis(); + DetectionResult result = predictor.predict(ARGB8888ImageBitmap); + timeElapsed += (System.currentTimeMillis() - tc); + + Visualize.visDetection(ARGB8888ImageBitmap, result, DetectionSettingsActivity.scoreThreshold); + modified = result.initialized(); + + frameCounter++; + if (frameCounter >= 30) { + final int fps = (int) (1000 / (timeElapsed / 30)); + runOnUiThread(new Runnable() { + @SuppressLint("SetTextI18n") + public void run() { + tvStatus.setText(Integer.toString(fps) + "fps"); + } + }); + frameCounter = 0; + timeElapsed = 0; + } + return modified; + } + + @Override + protected void onResume() { + super.onResume(); + // Reload settings and re-initialize the predictor + checkAndUpdateSettings(); + // Open camera until the permissions have been granted + if (!checkAllPermissions()) { + svPreview.disableCamera(); + } + svPreview.onResume(); + } + + @Override + protected void onPause() { + super.onPause(); + svPreview.onPause(); + } + + @Override + protected void onDestroy() { + if (predictor != null) { + predictor.release(); + } + super.onDestroy(); + } + + public void initView() { + TYPE = REALTIME_DETECT; + svPreview = (CameraSurfaceView) findViewById(R.id.sv_preview); + svPreview.setOnTextureChangedListener(this); + tvStatus = (TextView) findViewById(R.id.tv_status); + btnSwitch = (ImageButton) findViewById(R.id.btn_switch); + btnSwitch.setOnClickListener(this); + btnShutter = (ImageButton) findViewById(R.id.btn_shutter); + btnShutter.setOnClickListener(this); + btnSettings = (ImageButton) findViewById(R.id.btn_settings); + btnSettings.setOnClickListener(this); + realtimeToggleButton = findViewById(R.id.realtime_toggle_btn); + realtimeToggleButton.setOnClickListener(this); + backInPreview = findViewById(R.id.back_in_preview); + backInPreview.setOnClickListener(this); + albumSelectButton = findViewById(R.id.iv_select); + albumSelectButton.setOnClickListener(this); + cameraPageView = findViewById(R.id.camera_page); + resultPageView = findViewById(R.id.result_page); + resultImage = findViewById(R.id.result_image); + backInResult = findViewById(R.id.back_in_result); + backInResult.setOnClickListener(this); + confidenceSeekbar = findViewById(R.id.confidence_seekbar); + seekbarText = findViewById(R.id.seekbar_text); + resultView = findViewById(R.id.result_list_view); + + confidenceSeekbar.setMax(100); + confidenceSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { + @Override + public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { + float resultConfidence = seekBar.getProgress() / 100f; + BigDecimal bd = new BigDecimal(resultConfidence); + resultNum = bd.setScale(1, BigDecimal.ROUND_HALF_UP).floatValue(); + seekbarText.setText(resultNum + ""); + confidenceSeekbar.setProgress((int) (resultNum * 100)); + results.clear(); + } + + @Override + public void onStartTrackingTouch(SeekBar seekBar) { + + } + + @Override + public void onStopTrackingTouch(SeekBar seekBar) { + runOnUiThread(new Runnable() { + @Override + public void run() { + if (TYPE == ALBUM_SELECT) { + SystemClock.sleep(TIME_SLEEP_INTERVAL * 10); + detail(picBitmap); + picBitmap = originPicBitmap.copy(Bitmap.Config.ARGB_8888, true); + } else { + SystemClock.sleep(TIME_SLEEP_INTERVAL * 10); + // svPreview.onPause(); + detail(shutterBitmap); + shutterBitmap = originShutterBitmap.copy(Bitmap.Config.ARGB_8888, true); + } + } + }); + } + }); + } + + private void detail(Bitmap bitmap) { + + DetectionResult result = predictor.predict(bitmap, true, resultNum); + + scores = result.mScores; + labelId = result.mLabelIds; + + initialized = result.initialized(); + if (initialized) { + for (int i = 0; i < labelId.length; i++) { + if (scores[i] > resultNum) { + int idx = labelId[i]; + String text = labelText.get(idx); + results.add(new BaseResultModel(idx, text, scores[i])); + } + } + } + BaseResultAdapter adapter = new BaseResultAdapter(getBaseContext(), R.layout.detection_result_page_item, results); + resultView.setAdapter(adapter); + resultView.invalidate(); + + resultImage.setImageBitmap(bitmap); + resultNum = 1.0f; + } + + @SuppressLint("ApplySharedPref") + public void initSettings() { + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); + SharedPreferences.Editor editor = sharedPreferences.edit(); + editor.clear(); + editor.commit(); + DetectionSettingsActivity.resetSettings(); + } + + public void checkAndUpdateSettings() { + if (DetectionSettingsActivity.checkAndUpdateSettings(this)) { + String realModelDir = getCacheDir() + "/" + DetectionSettingsActivity.modelDir; + Utils.copyDirectoryFromAssets(this, DetectionSettingsActivity.modelDir, realModelDir); + String realLabelPath = getCacheDir() + "/" + DetectionSettingsActivity.labelPath; + Utils.copyFileFromAssets(this, DetectionSettingsActivity.labelPath, realLabelPath); + + String modelFile = realModelDir + "/" + "model.pdmodel"; + String paramsFile = realModelDir + "/" + "model.pdiparams"; + String configFile = realModelDir + "/" + "infer_cfg.yml"; + String labelFile = realLabelPath; + labelText = readTxt(labelFile); + RuntimeOption option = new RuntimeOption(); + option.setCpuThreadNum(DetectionSettingsActivity.cpuThreadNum); + option.setLitePowerMode(DetectionSettingsActivity.cpuPowerMode); + if (Boolean.parseBoolean(DetectionSettingsActivity.enableLiteFp16)) { + option.enableLiteFp16(); + } + predictor.init(modelFile, paramsFile, configFile, labelFile, option); + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, + @NonNull int[] grantResults) { + super.onRequestPermissionsResult(requestCode, permissions, grantResults); + if (grantResults[0] != PackageManager.PERMISSION_GRANTED || grantResults[1] != PackageManager.PERMISSION_GRANTED) { + new AlertDialog.Builder(DetectionMainActivity.this) + .setTitle("Permission denied") + .setMessage("Click to force quit the app, then open Settings->Apps & notifications->Target " + + "App->Permissions to grant all of the permissions.") + .setCancelable(false) + .setPositiveButton("Exit", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + DetectionMainActivity.this.finish(); + } + }).show(); + } + } + + private void requestAllPermissions() { + ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, + Manifest.permission.CAMERA}, 0); + } + + private boolean checkAllPermissions() { + return ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED + && ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED; + } +} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/examples/SettingsActivity.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/detection/DetectionSettingsActivity.java similarity index 90% rename from examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/examples/SettingsActivity.java rename to examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/detection/DetectionSettingsActivity.java index 738f7fc01..21984fdcc 100644 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/examples/SettingsActivity.java +++ b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/examples/detection/DetectionSettingsActivity.java @@ -1,4 +1,4 @@ -package com.baidu.paddle.fastdeploy.examples; +package com.baidu.paddle.fastdeploy.app.examples.detection; import android.annotation.SuppressLint; import android.content.Context; @@ -8,18 +8,17 @@ import android.preference.EditTextPreference; import android.preference.ListPreference; import android.preference.PreferenceManager; import android.support.v7.app.ActionBar; -import android.util.Log; -import com.baidu.paddle.fastdeploy.common.AppCompatPreferenceActivity; -import com.baidu.paddle.fastdeploy.common.Utils; -import com.baidu.paddle.fastdeploy.examples.R; +import com.baidu.paddle.fastdeploy.app.examples.R; +import com.baidu.paddle.fastdeploy.app.ui.view.AppCompatPreferenceActivity; +import com.baidu.paddle.fastdeploy.app.ui.Utils; import java.util.ArrayList; import java.util.List; -public class SettingsActivity extends AppCompatPreferenceActivity implements +public class DetectionSettingsActivity extends AppCompatPreferenceActivity implements SharedPreferences.OnSharedPreferenceChangeListener { - private static final String TAG = SettingsActivity.class.getSimpleName(); + private static final String TAG = DetectionSettingsActivity.class.getSimpleName(); static public int selectedModelIdx = -1; static public String modelDir = ""; @@ -47,7 +46,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - addPreferencesFromResource(R.xml.settings); + addPreferencesFromResource(R.xml.detection_settings); ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setDisplayHomeAsUpEnabled(true); @@ -60,8 +59,8 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements preInstalledCPUPowerModes = new ArrayList(); preInstalledScoreThresholds = new ArrayList(); preInstalledEnableLiteFp16s = new ArrayList(); - preInstalledModelDirs.add(getString(R.string.MODEL_DIR_DEFAULT)); - preInstalledLabelPaths.add(getString(R.string.LABEL_PATH_DEFAULT)); + preInstalledModelDirs.add(getString(R.string.DETECTION_MODEL_DIR_DEFAULT)); + preInstalledLabelPaths.add(getString(R.string.DETECTION_LABEL_PATH_DEFAULT)); preInstalledCPUThreadNums.add(getString(R.string.CPU_THREAD_NUM_DEFAULT)); preInstalledCPUPowerModes.add(getString(R.string.CPU_POWER_MODE_DEFAULT)); preInstalledScoreThresholds.add(getString(R.string.SCORE_THRESHOLD_DEFAULT)); @@ -91,7 +90,7 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences(); String selected_model_dir = sharedPreferences.getString(getString(R.string.CHOOSE_PRE_INSTALLED_MODEL_KEY), - getString(R.string.MODEL_DIR_DEFAULT)); + getString(R.string.DETECTION_MODEL_DIR_DEFAULT)); int selected_model_idx = lpChoosePreInstalledModel.findIndexOfValue(selected_model_dir); if (selected_model_idx >= 0 && selected_model_idx < preInstalledModelDirs.size() && selected_model_idx != selectedModelIdx) { SharedPreferences.Editor editor = sharedPreferences.edit(); @@ -107,9 +106,9 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements } String model_dir = sharedPreferences.getString(getString(R.string.MODEL_DIR_KEY), - getString(R.string.MODEL_DIR_DEFAULT)); + getString(R.string.DETECTION_MODEL_DIR_DEFAULT)); String label_path = sharedPreferences.getString(getString(R.string.LABEL_PATH_KEY), - getString(R.string.LABEL_PATH_DEFAULT)); + getString(R.string.DETECTION_LABEL_PATH_DEFAULT)); String cpu_thread_num = sharedPreferences.getString(getString(R.string.CPU_THREAD_NUM_KEY), getString(R.string.CPU_THREAD_NUM_DEFAULT)); String cpu_power_mode = sharedPreferences.getString(getString(R.string.CPU_POWER_MODE_KEY), @@ -137,12 +136,12 @@ public class SettingsActivity extends AppCompatPreferenceActivity implements SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(ctx); String model_dir = sharedPreferences.getString(ctx.getString(R.string.MODEL_DIR_KEY), - ctx.getString(R.string.MODEL_DIR_DEFAULT)); + ctx.getString(R.string.DETECTION_MODEL_DIR_DEFAULT)); settingsChanged |= !modelDir.equalsIgnoreCase(model_dir); modelDir = model_dir; String label_path = sharedPreferences.getString(ctx.getString(R.string.LABEL_PATH_KEY), - ctx.getString(R.string.LABEL_PATH_DEFAULT)); + ctx.getString(R.string.DETECTION_LABEL_PATH_DEFAULT)); settingsChanged |= !labelPath.equalsIgnoreCase(label_path); labelPath = label_path; diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/Utils.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/Utils.java similarity index 71% rename from examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/Utils.java rename to examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/Utils.java index 3428bc1f1..eabeb74f4 100644 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/Utils.java +++ b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/Utils.java @@ -1,15 +1,31 @@ -package com.baidu.paddle.fastdeploy.common; +package com.baidu.paddle.fastdeploy.app.ui; import android.content.Context; import android.content.res.Resources; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; import android.hardware.Camera; +import android.net.Uri; import android.opengl.GLES20; import android.os.Environment; +import android.provider.MediaStore; import android.util.Log; import android.view.Surface; import android.view.WindowManager; -import java.io.*; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.util.ArrayList; import java.util.List; public class Utils { @@ -110,7 +126,7 @@ public class Utils { } public static Camera.Size getOptimalPreviewSize(List sizes, int w, int h) { - final double ASPECT_TOLERANCE = 0.1; + final double ASPECT_TOLERANCE = 0.3; double targetRatio = (double) w / h; if (sizes == null) return null; @@ -151,8 +167,8 @@ public class Utils { } public static int getCameraDisplayOrientation(Context context, int cameraId) { - android.hardware.Camera.CameraInfo info = new android.hardware.Camera.CameraInfo(); - android.hardware.Camera.getCameraInfo(cameraId, info); + Camera.CameraInfo info = new Camera.CameraInfo(); + Camera.getCameraInfo(cameraId, info); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); int rotation = wm.getDefaultDisplay().getRotation(); int degrees = 0; @@ -234,4 +250,64 @@ public class Utils { String hardware = android.os.Build.HARDWARE; return hardware.equalsIgnoreCase("kirin810") || hardware.equalsIgnoreCase("kirin990"); } + + public static Bitmap decodeBitmap(String path, int displayWidth, int displayHeight) { + BitmapFactory.Options op = new BitmapFactory.Options(); + op.inJustDecodeBounds = true;// Only the width and height information of Bitmap is read, not the pixels. + Bitmap bmp = BitmapFactory.decodeFile(path, op); // Get size information. + int wRatio = (int) Math.ceil(op.outWidth / (float) displayWidth);// Get Scale Size. + int hRatio = (int) Math.ceil(op.outHeight / (float) displayHeight); + // If the specified size is exceeded, reduce the corresponding scale. + if (wRatio > 1 && hRatio > 1) { + if (wRatio > hRatio) { + // If it is too wide, we will reduce the width to the required size. Note that the height will become smaller. + op.inSampleSize = wRatio; + } else { + op.inSampleSize = hRatio; + } + } + op.inJustDecodeBounds = false; + bmp = BitmapFactory.decodeFile(path, op); + // Create a Bitmap with a given width and height from the original Bitmap. + return Bitmap.createScaledBitmap(bmp, displayWidth, displayHeight, true); + } + + public static String getRealPathFromURI(Context context, Uri contentURI) { + String result; + Cursor cursor = null; + try { + cursor = context.getContentResolver().query(contentURI, null, null, null, null); + } catch (Throwable e) { + e.printStackTrace(); + } + if (cursor == null) { + result = contentURI.getPath(); + } else { + cursor.moveToFirst(); + int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA); + result = cursor.getString(idx); + cursor.close(); + } + return result; + } + + public static List readTxt(String txtPath) { + File file = new File(txtPath); + if (file.isFile() && file.exists()) { + try { + FileInputStream fileInputStream = new FileInputStream(file); + InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream); + BufferedReader bufferedReader = new BufferedReader(inputStreamReader); + String text; + List labels = new ArrayList<>(); + while ((text = bufferedReader.readLine()) != null) { + labels.add(text); + } + return labels; + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } } diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/ActionBarLayout.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/layout/ActionBarLayout.java similarity index 94% rename from examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/ActionBarLayout.java rename to examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/layout/ActionBarLayout.java index 3b5d2df91..099219fa9 100644 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/ActionBarLayout.java +++ b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/layout/ActionBarLayout.java @@ -1,4 +1,4 @@ -package com.baidu.paddle.fastdeploy.common; +package com.baidu.paddle.fastdeploy.app.ui.layout; import android.content.Context; import android.graphics.Color; diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/AppCompatPreferenceActivity.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/AppCompatPreferenceActivity.java similarity index 98% rename from examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/AppCompatPreferenceActivity.java rename to examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/AppCompatPreferenceActivity.java index 265f75f01..c1a952dcf 100644 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/AppCompatPreferenceActivity.java +++ b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/AppCompatPreferenceActivity.java @@ -1,4 +1,4 @@ -package com.baidu.paddle.fastdeploy.common; +package com.baidu.paddle.fastdeploy.app.ui.view; import android.content.res.Configuration; import android.os.Bundle; diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/CameraSurfaceView.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java similarity index 92% rename from examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/CameraSurfaceView.java rename to examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java index dec602b7f..11d9fcdcb 100644 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/common/CameraSurfaceView.java +++ b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/CameraSurfaceView.java @@ -1,4 +1,4 @@ -package com.baidu.paddle.fastdeploy.common; +package com.baidu.paddle.fastdeploy.app.ui.view; import android.content.Context; import android.graphics.Bitmap; @@ -15,8 +15,7 @@ import android.opengl.Matrix; import android.util.AttributeSet; import android.util.Log; -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; +import com.baidu.paddle.fastdeploy.app.ui.Utils; import java.io.IOException; import java.nio.ByteBuffer; @@ -24,13 +23,15 @@ import java.nio.ByteOrder; import java.nio.FloatBuffer; import java.util.List; +import javax.microedition.khronos.egl.EGLConfig; +import javax.microedition.khronos.opengles.GL10; + public class CameraSurfaceView extends GLSurfaceView implements Renderer, SurfaceTexture.OnFrameAvailableListener { private static final String TAG = CameraSurfaceView.class.getSimpleName(); - public static final int EXPECTED_PREVIEW_WIDTH = 1280; - public static final int EXPECTED_PREVIEW_HEIGHT = 720; - + public static int EXPECTED_PREVIEW_WIDTH = 1280; // 1920 + public static int EXPECTED_PREVIEW_HEIGHT = 720; // 960 protected int numberOfCameras; protected int selectedCameraId; @@ -44,6 +45,9 @@ public class CameraSurfaceView extends GLSurfaceView implements Renderer, protected int textureWidth = 0; protected int textureHeight = 0; + protected Bitmap ARGB8888ImageBitmap; + protected boolean bitmapReleaseMode = true; + // In order to manipulate the camera preview data and render the modified one // to the screen, three textures are created and the data flow is shown as following: // previewdata->camTextureId->fboTexureId->drawTexureId->framebuffer @@ -95,6 +99,16 @@ public class CameraSurfaceView extends GLSurfaceView implements Renderer, private int vcTex2Screen; private int tcTex2Screen; + public void setBitmapReleaseMode(boolean mode) { + synchronized (this) { + bitmapReleaseMode = mode; + } + } + + public Bitmap getBitmap() { + return ARGB8888ImageBitmap; // may null or recycled. + } + public interface OnTextureChangedListener { boolean onTextureChanged(Bitmap ARGB8888ImageBitmap); } @@ -196,9 +210,12 @@ public class CameraSurfaceView extends GLSurfaceView implements Renderer, // Read pixels of FBO to a bitmap ByteBuffer pixelBuffer = ByteBuffer.allocate(textureWidth * textureHeight * 4); GLES20.glReadPixels(0, 0, textureWidth, textureHeight, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, pixelBuffer); - Bitmap ARGB8888ImageBitmap = Bitmap.createBitmap(textureWidth, textureHeight, Bitmap.Config.ARGB_8888); + + ARGB8888ImageBitmap = Bitmap.createBitmap(textureWidth, textureHeight, Bitmap.Config.ARGB_8888); ARGB8888ImageBitmap.copyPixelsFromBuffer(pixelBuffer); + boolean modified = onTextureChangedListener.onTextureChanged(ARGB8888ImageBitmap); + if (modified) { targetTexureId = drawTexureId[0]; // Update a bitmap to the GL texture if modified @@ -207,7 +224,9 @@ public class CameraSurfaceView extends GLSurfaceView implements Renderer, GLES20.glBindTexture(GLES11Ext.GL_TEXTURE_EXTERNAL_OES, targetTexureId); GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, ARGB8888ImageBitmap, 0); } - ARGB8888ImageBitmap.recycle(); + if (bitmapReleaseMode) { + ARGB8888ImageBitmap.recycle(); + } } // fboTexureId/drawTexureId->Screen @@ -268,20 +287,28 @@ public class CameraSurfaceView extends GLSurfaceView implements Renderer, public void openCamera() { if (disableCamera) return; camera = Camera.open(selectedCameraId); - List supportedPreviewSizes = camera.getParameters().getSupportedPreviewSizes(); - Size previewSize = Utils.getOptimalPreviewSize(supportedPreviewSizes, EXPECTED_PREVIEW_WIDTH, - EXPECTED_PREVIEW_HEIGHT); Camera.Parameters parameters = camera.getParameters(); - parameters.setPreviewSize(previewSize.width, previewSize.height); - if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { - parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); - } - camera.setParameters(parameters); int degree = Utils.getCameraDisplayOrientation(context, selectedCameraId); camera.setDisplayOrientation(degree); boolean rotate = degree == 90 || degree == 270; - textureWidth = rotate ? previewSize.height : previewSize.width; - textureHeight = rotate ? previewSize.width : previewSize.height; + int adjusted_width = rotate ? EXPECTED_PREVIEW_HEIGHT : EXPECTED_PREVIEW_WIDTH; + int adjusted_height = rotate ? EXPECTED_PREVIEW_WIDTH : EXPECTED_PREVIEW_HEIGHT; + + List supportedPreviewSizes = camera.getParameters().getSupportedPreviewSizes(); + + Size previewSize = Utils.getOptimalPreviewSize( + supportedPreviewSizes, adjusted_width, adjusted_height); + + textureWidth = previewSize.width; + textureHeight = previewSize.height; + + parameters.setPreviewSize(previewSize.width, previewSize.height); + camera.setParameters(parameters); + + if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { + parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); + } + // Destroy FBO and draw textures GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); GLES20.glDeleteFramebuffers(1, fbo, 0); diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/ResultListView.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/ResultListView.java new file mode 100644 index 000000000..62b48a054 --- /dev/null +++ b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/ResultListView.java @@ -0,0 +1,43 @@ +package com.baidu.paddle.fastdeploy.app.ui.view; + +import android.content.Context; +import android.os.Handler; +import android.util.AttributeSet; +import android.widget.ListView; + +public class ResultListView extends ListView { + public ResultListView(Context context) { + super(context); + } + + public ResultListView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public ResultListView(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + private Handler handler; + + public void setHandler(Handler mHandler) { + handler = mHandler; + } + + public void clear() { + handler.post(new Runnable() { + @Override + public void run() { + removeAllViewsInLayout(); + invalidate(); + } + }); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, + MeasureSpec.AT_MOST); + super.onMeasure(widthMeasureSpec, expandSpec); + } +} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/adapter/BaseResultAdapter.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/adapter/BaseResultAdapter.java new file mode 100644 index 000000000..62747965a --- /dev/null +++ b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/adapter/BaseResultAdapter.java @@ -0,0 +1,48 @@ +package com.baidu.paddle.fastdeploy.app.ui.view.adapter; + +import android.content.Context; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.TextView; + +import com.baidu.paddle.fastdeploy.app.examples.R; +import com.baidu.paddle.fastdeploy.app.ui.view.model.BaseResultModel; + +import java.text.DecimalFormat; +import java.util.List; + +public class BaseResultAdapter extends ArrayAdapter { + private int resourceId; + + public BaseResultAdapter(@NonNull Context context, int resource) { + super(context, resource); + } + + public BaseResultAdapter(@NonNull Context context, int resource, @NonNull List objects) { + super(context, resource, objects); + resourceId = resource; + } + + @NonNull + @Override + public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { + BaseResultModel model = getItem(position); + View view = LayoutInflater.from(getContext()).inflate(resourceId, null); + TextView indexText = (TextView) view.findViewById(R.id.index); + TextView nameText = (TextView) view.findViewById(R.id.name); + TextView confidenceText = (TextView) view.findViewById(R.id.confidence); + indexText.setText(String.valueOf(model.getIndex())); + nameText.setText(String.valueOf(model.getName())); + confidenceText.setText(formatFloatString(model.getConfidence())); + return view; + } + + public static String formatFloatString(float number) { + DecimalFormat df = new DecimalFormat("0.00"); + return df.format(number); + } +} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/model/BaseResultModel.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/model/BaseResultModel.java new file mode 100644 index 000000000..cae71b690 --- /dev/null +++ b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/app/ui/view/model/BaseResultModel.java @@ -0,0 +1,41 @@ +package com.baidu.paddle.fastdeploy.app.ui.view.model; + +public class BaseResultModel { + private int index; + private String name; + private float confidence; + + public BaseResultModel() { + + } + + public BaseResultModel(int index, String name, float confidence) { + this.index = index; + this.name = name; + this.confidence = confidence; + } + + public float getConfidence() { + return confidence; + } + + public void setConfidence(float confidence) { + this.confidence = confidence; + } + + public int getIndex() { + return index; + } + + public void setIndex(int index) { + this.index = index; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/examples/MainActivity.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/examples/MainActivity.java deleted file mode 100644 index 5c1d9d98d..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/examples/MainActivity.java +++ /dev/null @@ -1,251 +0,0 @@ -package com.baidu.paddle.fastdeploy.examples; - - -import android.Manifest; -import android.annotation.SuppressLint; -import android.app.Activity; -import android.app.AlertDialog; -import android.content.DialogInterface; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.pm.PackageManager; -import android.graphics.*; -import android.os.Bundle; -import android.preference.PreferenceManager; -import android.support.annotation.NonNull; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; -import android.util.Log; -import android.view.*; -import android.widget.*; - -import com.baidu.paddle.fastdeploy.RuntimeOption; -import com.baidu.paddle.fastdeploy.common.CameraSurfaceView; -import com.baidu.paddle.fastdeploy.common.Utils; -import com.baidu.paddle.fastdeploy.examples.R; -import com.baidu.paddle.fastdeploy.vision.DetectionResult; -import com.baidu.paddle.fastdeploy.vision.detection.PicoDet; - -import java.io.File; -import java.text.SimpleDateFormat; -import java.util.Date; - -public class MainActivity extends Activity implements View.OnClickListener, CameraSurfaceView.OnTextureChangedListener { - private static final String TAG = MainActivity.class.getSimpleName(); - - CameraSurfaceView svPreview; - TextView tvStatus; - ImageButton btnSwitch; - ImageButton btnShutter; - ImageButton btnSettings; - ImageView realtimeToggleButton; - boolean isRealtimeStatusRunning = false; - ImageView backInPreview; - - String savedImagePath = "result.jpg"; - int lastFrameIndex = 0; - long lastFrameTime; - - // Call 'init' and 'release' manually later - PicoDet predictor = new PicoDet(); - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // Fullscreen - requestWindowFeature(Window.FEATURE_NO_TITLE); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); - - setContentView(R.layout.activity_main); - - // Clear all setting items to avoid app crashing due to the incorrect settings - initSettings(); - - // Init the camera preview and UI components - initView(); - - // Check and request CAMERA and WRITE_EXTERNAL_STORAGE permissions - if (!checkAllPermissions()) { - requestAllPermissions(); - } - } - - @SuppressLint("NonConstantResourceId") - @Override - public void onClick(View v) { - switch (v.getId()) { - case R.id.btn_switch: - svPreview.switchCamera(); - break; - case R.id.btn_shutter: - @SuppressLint("SimpleDateFormat") - SimpleDateFormat date = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss"); - synchronized (this) { - savedImagePath = Utils.getDCIMDirectory() + File.separator + date.format(new Date()).toString() + ".png"; - } - Toast.makeText(MainActivity.this, "Save snapshot to " + savedImagePath, Toast.LENGTH_SHORT).show(); - break; - case R.id.btn_settings: - startActivity(new Intent(MainActivity.this, SettingsActivity.class)); - break; - case R.id.realtime_toggle_btn: - toggleRealtimeStyle(); - break; - case R.id.back_in_preview: - finish(); - break; - } - } - - private void toggleRealtimeStyle() { - if (isRealtimeStatusRunning) { - isRealtimeStatusRunning = false; - realtimeToggleButton.setImageResource(R.drawable.realtime_stop_btn); - svPreview.setOnTextureChangedListener(this); - tvStatus.setVisibility(View.VISIBLE); - } else { - isRealtimeStatusRunning = true; - realtimeToggleButton.setImageResource(R.drawable.realtime_start_btn); - tvStatus.setVisibility(View.GONE); - svPreview.setOnTextureChangedListener(new CameraSurfaceView.OnTextureChangedListener() { - @Override - public boolean onTextureChanged(Bitmap ARGB8888ImageBitmap) { - return false; - } - }); - } - } - - @Override - public boolean onTextureChanged(Bitmap ARGB8888ImageBitmap) { - String savedImagePath = ""; - synchronized (this) { - savedImagePath = MainActivity.this.savedImagePath; - } - boolean modified = false; - DetectionResult result = predictor.predict( - ARGB8888ImageBitmap, savedImagePath, SettingsActivity.scoreThreshold); - modified = result.initialized(); - if (!savedImagePath.isEmpty()) { - synchronized (this) { - MainActivity.this.savedImagePath = "result.jpg"; - } - } - lastFrameIndex++; - if (lastFrameIndex >= 30) { - final int fps = (int) (lastFrameIndex * 1e9 / (System.nanoTime() - lastFrameTime)); - runOnUiThread(new Runnable() { - @SuppressLint("SetTextI18n") - public void run() { - tvStatus.setText(Integer.toString(fps) + "fps"); - } - }); - lastFrameIndex = 0; - lastFrameTime = System.nanoTime(); - } - return modified; - } - - @Override - protected void onResume() { - super.onResume(); - // Reload settings and re-initialize the predictor - checkAndUpdateSettings(); - // Open camera until the permissions have been granted - if (!checkAllPermissions()) { - svPreview.disableCamera(); - } - svPreview.onResume(); - } - - @Override - protected void onPause() { - super.onPause(); - svPreview.onPause(); - } - - @Override - protected void onDestroy() { - if (predictor != null) { - predictor.release(); - } - super.onDestroy(); - } - - public void initView() { - svPreview = (CameraSurfaceView) findViewById(R.id.sv_preview); - svPreview.setOnTextureChangedListener(this); - tvStatus = (TextView) findViewById(R.id.tv_status); - btnSwitch = (ImageButton) findViewById(R.id.btn_switch); - btnSwitch.setOnClickListener(this); - btnShutter = (ImageButton) findViewById(R.id.btn_shutter); - btnShutter.setOnClickListener(this); - btnSettings = (ImageButton) findViewById(R.id.btn_settings); - btnSettings.setOnClickListener(this); - realtimeToggleButton = findViewById(R.id.realtime_toggle_btn); - realtimeToggleButton.setOnClickListener(this); - backInPreview = findViewById(R.id.back_in_preview); - backInPreview.setOnClickListener(this); - } - - @SuppressLint("ApplySharedPref") - public void initSettings() { - SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); - SharedPreferences.Editor editor = sharedPreferences.edit(); - editor.clear(); - editor.commit(); - SettingsActivity.resetSettings(); - } - - public void checkAndUpdateSettings() { - if (SettingsActivity.checkAndUpdateSettings(this)) { - String realModelDir = getCacheDir() + "/" + SettingsActivity.modelDir; - Utils.copyDirectoryFromAssets(this, SettingsActivity.modelDir, realModelDir); - String realLabelPath = getCacheDir() + "/" + SettingsActivity.labelPath; - Utils.copyFileFromAssets(this, SettingsActivity.labelPath, realLabelPath); - - String modelFile = realModelDir + "/" + "model.pdmodel"; - String paramsFile = realModelDir + "/" + "model.pdiparams"; - String configFile = realModelDir + "/" + "infer_cfg.yml"; - String labelFile = realLabelPath; - RuntimeOption option = new RuntimeOption(); - option.setCpuThreadNum(SettingsActivity.cpuThreadNum); - option.setLitePowerMode(SettingsActivity.cpuPowerMode); - option.enableRecordTimeOfRuntime(); - if (Boolean.parseBoolean(SettingsActivity.enableLiteFp16)) { - option.enableLiteFp16(); - } - predictor.init(modelFile, paramsFile, configFile, labelFile, option); - } - } - - @Override - public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, - @NonNull int[] grantResults) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - if (grantResults[0] != PackageManager.PERMISSION_GRANTED || grantResults[1] != PackageManager.PERMISSION_GRANTED) { - new AlertDialog.Builder(MainActivity.this) - .setTitle("Permission denied") - .setMessage("Click to force quit the app, then open Settings->Apps & notifications->Target " + - "App->Permissions to grant all of the permissions.") - .setCancelable(false) - .setPositiveButton("Exit", new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - MainActivity.this.finish(); - } - }).show(); - } - } - - private void requestAllPermissions() { - ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, - Manifest.permission.CAMERA}, 0); - } - - private boolean checkAllPermissions() { - return ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED - && ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED; - } -} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/ClassifyResult.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/ClassifyResult.java deleted file mode 100644 index 7e6e55bd0..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/ClassifyResult.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.baidu.paddle.fastdeploy.vision; - -import android.support.annotation.NonNull; - -public class ClassifyResult { - public float[] mScores; // [n] - public int[] mLabelIds; // [n] - public boolean mInitialized = false; - - public ClassifyResult() { - mInitialized = false; - } - - public ClassifyResult(long nativeResultContext) { - mInitialized = copyAllFromNativeContext(nativeResultContext); - } - - public boolean initialized() { - return mInitialized; - } - - private void setScores(@NonNull float[] scoresBuffer) { - if (scoresBuffer.length > 0) { - mScores = scoresBuffer.clone(); - } - } - - private void setLabelIds(@NonNull int[] labelIdsBuffer) { - if (labelIdsBuffer.length > 0) { - mLabelIds = labelIdsBuffer.clone(); - } - } - - private boolean copyAllFromNativeContext(long nativeResultContext) { - if (nativeResultContext == 0) { - return false; - } - setScores(copyScoresFromNative(nativeResultContext)); - setLabelIds(copyLabelIdsFromNative(nativeResultContext)); - // WARN: must release ctx. - return releaseNative(nativeResultContext); - } - - // Fetch native buffers from native context. - private static native float[] copyScoresFromNative(long nativeResultContext); - - private static native int[] copyLabelIdsFromNative(long nativeResultContext); - - private static native boolean releaseNative(long nativeResultContext); - -} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/DetectionResult.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/DetectionResult.java deleted file mode 100644 index f658241ce..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/DetectionResult.java +++ /dev/null @@ -1,80 +0,0 @@ -package com.baidu.paddle.fastdeploy.vision; - -import android.support.annotation.NonNull; - -import java.util.Arrays; - -import com.baidu.paddle.fastdeploy.FastDeployInitializer; - -public class DetectionResult { - // Not support MaskRCNN now. - public float[][] mBoxes; // [n,4] - public float[] mScores; // [n] - public int[] mLabelIds; // [n] - public boolean mInitialized = false; - - public DetectionResult() { - mInitialized = false; - } - - public DetectionResult(long nativeResultContext) { - mInitialized = copyAllFromNativeContext(nativeResultContext); - } - - public boolean initialized() { - return mInitialized; - } - - // Setup results from native buffers. - private boolean copyAllFromNativeContext(long nativeResultContext) { - if (nativeResultContext == 0) { - return false; - } - if (copyBoxesNumFromNative(nativeResultContext) > 0) { - setBoxes(copyBoxesFromNative(nativeResultContext)); - setScores(copyScoresFromNative(nativeResultContext)); - setLabelIds(copyLabelIdsFromNative(nativeResultContext)); - } - // WARN: must release ctx. - return releaseNative(nativeResultContext); - } - - private void setBoxes(@NonNull float[] boxesBuffer) { - int boxesNum = boxesBuffer.length / 4; - if (boxesNum > 0) { - mBoxes = new float[boxesNum][4]; - for (int i = 0; i < boxesNum; ++i) { - mBoxes[i] = Arrays.copyOfRange( - boxesBuffer, i * 4, (i + 1) * 4); - } - } - } - - private void setScores(@NonNull float[] scoresBuffer) { - if (scoresBuffer.length > 0) { - mScores = scoresBuffer.clone(); - } - } - - private void setLabelIds(@NonNull int[] labelIdsBuffer) { - if (labelIdsBuffer.length > 0) { - mLabelIds = labelIdsBuffer.clone(); - } - } - - // Fetch native buffers from native context. - private static native int copyBoxesNumFromNative(long nativeResultContext); - - private static native float[] copyBoxesFromNative(long nativeResultContext); - - private static native float[] copyScoresFromNative(long nativeResultContext); - - private static native int[] copyLabelIdsFromNative(long nativeResultContext); - - private static native boolean releaseNative(long nativeResultContext); - - // Initializes at the beginning. - static { - FastDeployInitializer.init(); - } -} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/Visualize.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/Visualize.java deleted file mode 100644 index 0c9a13a3b..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/Visualize.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.baidu.paddle.fastdeploy.vision; - -import android.graphics.Bitmap; - -import com.baidu.paddle.fastdeploy.FastDeployInitializer; - - -public class Visualize { - // TODO(qiuyanjun): - // VisClassification, VisSegmentation, VisMatting, VisOcr, ... - - // Visualize DetectionResult without labels - public static boolean visDetection(Bitmap ARGB8888Bitmap, - DetectionResult result) { - return visDetectionNative( - ARGB8888Bitmap, - result.mBoxes, - result.mScores, - result.mLabelIds, - 0.f, 1, 0.5f, - new String[]{}); - } - - public static boolean visDetection(Bitmap ARGB8888Bitmap, - DetectionResult result, - float score_threshold, - int line_size, - float font_size) { - return visDetectionNative( - ARGB8888Bitmap, - result.mBoxes, - result.mScores, - result.mLabelIds, - score_threshold, - line_size, - font_size, - new String[]{}); - } - - // Visualize DetectionResult with labels - public static boolean visDetection(Bitmap ARGB8888Bitmap, - DetectionResult result, - String[] labels) { - return visDetectionNative( - ARGB8888Bitmap, - result.mBoxes, - result.mScores, - result.mLabelIds, - 0.f, 1, 0.5f, - labels); - } - - public static boolean visDetection(Bitmap ARGB8888Bitmap, - DetectionResult result, - float score_threshold, - int line_size, - float font_size, - String[] labels) { - return visDetectionNative( - ARGB8888Bitmap, - result.mBoxes, - result.mScores, - result.mLabelIds, - score_threshold, - line_size, - font_size, - labels); - } - - // VisDetection in native - public static native boolean visDetectionNative(Bitmap ARGB8888Bitmap, - float[][] boxes, - float[] scores, - int[] labelIds, - float score_threshold, - int line_size, - float font_size, - String[] labels); - - - /* Initializes at the beginning */ - static { - FastDeployInitializer.init(); - } -} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/classification/PaddleClasModel.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/classification/PaddleClasModel.java deleted file mode 100644 index b4a56e309..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/classification/PaddleClasModel.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.baidu.paddle.fastdeploy.vision.classification; - -import android.graphics.Bitmap; - -import com.baidu.paddle.fastdeploy.FastDeployInitializer; -import com.baidu.paddle.fastdeploy.RuntimeOption; -import com.baidu.paddle.fastdeploy.vision.ClassifyResult; - -public class PaddleClasModel { - protected long mNativeModelContext = 0; // Context from native. - protected boolean mInitialized = false; - - public PaddleClasModel() { - mInitialized = false; - } - - // Constructor with default runtime option - public PaddleClasModel(String modelFile, - String paramsFile, - String configFile) { - init_(modelFile, paramsFile, configFile, "", new RuntimeOption()); - } - - public PaddleClasModel(String modelFile, - String paramsFile, - String configFile, - String labelFile) { - init_(modelFile, paramsFile, configFile, labelFile, new RuntimeOption()); - } - - // Constructor without label file - public PaddleClasModel(String modelFile, - String paramsFile, - String configFile, - RuntimeOption option) { - init_(modelFile, paramsFile, configFile, "", option); - } - - // Constructor with label file - public PaddleClasModel(String modelFile, - String paramsFile, - String configFile, - String labelFile, - RuntimeOption option) { - init_(modelFile, paramsFile, configFile, labelFile, option); - } - - // Call init manually without label file - public boolean init(String modelFile, - String paramsFile, - String configFile, - RuntimeOption option) { - return init_(modelFile, paramsFile, configFile, "", option); - } - - // Call init manually with label file - public boolean init(String modelFile, - String paramsFile, - String configFile, - String labelFile, - RuntimeOption option) { - return init_(modelFile, paramsFile, configFile, labelFile, option); - } - - - public boolean release() { - mInitialized = false; - if (mNativeModelContext == 0) { - return false; - } - return releaseNative(mNativeModelContext); - } - - public boolean initialized() { - return mInitialized; - } - - // Predict without image saving and bitmap rendering. - public ClassifyResult predict(Bitmap ARGB8888Bitmap) { - if (mNativeModelContext == 0) { - return new ClassifyResult(); - } - // Only support ARGB8888 bitmap in native now. - return new ClassifyResult(predictNative( - mNativeModelContext, ARGB8888Bitmap, false, - "", 0.f, false)); - } - - // Predict with image saving and bitmap rendering (will cost more times) - public ClassifyResult predict(Bitmap ARGB8888Bitmap, - String savedImagePath, - float scoreThreshold) { - // scoreThreshold is for visualizing only. - if (mNativeModelContext == 0) { - return new ClassifyResult(); - } - // Only support ARGB8888 bitmap in native now. - return new ClassifyResult(predictNative( - mNativeModelContext, ARGB8888Bitmap, true, - savedImagePath, scoreThreshold, true)); - } - - // Internal init_ method - private boolean init_(String modelFile, - String paramsFile, - String configFile, - String labelFile, - RuntimeOption option) { - if (!mInitialized) { - mNativeModelContext = bindNative( - modelFile, - paramsFile, - configFile, - option.mCpuThreadNum, - option.mEnableLiteFp16, - option.mLitePowerMode.ordinal(), - option.mLiteOptimizedModelDir, - option.mEnableRecordTimeOfRuntime, labelFile); - if (mNativeModelContext != 0) { - mInitialized = true; - } - return mInitialized; - } else { - // release current native context and bind a new one. - if (release()) { - mNativeModelContext = bindNative( - modelFile, - paramsFile, - configFile, - option.mCpuThreadNum, - option.mEnableLiteFp16, - option.mLitePowerMode.ordinal(), - option.mLiteOptimizedModelDir, - option.mEnableRecordTimeOfRuntime, labelFile); - if (mNativeModelContext != 0) { - mInitialized = true; - } - return mInitialized; - } - return false; - } - } - - - // Bind predictor from native context. - private static native long bindNative(String modelFile, - String paramsFile, - String configFile, - int cpuNumThread, - boolean enableLiteFp16, - int litePowerMode, - String liteOptimizedModelDir, - boolean enableRecordTimeOfRuntime, - String labelFile); - - // Call prediction from native context. - private static native long predictNative(long nativeModelContext, - Bitmap ARGB8888Bitmap, - boolean saved, - String savedImagePath, - float scoreThreshold, - boolean rendering); - - // Release buffers allocated in native context. - private static native boolean releaseNative(long nativeModelContext); - - // Initializes at the beginning. - static { - FastDeployInitializer.init(); - } - -} diff --git a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/detection/PicoDet.java b/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/detection/PicoDet.java deleted file mode 100644 index 9729eeb8a..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/java/com/baidu/paddle/fastdeploy/vision/detection/PicoDet.java +++ /dev/null @@ -1,170 +0,0 @@ -package com.baidu.paddle.fastdeploy.vision.detection; - -import android.graphics.Bitmap; - -import com.baidu.paddle.fastdeploy.FastDeployInitializer; -import com.baidu.paddle.fastdeploy.RuntimeOption; -import com.baidu.paddle.fastdeploy.vision.DetectionResult; - -public class PicoDet { - protected long mNativeModelContext = 0; // Context from native. - protected boolean mInitialized = false; - - public PicoDet() { - mInitialized = false; - } - - // Constructor with default runtime option - public PicoDet(String modelFile, - String paramsFile, - String configFile) { - init_(modelFile, paramsFile, configFile, "", new RuntimeOption()); - } - - public PicoDet(String modelFile, - String paramsFile, - String configFile, - String labelFile) { - init_(modelFile, paramsFile, configFile, labelFile, new RuntimeOption()); - } - - // Constructor without label file - public PicoDet(String modelFile, - String paramsFile, - String configFile, - RuntimeOption option) { - init_(modelFile, paramsFile, configFile, "", option); - } - - // Constructor with label file - public PicoDet(String modelFile, - String paramsFile, - String configFile, - String labelFile, - RuntimeOption option) { - init_(modelFile, paramsFile, configFile, labelFile, option); - } - - // Call init manually without label file - public boolean init(String modelFile, - String paramsFile, - String configFile, - RuntimeOption option) { - return init_(modelFile, paramsFile, configFile, "", option); - } - - // Call init manually with label file - public boolean init(String modelFile, - String paramsFile, - String configFile, - String labelFile, - RuntimeOption option) { - return init_(modelFile, paramsFile, configFile, labelFile, option); - } - - public boolean release() { - mInitialized = false; - if (mNativeModelContext == 0) { - return false; - } - return releaseNative(mNativeModelContext); - } - - public boolean initialized() { - return mInitialized; - } - - // Predict without image saving and bitmap rendering. - public DetectionResult predict(Bitmap ARGB8888Bitmap) { - if (mNativeModelContext == 0) { - return new DetectionResult(); - } - // Only support ARGB8888 bitmap in native now. - return new DetectionResult(predictNative( - mNativeModelContext, ARGB8888Bitmap, false, - "", 0.f, false)); - } - - // Predict with image saving and bitmap rendering (will cost more times) - public DetectionResult predict(Bitmap ARGB8888Bitmap, - String savedImagePath, - float scoreThreshold) { - // scoreThreshold is for visualizing only. - if (mNativeModelContext == 0) { - return new DetectionResult(); - } - // Only support ARGB8888 bitmap in native now. - return new DetectionResult(predictNative( - mNativeModelContext, ARGB8888Bitmap, true, - savedImagePath, scoreThreshold, true)); - } - - - private boolean init_(String modelFile, - String paramsFile, - String configFile, - String labelFile, - RuntimeOption option) { - if (!mInitialized) { - mNativeModelContext = bindNative( - modelFile, - paramsFile, - configFile, - option.mCpuThreadNum, - option.mEnableLiteFp16, - option.mLitePowerMode.ordinal(), - option.mLiteOptimizedModelDir, - option.mEnableRecordTimeOfRuntime, labelFile); - if (mNativeModelContext != 0) { - mInitialized = true; - } - return mInitialized; - } else { - // release current native context and bind a new one. - if (release()) { - mNativeModelContext = bindNative( - modelFile, - paramsFile, - configFile, - option.mCpuThreadNum, - option.mEnableLiteFp16, - option.mLitePowerMode.ordinal(), - option.mLiteOptimizedModelDir, - option.mEnableRecordTimeOfRuntime, labelFile); - if (mNativeModelContext != 0) { - mInitialized = true; - } - return mInitialized; - } - return false; - } - } - - // Bind predictor from native context. - private static native long bindNative(String modelFile, - String paramsFile, - String configFile, - int cpuNumThread, - boolean enableLiteFp16, - int litePowerMode, - String liteOptimizedModelDir, - boolean enableRecordTimeOfRuntime, - String labelFile); - - // Call prediction from native context. - private static native long predictNative(long nativeModelContext, - Bitmap ARGB8888Bitmap, - boolean saved, - String savedImagePath, - float scoreThreshold, - boolean rendering); - - // Release buffers allocated in native context. - private static native boolean releaseNative(long nativeModelContext); - - // Initializes at the beginning. - static { - FastDeployInitializer.init(); - } -} - diff --git a/examples/vision/detection/paddledetection/android/app/src/main/res/layout-land/activity_main.xml b/examples/vision/detection/paddledetection/android/app/src/main/res/layout-land/activity_main.xml deleted file mode 100644 index 83e88fbf6..000000000 --- a/examples/vision/detection/paddledetection/android/app/src/main/res/layout-land/activity_main.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/examples/vision/detection/paddledetection/android/app/src/main/res/layout-land/detection_activity_main.xml b/examples/vision/detection/paddledetection/android/app/src/main/res/layout-land/detection_activity_main.xml new file mode 100644 index 000000000..1a75970f4 --- /dev/null +++ b/examples/vision/detection/paddledetection/android/app/src/main/res/layout-land/detection_activity_main.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/examples/vision/detection/paddledetection/android/app/src/main/res/layout/detection_activity_main.xml b/examples/vision/detection/paddledetection/android/app/src/main/res/layout/detection_activity_main.xml new file mode 100644 index 000000000..1a75970f4 --- /dev/null +++ b/examples/vision/detection/paddledetection/android/app/src/main/res/layout/detection_activity_main.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/examples/vision/detection/paddledetection/android/app/src/main/res/layout/activity_main.xml b/examples/vision/detection/paddledetection/android/app/src/main/res/layout/detection_camera_page.xml similarity index 91% rename from examples/vision/detection/paddledetection/android/app/src/main/res/layout/activity_main.xml rename to examples/vision/detection/paddledetection/android/app/src/main/res/layout/detection_camera_page.xml index c79683a0c..82d18f7c9 100644 --- a/examples/vision/detection/paddledetection/android/app/src/main/res/layout/activity_main.xml +++ b/examples/vision/detection/paddledetection/android/app/src/main/res/layout/detection_camera_page.xml @@ -5,17 +5,17 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:keepScreenOn="true" - tools:context=".MainActivity"> + tools:context=".detection.DetectionMainActivity"> - + android:layout_height="wrap_content"/> - - - - + android:scaleType="fitXY" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/vision/detection/paddledetection/android/app/src/main/res/layout/detection_result_page_item.xml b/examples/vision/detection/paddledetection/android/app/src/main/res/layout/detection_result_page_item.xml new file mode 100644 index 000000000..6a2b09ebf --- /dev/null +++ b/examples/vision/detection/paddledetection/android/app/src/main/res/layout/detection_result_page_item.xml @@ -0,0 +1,26 @@ + + + + + + + + + \ No newline at end of file diff --git a/examples/vision/detection/paddledetection/android/app/src/main/res/values/strings.xml b/examples/vision/detection/paddledetection/android/app/src/main/res/values/strings.xml index 470605e83..267871056 100644 --- a/examples/vision/detection/paddledetection/android/app/src/main/res/values/strings.xml +++ b/examples/vision/detection/paddledetection/android/app/src/main/res/values/strings.xml @@ -1,5 +1,13 @@ - FastDeploy PicoDet + + EasyEdge + + EasyEdge + EasyEdge + EasyEdge + EasyEdge + EasyEdge + CHOOSE_INSTALLED_MODEL_KEY MODEL_DIR_KEY LABEL_PATH_KEY @@ -7,15 +15,30 @@ CPU_POWER_MODE_KEY SCORE_THRESHOLD_KEY ENABLE_LITE_FP16_MODE_KEY - models/picodet_s_320_coco_lcnet - labels/coco_label_list.txt + 2 LITE_POWER_HIGH 0.4 + 0.1 + 0.25 true + + models/picodet_s_320_coco_lcnet + labels/coco_label_list.txt + + models + labels/ppocr_keys_v1.txt + + models/MobileNetV1_x0_25_infer + labels/imagenet1k_label_list.txt + + models/scrfd_500m_bnkps_shape320x320_pd + + models/portrait_pp_humansegv2_lite_256x144_inference_model + 拍照识别 - FD 实时识别 + 实时识别 < 模型名称 识别结果 @@ -25,4 +48,4 @@ 阈值控制 重新识别 保存结果 - \ No newline at end of file + diff --git a/examples/vision/detection/paddledetection/android/app/src/main/res/values/values.xml b/examples/vision/detection/paddledetection/android/app/src/main/res/values/values.xml new file mode 100644 index 000000000..156146d9a --- /dev/null +++ b/examples/vision/detection/paddledetection/android/app/src/main/res/values/values.xml @@ -0,0 +1,17 @@ + + + 120dp + 46px + + 126px + 136px + + 46px + + 36px + + 15dp + + 15dp + + \ No newline at end of file diff --git a/examples/vision/detection/paddledetection/android/app/src/main/res/xml/settings.xml b/examples/vision/detection/paddledetection/android/app/src/main/res/xml/detection_settings.xml similarity index 89% rename from examples/vision/detection/paddledetection/android/app/src/main/res/xml/settings.xml rename to examples/vision/detection/paddledetection/android/app/src/main/res/xml/detection_settings.xml index 26329068b..df9801aec 100644 --- a/examples/vision/detection/paddledetection/android/app/src/main/res/xml/settings.xml +++ b/examples/vision/detection/paddledetection/android/app/src/main/res/xml/detection_settings.xml @@ -1,17 +1,17 @@ - + \ No newline at end of file diff --git a/examples/vision/detection/paddledetection/android/settings.gradle b/examples/vision/detection/paddledetection/android/settings.gradle index e7b4def49..9d495b34f 100644 --- a/examples/vision/detection/paddledetection/android/settings.gradle +++ b/examples/vision/detection/paddledetection/android/settings.gradle @@ -1 +1 @@ -include ':app' +include ':app' \ No newline at end of file diff --git a/java/android/README.md b/java/android/README.md index e0368ff46..a032ae24b 100644 --- a/java/android/README.md +++ b/java/android/README.md @@ -420,7 +420,6 @@ String configFile = "picodet_s_320_coco_lcnet/infer_cfg.yml"; RuntimeOption option = new RuntimeOption(); option.setCpuThreadNum(2); option.setLitePowerMode(LitePowerMode.LITE_POWER_HIGH); -option.enableRecordTimeOfRuntime(); option.enableLiteFp16(); // 使用init函数初始化 model.init(modelFile, paramFile, configFile, option); @@ -489,7 +488,7 @@ App示例工程只需要在AndroidManifest.xml中切换不同的Activity即可 ``` -- 目标检测 +- 目标检测场景 ```xml @@ -503,7 +502,7 @@ App示例工程只需要在AndroidManifest.xml中切换不同的Activity即可 ``` -- OCR文字识别 +- OCR文字识别场景 ```xml @@ -517,7 +516,7 @@ App示例工程只需要在AndroidManifest.xml中切换不同的Activity即可 ``` -- 人像分割 +- 人像分割场景 ```xml @@ -531,7 +530,7 @@ App示例工程只需要在AndroidManifest.xml中切换不同的Activity即可 ``` -- 人脸检测 +- 人脸检测场景 ```xml