[Doc] Update Android SDK usage docs (#657)

* [Bug Fix] fix android app detail page errors

* [Android] fix realtime camera mode and shutter

* [Bug Fix] fix AllocateSegmentationResultFromJava error

* [Bug Fix] fix camera preview size setting problem

* [Model] use uint8 buffer instead of fp32 in ppseg postprocess

* [Model] revert changes in ppseg

* [Model] revert postprocess changes in ppseg

* [Android] add fastdeploy android sdk download task

* [Bug Fix] fix yolov5face scale error in small image

* [Doc] Update Android SDK docs

* [Doc] Update Android SDK usage docs
This commit is contained in:
DefTruth
2022-11-22 17:00:07 +08:00
committed by GitHub
parent c4d43bdd9b
commit efc800adec
5 changed files with 208 additions and 33 deletions

View File

@@ -44,7 +44,31 @@ def FD_MODEL = [
'dest': 'src/main/assets/models'
],
[
'src' : 'https://bj.bcebos.com/paddlehub/fastdeploy/picodet_l_320_coco_lcnet.tgz',
'src' : 'https://bj.bcebos.com/paddlehub/fastdeploy/MobileNetV1_x0_25_infer.tgz',
'dest': 'src/main/assets/models'
],
[
'src' : 'https://bj.bcebos.com/paddlehub/fastdeploy/ch_PP-OCRv2_det_infer.tgz',
'dest': 'src/main/assets/models'
],
[
'src' : 'https://bj.bcebos.com/paddlehub/fastdeploy/ch_ppocr_mobile_v2.0_cls_infer.tgz',
'dest': 'src/main/assets/models'
],
[
'src' : 'https://bj.bcebos.com/paddlehub/fastdeploy/ch_PP-OCRv2_rec_infer.tgz',
'dest': 'src/main/assets/models'
],
[
'src' : 'https://bj.bcebos.com/paddlehub/fastdeploy/yolov5face-n-0.5-320x320_pd.tgz',
'dest': 'src/main/assets/models'
],
[
'src' : 'https://bj.bcebos.com/paddlehub/fastdeploy/scrfd_500m_bnkps_shape320x320_pd.tgz',
'dest': 'src/main/assets/models'
],
[
'src' : 'https://bj.bcebos.com/paddlehub/fastdeploy/portrait_pp_humansegv2_lite_256x144_inference_model.tgz',
'dest': 'src/main/assets/models'
]
]
@@ -61,7 +85,6 @@ task downloadAndExtractModels(type: DefaultTask) {
println "Downloading and extracting fastdeploy models ..."
}
doLast {
// Prepare cache folder for archives
String cachePath = "cache"
if (!file("${cachePath}").exists()) {
mkdir "${cachePath}"
@@ -69,20 +92,19 @@ task downloadAndExtractModels(type: DefaultTask) {
FD_MODEL.eachWithIndex { model, index ->
MessageDigest messageDigest = MessageDigest.getInstance('MD5')
messageDigest.update(model.src.bytes)
String cacheName = new BigInteger(1, messageDigest.digest()).toString(32)
// Download the target archive if not exists
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}/${cacheName}.tgz").exists()) {
println "Downloading ${model.src} -> ${cachePath}/${cacheName}.tgz"
ant.get(src: model.src, dest: file("${cachePath}/${cacheName}.tgz"))
if (!file("${cachePath}/${modelName}").exists()) {
println "Downloading ${model.src} -> ${cachePath}/${modelName}"
ant.get(src: model.src, dest: file("${cachePath}/${modelName}"))
copyFiles = true
// force to copy files from the latest archive files
}
// Extract the target archive if its dest path does not exists
if (copyFiles) {
println "Coping ${cachePath}/${cacheName}.aar -> ${model.dest}"
println "Coping ${cachePath}/${modelName} -> ${model.dest}"
copy {
from tarTree("${cachePath}/${cacheName}.tgz")
from tarTree("${cachePath}/${modelName}")
into "${model.dest}"
}
}
@@ -95,14 +117,12 @@ task downloadAndExtractSDKs(type: DefaultTask) {
println "Downloading and extracting fastdeploy android java sdk ..."
}
doLast {
// Prepare cache folder for archives
String cachePath = "cache"
if (!file("${cachePath}").exists()) {
mkdir "${cachePath}"
}
FD_JAVA_SDK.eachWithIndex { sdk, index ->
String[] sdkPaths = sdk.src.split("/")
// e.g fastdeploy-android-sdk-latest-dev.aar
String sdkName = sdkPaths[sdkPaths.length - 1]
// Download the target SDK if not exists
boolean copyFiles = !file("${sdk.dest}/${sdkName}").exists()
@@ -110,9 +130,7 @@ task downloadAndExtractSDKs(type: DefaultTask) {
println "Downloading ${sdk.src} -> ${cachePath}/${sdkName}"
ant.get(src: sdk.src, dest: file("${cachePath}/${sdkName}"))
copyFiles = true
// force to copy files from the latest downloaded sdk
}
// Copy the target archive if its dest path does not exists
if (copyFiles) {
println "Coping ${cachePath}/${sdkName} -> ${sdk.dest}/${sdkName}"
copy {

View File

@@ -35,7 +35,7 @@
<!-- facedet values ... -->
<string name="FACEDET_MODEL_DIR_DEFAULT">models/scrfd_500m_bnkps_shape320x320_pd</string>
<!-- segmentation values ... -->
<string name="SEGMENTATION_MODEL_DIR_DEFAULT">models/human_pp_humansegv1_lite_192x192_inference_model</string>
<string name="SEGMENTATION_MODEL_DIR_DEFAULT">models/portrait_pp_humansegv2_lite_256x144_inference_model</string>
<!-- Other resources values-->
<string name="action_bar_take_photo">拍照识别</string>
<string name="action_bar_realtime">实时识别</string>