Skip to content

Commit 38c6f20

Browse files
committed
Fixed the bug of miss calculation during sensor data fusion and updated models
1 parent 0bd70b8 commit 38c6f20

File tree

8 files changed

+32
-38
lines changed

8 files changed

+32
-38
lines changed

Android/build.gradle

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
buildscript {
44
repositories {
55
jcenter()
6+
google()
67
}
78
dependencies {
8-
classpath 'com.android.tools.build:gradle:2.3.3'
9+
classpath 'com.android.tools.build:gradle:3.0.1'
910

1011
// NOTE: Do not place your application dependencies here; they belong
1112
// in the individual module build.gradle files
@@ -15,6 +16,7 @@ buildscript {
1516
allprojects {
1617
repositories {
1718
jcenter()
19+
google()
1820
}
1921
}
2022

Android/demo_myna/build.gradle

+5-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
signingConfigs {
5-
config {
6-
keyAlias 'tdsdk'
7-
keyPassword 'TDRocks!12'
8-
storeFile file('/Users/xhrwang/work/tdsdktest.keystore')
9-
storePassword 'TDRocks!12'
10-
}
11-
}
12-
compileSdkVersion 25
13-
buildToolsVersion "25.0.3"
4+
compileSdkVersion 27
5+
buildToolsVersion '27.0.3'
146

157
defaultConfig {
168
applicationId "com.talkingdata.myna.demo"
@@ -24,19 +16,17 @@ android {
2416
buildTypes {
2517
release {
2618
minifyEnabled true
27-
signingConfig signingConfigs.config
2819
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2920
}
3021
debug {
31-
signingConfig signingConfigs.config
3222
}
3323
}
3424
}
3525

3626
dependencies {
3727
// compile fileTree(dir: 'libs', include: ['*.jar'])
38-
compile 'com.android.support:appcompat-v7:25.3.1'
28+
compile 'com.android.support:appcompat-v7:27.1.0'
3929
compile project(':lib-Myna')
40-
compile 'com.android.support:multidex:1.0.1'
41-
compile 'com.google.android.gms:play-services-awareness:11.0.0'
30+
compile 'com.android.support:multidex:1.0.3'
31+
compile 'com.google.android.gms:play-services-awareness:11.8.0'
4232
}

Android/demo_myna/src/main/java/com/talkingdata/myna/demo/DataScientistActivity.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ private void xgBoost(){
102102
}
103103

104104
private void handHolding(){
105-
HandHoldingClassifier xgBoostClassifier = new HandHoldingClassifier();
106-
HandHoldingRecognizer handHoldingRecognizer = new HandHoldingRecognizer(xgBoostClassifier, new MyCallback());
105+
HandHoldingClassifier classifier = new HandHoldingClassifier();
106+
HandHoldingRecognizer handHoldingRecognizer = new HandHoldingRecognizer(classifier, new MyCallback());
107107
handHoldingRecognizer.setSamplingInterval(20);
108108
handHoldingRecognizer.addSensorType(Sensor.TYPE_GAME_ROTATION_VECTOR);
109109
DataScientistAPI.addRecognizer(handHoldingRecognizer);

Android/gradle.properties

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
# Project-wide Gradle settings.
2-
3-
# IDE (e.g. Android Studio) users:
4-
# Gradle settings configured through the IDE *will override*
5-
# any settings specified in this file.
6-
1+
## Project-wide Gradle settings.
2+
#
73
# For more details on how to configure your build environment visit
84
# http://www.gradle.org/docs/current/userguide/build_environment.html
9-
5+
#
106
# Specifies the JVM arguments used for the daemon process.
117
# The setting is particularly useful for tweaking memory settings.
12-
org.gradle.jvmargs=-Xmx1536m
13-
8+
# Default value: -Xmx1024m -XX:MaxPermSize=256m
9+
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10+
#
1411
# When configured, Gradle will run in incubating parallel mode.
1512
# This option should only be used with decoupled projects. More details, visit
1613
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1714
# org.gradle.parallel=true
15+
#Mon Dec 11 17:40:25 CST 2017
16+
systemProp.http.proxyHost=127.0.0.1
17+
org.gradle.jvmargs=-Xmx1536m
18+
systemProp.http.proxyPort=8090

Android/lib-Myna/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 25
5-
buildToolsVersion '25.0.3'
4+
compileSdkVersion 27
5+
buildToolsVersion '27.0.3'
66

77
defaultConfig {
88
minSdkVersion 14
@@ -19,6 +19,6 @@ android {
1919
}
2020

2121
dependencies {
22-
compile 'org.tensorflow:tensorflow-android:1.2.0'
23-
provided 'com.google.android.gms:play-services-awareness:11.0.2'
22+
compile 'org.tensorflow:tensorflow-android:1.6.0'
23+
provided 'com.google.android.gms:play-services-awareness:11.8.0'
2424
}
3.16 KB
Binary file not shown.

Android/lib-Myna/src/main/java/com/talkingdata/myna/MynaService.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ public void run() {
189189
}
190190
recognizer.dataSet[recognizer.getSamplingPointCount() / 2 + recognizer.dataSetIndex] = new SensorData();
191191
recognizer.dataSet[recognizer.getSamplingPointCount() / 2 + recognizer.dataSetIndex].clone(latestSampledData);
192-
recognizer.dataSet[recognizer.dataSetIndex].timestamp = System.currentTimeMillis();
193-
Utils.calculateWorldAcce(recognizer.dataSet[recognizer.dataSetIndex]);
192+
recognizer.dataSet[recognizer.getSamplingPointCount() / 2 + recognizer.dataSetIndex].timestamp = System.currentTimeMillis();
193+
Utils.calculateWorldAcce(recognizer.dataSet[recognizer.getSamplingPointCount() / 2 + recognizer.dataSetIndex]);
194194
if (recognizer.dataSetIndex == recognizer.getSamplingPointCount() / 2 - 1) {
195195
try {
196196
recognizer.recognitionHandler.post(new Runnable() {

README.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Android 平台情景感知框架
66

77

88
![](images/myna.png)
9-
9+
1010

1111
Myna 项目中包含一个测试 Demo 工程:demo-myna, 将该工程和 Myna 项目本身导入到 Android Studio 中,就可以开始调试了。
1212

@@ -17,16 +17,17 @@ Myna 提供了两套接口:
1717

1818
## 更新 2017-07-12
1919

20-
- 支持下面五种行为类型
20+
- 支持下面 6 种行为类型
2121
1. Walking
2222
2. Running
2323
3. Bus
2424
4. Subway
2525
5. Car
2626
6. Stationary
2727
- 新增 XGBoost 和基于 Tensorflow 的 LSTM 分类模型。
28-
1. `Dataset` 目录下有数据集下载链接、数据处理脚本和 XGBoost 模型训练脚本。
29-
2. 使用 LSTM 模型需要时需要提供训练好的模型和 Tensorflow 的动态库以及 Java Interface 包。Tensorflow 官方已经提供了通过 `AAR` 格式依赖 Tensorflow 动态库和 interface 的方法,Myna 已经更新使用该方式。具体请参考:[Android TensorFlow support](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/android/README.md)。LSTM 预训练模型位于测试工程的 `assets` 目录下。由于训练数据量不够,该模型的准确率较低,仅可用于 End2End 方案验证,请勿用于生产环境。
28+
1. `Dataset` 目录下有数据集下载链接、数据处理脚本和 XGBoost 模型训练脚本。
29+
2. 使用 LSTM 模型需要时需要提供训练好的模型和 Tensorflow 的动态库以及 Java Interface 包。Tensorflow 官方已经提供了通过 `AAR` 格式依赖 Tensorflow 动态库和 interface 的方法,Myna 已经更新使用该方式。具体请参考:[Android TensorFlow support](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/android/README.md)。LSTM 预训练模型位于测试工程的 `assets` 目录下。由于训练数据量不够,该模型的准确率较低,仅可用于 End2End 方案验证,请勿用于生产环境。
30+
- 增加手持状态检测。
3031

3132
Myna 使用随机森林分类算法的一种开源实现--**Dice** 进行的实时用户行为识别:
3233

@@ -72,7 +73,7 @@ ROC:
7273
开源协议: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
7374

7475
Copyright 2016 TalkingData
75-
76+
7677
Licensed under the Apache License, Version 2.0 (the "License");
7778
you may not use this file except in compliance with the License.
7879
You may obtain a copy of the License at

0 commit comments

Comments
 (0)