commit
e0c8b88993
|
@ -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'
|
||||
]
|
||||
]
|
||||
|
||||
|
|
|
@ -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>();
|
||||
|
|
|
@ -135,7 +135,7 @@ public class Predictor {
|
|||
|
||||
public void releaseModel() {
|
||||
if (paddlePredictor != null) {
|
||||
paddlePredictor.release();
|
||||
paddlePredictor.destory();
|
||||
paddlePredictor = null;
|
||||
}
|
||||
isLoaded = false;
|
||||
|
|
Loading…
Reference in New Issue