V4.1.0 - Uses CNN V0.12

This commit is contained in:
Graham Jones
2022-10-02 21:24:27 +01:00
parent 28891df0cf
commit 31e68eef86
8 changed files with 26 additions and 12 deletions

View File

@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="uk.org.openseizuredetector"
android:versionCode="111"
android:versionName="4.1.0h">
android:versionCode="112"
android:versionName="4.1.0">
<!-- android:allowBackup="false" -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

Binary file not shown.

View File

@@ -82,7 +82,7 @@ public class LogManager {
private boolean mUploadInProgress;
private long mEventDuration = 120; // event duration in seconds - uploads datapoints that cover this time range centred on the event time.
public long mDataRetentionPeriod = 1; // Prunes the local db so it only retains data younger than this duration (in days)
private long mRemoteLogPeriod = 60; // Period in seconds between uploads to the remote server.
private long mRemoteLogPeriod = 10; // Period in seconds between uploads to the remote server.
private ArrayList<JSONObject> mDatapointsToUploadList;
private String mCurrentEventRemoteId;
private long mCurrentEventLocalId = -1;

View File

@@ -25,7 +25,7 @@ import java.util.Map;
public class SdAlgNn {
private final static String TAG = "SdAlgNn";
private final static String MODEL_PATH = "best_model_v0.09.tflite";
private final static String MODEL_PATH = "best_model_v0.12.tflite";
private String mUrlBase = "https://osdApi.ddns.net";
private InterpreterApi interpreter;
private Context mContext;

View File

@@ -112,7 +112,6 @@ public abstract class SdDataSource {
mSdDataReceiver = sdDataReceiver;
mSdData = new SdData();
mSdAlgNn = new SdAlgNn(mContext);
}
/**
@@ -133,6 +132,13 @@ public abstract class SdDataSource {
Log.v(TAG, "start()");
mUtil.writeToSysLogFile("SdDataSource.start()");
updatePrefs();
if (mSdData.mCnnAlarmActive) {
mSdAlgNn = new SdAlgNn(mContext);
} else {
mSdData.mPseizure = 0;
}
// Start timer to check status of watch regularly.
mDataStatusTime = new Time(Time.getCurrentTimezone());
// use a timer to check the status of the pebble app on the same frequency
@@ -220,7 +226,9 @@ public abstract class SdDataSource {
mUtil.writeToSysLogFile("SDDataSource.stop() - error - " + e.toString());
}
if (mSdData.mCnnAlarmActive) {
mSdAlgNn.close();
}
}
@@ -490,7 +498,9 @@ public abstract class SdDataSource {
// Use the neural network algorithm to calculate the probability of the data
// being representative of a seizure (sets mSdData.mPseizure)
if (mSdData.mCnnAlarmActive) {
nnAnalysis();
}
// Check this data to see if it represents an alarm state.
alarmCheck();
@@ -744,9 +754,14 @@ public abstract class SdDataSource {
void nnAnalysis() {
//Check the current set of data using the neural network model to look for alarms.
Log.d(TAG,"nnAnalysis");
if (mSdData.mCnnAlarmActive) {
float pSeizure = mSdAlgNn.getPseizure(mSdData);
Log.d(TAG, "nnAnalysis - nnResult=" + pSeizure);
mSdData.mPseizure = pSeizure;
} else {
Log.d(TAG, "nnAnalysis - mCnAlarmActive is false - not analysing");
mSdData.mPseizure = 0;
}
}
/**

View File

@@ -3,8 +3,7 @@
<string name="app_name">OpenSeizureDetector</string>
<string name="changelog">
"\n
\nV4.1.0g - CNN V0.09
\nV4.1.0 - Added Machine Learning (Artificial Intelligence) Detection Algorithm Option
\nV4.1.0 - Added Machine Learning (Artificial Intelligence) Detection Algorithm Option (CNN V0.12)
\nV4.0.7 - Improvements to Data Sharing data log manager screen.
- Introduced the &lt;b>Data Sharing&lt;/b> feature to allow users to share their seizure and false alarm data
with researchers to help improve the system.&lt;br/>