Fixed crash on devices without Google Play Services installed (which provides TensorFlowLite)
This commit is contained in:
@@ -63,8 +63,10 @@ public class SdAlgNn {
|
|||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
Log.d(TAG,"close()");
|
Log.d(TAG,"close()");
|
||||||
|
if (interpreter != null) {
|
||||||
interpreter.close();
|
interpreter.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public float getPseizure(SdData sdData) {
|
public float getPseizure(SdData sdData) {
|
||||||
int i;
|
int i;
|
||||||
@@ -73,6 +75,10 @@ public class SdAlgNn {
|
|||||||
for (int j = 0; j < 125; j++) {
|
for (int j = 0; j < 125; j++) {
|
||||||
modelInput[0][j][0] = (float)sdData.rawData[j];
|
modelInput[0][j][0] = (float)sdData.rawData[j];
|
||||||
}
|
}
|
||||||
|
if (interpreter == null) {
|
||||||
|
Log.d(TAG,"getPSeizure() - interpreter is null - returning zero seizure probability");
|
||||||
|
return (0.0f);
|
||||||
|
}
|
||||||
interpreter.run(modelInput, modelOutput);
|
interpreter.run(modelInput, modelOutput);
|
||||||
Log.d(TAG,"run - pSeizure="+modelOutput[0][1]);
|
Log.d(TAG,"run - pSeizure="+modelOutput[0][1]);
|
||||||
return(modelOutput[0][1]);
|
return(modelOutput[0][1]);
|
||||||
|
|||||||
Reference in New Issue
Block a user