Merge pull request #1136 from tink2123/android_demo

fix android demo
This commit is contained in:
xiaoting 2020-11-10 14:33:39 +08:00 committed by GitHub
commit e0c8b88993
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -57,7 +57,7 @@ def archives = [
],
[
'src' : 'https://paddleocr.bj.bcebos.com/deploy/lite/ocr_v1_for_cpu.tar.gz',
'dest' : 'src/main/assets/models/ocr_v1_for_cpu'
'dest' : 'src/main/assets/models'
]
]

View File

@ -53,11 +53,18 @@ public class OCRPredictorNative {
}
public void destory(){
if (nativePointer > 0) {
release(nativePointer);
nativePointer = 0;
}
}
protected native long init(String detModelPath, String recModelPath,String clsModelPath, int threadNum, String cpuMode);
protected native float[] forward(long pointer, float[] buf, float[] ddims, Bitmap originalImage);
public native void release(long pointer);
protected native void release(long pointer);
private ArrayList<OcrResultModel> postprocess(float[] raw) {
ArrayList<OcrResultModel> results = new ArrayList<OcrResultModel>();

View File

@ -135,7 +135,7 @@ public class Predictor {
public void releaseModel() {
if (paddlePredictor != null) {
paddlePredictor.release();
paddlePredictor.destory();
paddlePredictor = null;
}
isLoaded = false;