diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/readme.md" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/readme.md" new file mode 100644 index 00000000..a53324a1 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/readme.md" @@ -0,0 +1,24 @@ +# 跌倒报警器 - 啦啦队 + +## 作品介绍 +跌倒是全球老人意外伤害的头号杀手。数据显示,我国60岁以上的老人中,每年因跌倒造成伤害的达2500万人。跌倒后如果不及时急救,很容易有生命危险,那老人跌倒怎么办呢?本项目基于智能手机传感器获取加速度、角速度和偏向角的数据,并通过深度学习算法进行序列数据分类,识别出老人跌倒的情况。当出现意外情况,可以向预先设置的号码求救。也可以通过手机定位功能报告精确的位置方便急救人员快速到达现场。 + +## 作品截图 +![摔倒](截图/摔倒.jpg) +![行走中](截图/行走中.jpg) +## 实现过程 + +### 收集数据 +使用公开的mobifall数据集,共包含1442个片段,每个片段包含一段时间的传感器数据。传感器数据包括加速度传感器、方向传感器和角速度传感器。 + +### 训练深度学习模型 +搭建LSTM模型用于时间序列数据,将传感器数据序列分类成正常行走和跌倒两种标签。 + +### 开发安卓应用程序 +开发安卓应用程序获取传感器数据。将tflite模型部署到手机上并进行实时推理,当判断跌倒后发送http请求报警。 + +## 团队介绍 +[朱融晨](mailto:zrcccrz@outlook.com) + +## 使用到的 AWS 技术 +使用 sagemaker 训练深度学习模型 \ No newline at end of file diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\346\210\252\345\233\276/\346\221\224\345\200\222.jpg" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\346\210\252\345\233\276/\346\221\224\345\200\222.jpg" new file mode 100644 index 00000000..a745335e Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\346\210\252\345\233\276/\346\221\224\345\200\222.jpg" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\346\210\252\345\233\276/\350\241\214\350\265\260\344\270\255.jpg" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\346\210\252\345\233\276/\350\241\214\350\265\260\344\270\255.jpg" new file mode 100644 index 00000000..c4236d87 Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\346\210\252\345\233\276/\350\241\214\350\265\260\344\270\255.jpg" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/.gitignore" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/.gitignore" new file mode 100644 index 00000000..603b1407 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/.gitignore" @@ -0,0 +1,14 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/.gitignore" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/.gitignore" new file mode 100644 index 00000000..796b96d1 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/.gitignore" @@ -0,0 +1 @@ +/build diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/build.gradle" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/build.gradle" new file mode 100644 index 00000000..5bd6c884 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/build.gradle" @@ -0,0 +1,37 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 29 + buildToolsVersion "29.0.0" + + defaultConfig { + applicationId "com.example.falldetect" + minSdkVersion 21 + targetSdkVersion 29 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + implementation 'androidx.appcompat:appcompat:1.1.0' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' + // Build off of nightly TensorFlow Lite + implementation('org.tensorflow:tensorflow-lite:2.2.0') { changing = true } + implementation('org.tensorflow:tensorflow-lite-support:0.0.0-nightly') { changing = true } +} diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/proguard-rules.pro" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/proguard-rules.pro" new file mode 100644 index 00000000..f1b42451 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/proguard-rules.pro" @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/androidTest/java/com/example/falldetect/ExampleInstrumentedTest.java" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/androidTest/java/com/example/falldetect/ExampleInstrumentedTest.java" new file mode 100644 index 00000000..c9d734bb --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/androidTest/java/com/example/falldetect/ExampleInstrumentedTest.java" @@ -0,0 +1,27 @@ +package com.example.falldetect; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + + assertEquals("com.example.falldetect", appContext.getPackageName()); + } +} diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/AndroidManifest.xml" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/AndroidManifest.xml" new file mode 100644 index 00000000..65d3f779 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/AndroidManifest.xml" @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/java/com/example/falldetect/MainActivity.java" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/java/com/example/falldetect/MainActivity.java" new file mode 100644 index 00000000..fa5b9e8a --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/java/com/example/falldetect/MainActivity.java" @@ -0,0 +1,86 @@ +package com.example.falldetect; + +import androidx.appcompat.app.AppCompatActivity; + +import android.hardware.Sensor; +import android.hardware.SensorEvent; +import android.hardware.SensorEventListener; +import android.hardware.SensorListener; +import android.hardware.SensorManager; +import android.os.Bundle; +import android.widget.TextView; + +import java.util.List; + +public class MainActivity extends AppCompatActivity implements SensorEventListener { + + private TextView accX; + private TextView accY; + private TextView accZ; + private TextView gyroX; + private TextView gyroY; + private TextView gyroZ; + private TextView orientX; + private TextView orientY; + private TextView orientZ; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + // 获得SensorManager对象 + SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); + + // 注册加速度传感器 + sensorManager.registerListener(this, + sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), + SensorManager.SENSOR_DELAY_FASTEST); + + // 注册陀螺仪传感器 + sensorManager.registerListener(this, + sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE), + SensorManager.SENSOR_DELAY_FASTEST); + + // 注册方向传感器 + sensorManager.registerListener(this, + sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION), + SensorManager.SENSOR_DELAY_FASTEST); + + accX = findViewById(R.id.acc_x); + accY = findViewById(R.id.acc_y); + accZ = findViewById(R.id.acc_z); + gyroX = findViewById(R.id.gyro_x); + gyroY = findViewById(R.id.gyro_y); + gyroZ = findViewById(R.id.gyro_z); + orientX = findViewById(R.id.orient_x); + orientY = findViewById(R.id.orient_y); + orientZ = findViewById(R.id.orient_z); + } + + @Override + public void onSensorChanged(SensorEvent event) { + // 通过getType方法获得当前传回数据的传感器类型 + switch(event.sensor.getType()) { + case Sensor.TYPE_ACCELEROMETER: // 处理加速度传感器传回的数据 + accX.setText(String.valueOf(event.values[0])); + accY.setText(String.valueOf(event.values[1])); + accZ.setText(String.valueOf(event.values[2])); + break; + case Sensor.TYPE_GYROSCOPE: // 处理陀螺仪传感器传回的数据 + gyroX.setText(String.valueOf(event.values[0])); + gyroY.setText(String.valueOf(event.values[1])); + gyroZ.setText(String.valueOf(event.values[2])); + break; + case Sensor.TYPE_ORIENTATION: // 处理方向传感器传回的数据 + orientX.setText(String.valueOf(event.values[0])); + orientY.setText(String.valueOf(event.values[1])); + orientZ.setText(String.valueOf(event.values[2])); + break; + } + } + + @Override + public void onAccuracyChanged(Sensor sensor, int i) { + + } +} diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/java/com/example/falldetect/Model.java" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/java/com/example/falldetect/Model.java" new file mode 100644 index 00000000..cee8836f --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/java/com/example/falldetect/Model.java" @@ -0,0 +1,38 @@ +package com.example.falldetect; + +import android.app.Activity; + +import org.tensorflow.lite.Interpreter; +import org.tensorflow.lite.support.common.FileUtil; + +import java.io.IOException; +import java.nio.MappedByteBuffer; + +public class Model { + + private static Interpreter interpreter = null; + + private static Model model = new Model(); + + private Model(){}; + + public static synchronized boolean inference(Activity activity, float[] input) { + if (interpreter == null) { + MappedByteBuffer model = null; + try { + model = FileUtil.loadMappedFile(activity, "model.tflite"); + } catch (IOException e) { + e.printStackTrace(); + } + interpreter = new Interpreter(model + , new Interpreter.Options().setNumThreads(4)); + } + float[] singleInput = new float[30*9]; + float[][] singleOutput = new float[1][2]; + System.arraycopy(input, 30*9, singleInput, 0, + Math.min(input.length - 30*9, 30*9)); + interpreter.run(singleInput, singleOutput); + return singleOutput[0][1] > 0.5; + } + +} \ No newline at end of file diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" new file mode 100644 index 00000000..fde1368f --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/drawable/ic_launcher_background.xml" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/drawable/ic_launcher_background.xml" new file mode 100644 index 00000000..1e4408ca --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/drawable/ic_launcher_background.xml" @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/layout/activity_main.xml" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/layout/activity_main.xml" new file mode 100644 index 00000000..cfc9efb2 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/layout/activity_main.xml" @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" new file mode 100644 index 00000000..eca70cfe --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-hdpi/ic_launcher.png" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-hdpi/ic_launcher.png" new file mode 100644 index 00000000..a571e600 Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-hdpi/ic_launcher.png" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-hdpi/ic_launcher_round.png" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-hdpi/ic_launcher_round.png" new file mode 100644 index 00000000..61da551c Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-hdpi/ic_launcher_round.png" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-mdpi/ic_launcher.png" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-mdpi/ic_launcher.png" new file mode 100644 index 00000000..c41dd285 Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-mdpi/ic_launcher.png" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-mdpi/ic_launcher_round.png" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-mdpi/ic_launcher_round.png" new file mode 100644 index 00000000..db5080a7 Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-mdpi/ic_launcher_round.png" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xhdpi/ic_launcher.png" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xhdpi/ic_launcher.png" new file mode 100644 index 00000000..6dba46da Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xhdpi/ic_launcher.png" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png" new file mode 100644 index 00000000..da31a871 Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxhdpi/ic_launcher.png" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxhdpi/ic_launcher.png" new file mode 100644 index 00000000..15ac6817 Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxhdpi/ic_launcher.png" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png" new file mode 100644 index 00000000..b216f2d3 Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png" new file mode 100644 index 00000000..f25a4197 Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png" new file mode 100644 index 00000000..e96783cc Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/values/colors.xml" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/values/colors.xml" new file mode 100644 index 00000000..030098fe --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/values/colors.xml" @@ -0,0 +1,6 @@ + + + #6200EE + #3700B3 + #03DAC5 + diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/values/strings.xml" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/values/strings.xml" new file mode 100644 index 00000000..5625be2c --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/values/strings.xml" @@ -0,0 +1,3 @@ + + FallDetect + diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/values/styles.xml" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/values/styles.xml" new file mode 100644 index 00000000..5885930d --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/main/res/values/styles.xml" @@ -0,0 +1,11 @@ + + + + + + diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/test/java/com/example/falldetect/ExampleUnitTest.java" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/test/java/com/example/falldetect/ExampleUnitTest.java" new file mode 100644 index 00000000..318be986 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/app/src/test/java/com/example/falldetect/ExampleUnitTest.java" @@ -0,0 +1,17 @@ +package com.example.falldetect; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/build.gradle" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/build.gradle" new file mode 100644 index 00000000..a88f6236 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/build.gradle" @@ -0,0 +1,29 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + + repositories { + google() + jcenter() + + } + dependencies { + classpath 'com.android.tools.build:gradle:3.6.3' + + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + google() + jcenter() + + } +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradle.properties" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradle.properties" new file mode 100644 index 00000000..199d16ed --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradle.properties" @@ -0,0 +1,20 @@ +# Project-wide Gradle settings. +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +# AndroidX package structure to make it clearer which packages are bundled with the +# Android operating system, and which are packaged with your app's APK +# https://developer.android.com/topic/libraries/support-library/androidx-rn +android.useAndroidX=true +# Automatically convert third-party libraries to use AndroidX +android.enableJetifier=true + diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradle/wrapper/gradle-wrapper.jar" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradle/wrapper/gradle-wrapper.jar" new file mode 100644 index 00000000..f6b961fd Binary files /dev/null and "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradle/wrapper/gradle-wrapper.jar" differ diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradle/wrapper/gradle-wrapper.properties" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradle/wrapper/gradle-wrapper.properties" new file mode 100644 index 00000000..de0f9460 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradle/wrapper/gradle-wrapper.properties" @@ -0,0 +1,6 @@ +#Sun Sep 13 20:51:01 CST 2020 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradlew" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradlew" new file mode 100644 index 00000000..cccdd3d5 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradlew" @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradlew.bat" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradlew.bat" new file mode 100644 index 00000000..f9553162 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/gradlew.bat" @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/settings.gradle" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/settings.gradle" new file mode 100644 index 00000000..6ae43c47 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\247\273\345\212\250\347\253\257\347\250\213\345\272\217/FallDetect/settings.gradle" @@ -0,0 +1,2 @@ +rootProject.name='FallDetect' +include ':app' diff --git "a/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\256\227\346\263\225/\347\256\227\346\263\225.ipynb" "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\256\227\346\263\225/\347\256\227\346\263\225.ipynb" new file mode 100644 index 00000000..197459b9 --- /dev/null +++ "b/2 \350\200\201\345\271\264\344\272\272\347\232\204\350\277\234\347\250\213\346\231\272\350\203\275\350\257\212\347\226\227/\350\267\214\345\200\222\346\212\245\350\255\246\345\231\250-\345\225\246\345\225\246\351\230\237/\347\256\227\346\263\225/\347\256\227\346\263\225.ipynb" @@ -0,0 +1,298 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "import tensorflow as tf\n", + "from tensorflow.keras import layers\n", + "from sklearn.metrics import accuracy_score\n", + "from sklearn.metrics import confusion_matrix\n", + "\n", + "BATCH_SIZE = 128\n", + "\n", + "model = tf.keras.Sequential()\n", + "model.add(layers.Input(shape=(30, 9)))\n", + "model.add(layers.LSTM(64, kernel_regularizer=tf.keras.regularizers.l2(0.0001)))\n", + "model.add(layers.Dropout(0.5))\n", + "model.add(layers.Dense(2, activation='softmax'))\n", + "\n", + "model.compile(loss='binary_crossentropy',\n", + " optimizer='rmsprop',\n", + " metrics=['accuracy'])\n" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Model: \"sequential\"\n", + "_________________________________________________________________\n", + "Layer (type) Output Shape Param # \n", + "=================================================================\n", + "lstm (LSTM) (None, 64) 18944 \n", + "_________________________________________________________________\n", + "dropout (Dropout) (None, 64) 0 \n", + "_________________________________________________________________\n", + "dense (Dense) (None, 2) 130 \n", + "=================================================================\n", + "Total params: 19,074\n", + "Trainable params: 19,074\n", + "Non-trainable params: 0\n", + "_________________________________________________________________\n", + "None\n" + ] + } + ], + "source": [ + "print(model.summary())" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "def train(model, train_X, train_y):\n", + "\n", + " dataset = tf.data.Dataset.from_tensor_slices((train_X, train_y))\n", + " dataset = dataset.shuffle(1000).batch(32).repeat()\n", + " steps_per_epoch = train_y.shape[0] // 32\n", + "\n", + " model.fit(dataset, epochs=50, steps_per_epoch=steps_per_epoch)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "def test(model, test_X, test_y):\n", + " predictions = model.predict(test_X).squeeze()\n", + " labels = np.array(test_y).squeeze()\n", + " predictions = np.eye(2)[predictions.argmax(1)]\n", + " acc = accuracy_score(predictions, labels)\n", + " cm = confusion_matrix(predictions.argmax(1), labels.argmax(1))\n", + " print(acc)\n", + " print(cm)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(338, 30, 9)\n" + ] + } + ], + "source": [ + "import pickle\n", + "with open('fall_down_data', 'rb') as fp:\n", + " X, Y = pickle.load(fp)\n", + "print(X.shape)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Train for 9 steps\n", + "Epoch 1/50\n", + "9/9 [==============================] - 3s 343ms/step - loss: 0.7006 - accuracy: 0.5660\n", + "Epoch 2/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.5021 - accuracy: 0.8088\n", + "Epoch 3/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.3324 - accuracy: 0.8713\n", + "Epoch 4/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.2254 - accuracy: 0.9191\n", + "Epoch 5/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.1736 - accuracy: 0.9338\n", + "Epoch 6/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.1841 - accuracy: 0.9265\n", + "Epoch 7/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0920 - accuracy: 0.9485\n", + "Epoch 8/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.1080 - accuracy: 0.9449\n", + "Epoch 9/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.0769 - accuracy: 0.9596\n", + "Epoch 10/50\n", + "9/9 [==============================] - 0s 32ms/step - loss: 0.0688 - accuracy: 0.9743\n", + "Epoch 11/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.0674 - accuracy: 0.9688\n", + "Epoch 12/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0581 - accuracy: 0.9743\n", + "Epoch 13/50\n", + "9/9 [==============================] - 0s 32ms/step - loss: 0.0550 - accuracy: 0.9706\n", + "Epoch 14/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0594 - accuracy: 0.9632\n", + "Epoch 15/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0426 - accuracy: 0.9853\n", + "Epoch 16/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0356 - accuracy: 0.9816\n", + "Epoch 17/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0418 - accuracy: 0.9853\n", + "Epoch 18/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0642 - accuracy: 0.9779\n", + "Epoch 19/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0344 - accuracy: 0.9853\n", + "Epoch 20/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0418 - accuracy: 0.9816\n", + "Epoch 21/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0412 - accuracy: 0.9861\n", + "Epoch 22/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0288 - accuracy: 0.9853\n", + "Epoch 23/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.0247 - accuracy: 0.9890\n", + "Epoch 24/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.0422 - accuracy: 0.9816\n", + "Epoch 25/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.0225 - accuracy: 0.9890\n", + "Epoch 26/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0330 - accuracy: 0.9890\n", + "Epoch 27/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0377 - accuracy: 0.9816\n", + "Epoch 28/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0226 - accuracy: 0.9890\n", + "Epoch 29/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.0266 - accuracy: 0.9890\n", + "Epoch 30/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0460 - accuracy: 0.9816\n", + "Epoch 31/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.0261 - accuracy: 0.9896\n", + "Epoch 32/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0389 - accuracy: 0.9853\n", + "Epoch 33/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0432 - accuracy: 0.9853\n", + "Epoch 34/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.1257 - accuracy: 0.9853\n", + "Epoch 35/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0431 - accuracy: 0.9890\n", + "Epoch 36/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0391 - accuracy: 0.9853\n", + "Epoch 37/50\n", + "9/9 [==============================] - 0s 32ms/step - loss: 0.0740 - accuracy: 0.9743\n", + "Epoch 38/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0256 - accuracy: 0.9926\n", + "Epoch 39/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0169 - accuracy: 0.9926\n", + "Epoch 40/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.0208 - accuracy: 0.9890\n", + "Epoch 41/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0506 - accuracy: 0.9861\n", + "Epoch 42/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0900 - accuracy: 0.9816\n", + "Epoch 43/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.0132 - accuracy: 0.9926\n", + "Epoch 44/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.0314 - accuracy: 0.9890\n", + "Epoch 45/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0165 - accuracy: 0.9963\n", + "Epoch 46/50\n", + "9/9 [==============================] - 0s 30ms/step - loss: 0.0075 - accuracy: 1.0000\n", + "Epoch 47/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0225 - accuracy: 0.9890\n", + "Epoch 48/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0191 - accuracy: 0.9853\n", + "Epoch 49/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0248 - accuracy: 0.9890\n", + "Epoch 50/50\n", + "9/9 [==============================] - 0s 31ms/step - loss: 0.0221 - accuracy: 0.9890\n" + ] + } + ], + "source": [ + "from sklearn.model_selection import train_test_split\n", + "train_X, test_X, train_y, test_y = train_test_split(X, Y, test_size=0.1)\n", + "train(model, train_X, train_y)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.9705882352941176\n", + "[[10 1]\n", + " [ 0 23]]\n" + ] + } + ], + "source": [ + "import numpy as np\n", + "test(model, test_X, test_y)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "import os\n", + "def save_model(model):\n", + " if not os.path.exists('model'):\n", + " os.mkdir('model')\n", + " model.save(os.path.join('model', 'mdoel.h5'))\n", + " converter = tf.lite.TFLiteConverter.from_keras_model(model)\n", + " converter.experimental_new_converter = True \n", + " tflite_model = converter.convert()\n", + " open(os.path.join('model', 'mdoel.tflite'), \"wb\").write(tflite_model)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [], + "source": [ + "save_model(model)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "conda_tensorflow2_p36", + "language": "python", + "name": "conda_tensorflow2_p36" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.10" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}