-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
162 prepare on device training #182
Merged
Merged
Changes from 55 commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
ea1a608
Add screen and tab for on device training
tfiedlerdev 9e78e2d
Make training screen optional
tfiedlerdev 74969fe
Prepare onDeviceTrainingScreen
tfiedlerdev cbb04c7
Merge branch '154-recording-label-editor-based-on-video' into 163-on-…
tfiedlerdev 14061c6
init useCases
treyfel 97b0c03
Populate on-device-training screen
tfiedlerdev b8080cf
further implements default useCase
treyfel 5778220
Add training history
tfiedlerdev 95e51ff
init useCases
treyfel 905dc9f
adds use case selection dialog and refactors global values
treyfel b53829b
Refactor activity labels storage
tfiedlerdev d4bb9c8
Merge remote-tracking branch 'origin/161-support-multiple-models' int…
tfiedlerdev facf4ba
make it work
treyfel ac3aad0
Merge remote-tracking branch 'origin/161-support-multiple-models' int…
tfiedlerdev 05abce1
makes use case dir
treyfel c9fc0f7
Improve
tfiedlerdev 5eff1f1
makes use case dir
treyfel 565a539
makes use case dir
treyfel 48dcfe2
Merge remote-tracking branch 'origin/161-support-multiple-models' int…
tfiedlerdev 0f931be
Satisfy @alexanderwischmann
tfiedlerdev 367f99b
Fix neutral button
tfiedlerdev f0a5bfb
remove unused imports
tfiedlerdev 5af744e
Merge branch '161-support-multiple-models' into 163-on-device-trainin…
tfiedlerdev 06ad5a5
makes use case recordings subDir
treyfel 6e41344
Merge remote-tracking branch 'origin/161-support-multiple-models' int…
treyfel 649db67
Merge branch '161-support-multiple-models' into 163-on-device-trainin…
tfiedlerdev 883562c
Satisfy Linter and resolve post merge problems
tfiedlerdev ac39d4d
Improve subdir logic
tfiedlerdev dcf2a71
makes use case recordings subDir persistent in use case storage
treyfel 7befa13
Adapt training screen to use case concept
tfiedlerdev d3bf041
creates first defaut use case on first app start
treyfel e23b27c
Merge remote-tracking branch 'origin/162-prepare-on-device-training' …
tfiedlerdev cb08f02
Fix bugs, improve UI
tfiedlerdev fd793e8
Fix bugs, improve UI
tfiedlerdev 4cdb19e
fix bugs and loads model from assets
treyfel 9775fcc
Merge remote-tracking branch 'origin/162-prepare-on-device-training' …
treyfel e9ff8b9
satisfy linter
treyfel 4a7be3d
satisfy linter
treyfel e848f79
Work on making use cases deletable and clonable
tfiedlerdev adbede8
Work on Use Case Dialog
tfiedlerdev bf7bcd1
Fix bugs in UseCaseDialog.kt and react to changes in use case sub dir…
tfiedlerdev a49a90d
Satisfy Linter (a bit)
tfiedlerdev 3572d04
refactors use case storage
treyfel 0599396
completes use case storage refactoring
treyfel a70b072
satisfy linter
treyfel 263f3e4
implements default(HAR) prediction
treyfel 2ce6eb2
Refactor
tfiedlerdev 3f2d58f
Refactor
tfiedlerdev f0a460b
Merge branch 'master' into 162-prepare-on-device-training
tfiedlerdev b1cbcb1
Satisfy linter, fix merge errors
tfiedlerdev 6b8741b
Improve layout
tfiedlerdev 66d3641
Remove global recordings subdir preference. It's now use case local
tfiedlerdev 88e02da
Remove unnecessary parameter
tfiedlerdev 2d8302b
Satisfy Chefe
tfiedlerdev 3778d8e
Satisfy Chefe even more
tfiedlerdev 42d221a
Fix bug
tfiedlerdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
app/src/androidTest/java/sensors_in_paradise/sonar/CategoryLabelsStorageTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package sensors_in_paradise.sonar | ||
|
||
import android.content.Context | ||
import android.util.Log | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import junit.framework.TestCase.* | ||
import org.junit.Before | ||
import org.junit.Test | ||
import sensors_in_paradise.sonar.screen_recording.CategoryItemStorage | ||
import java.io.File | ||
|
||
class CategoryLabelsStorageTest { | ||
private val appContext: Context = InstrumentationRegistry.getInstrumentation().targetContext | ||
private val baseDir = File(appContext.cacheDir, "RecordingsTest") | ||
|
||
@Before | ||
fun init() { | ||
baseDir.mkdir() | ||
} | ||
|
||
@Test | ||
fun testLoadDefaultData() { | ||
val file = baseDir.resolve("categoryLabels1.json") | ||
file.delete() | ||
val storage = CategoryItemStorage(file) | ||
Log.d( | ||
"CategoryLabelsStorageTest-testLoadDefaultData", | ||
"Storage after creation: ${storage.getJsonString(1)}" | ||
) | ||
|
||
for ((activity, category) in CategoryItemStorage.DEFAULT_ACTIVITIES) { | ||
Log.d( | ||
"CategoryLabelsStorageTest-testLoadDefaultData", | ||
"Asserting that activity $activity is added in category $category" | ||
) | ||
assertFalse(storage.isCategoryDeletable(category)) | ||
assertTrue(storage.isEntryAdded(activity, category)) | ||
assertTrue(storage.isEntryAdded(activity)) | ||
} | ||
file.delete() | ||
} | ||
|
||
@Test | ||
fun testSave() { | ||
val file = baseDir.resolve("categoryLabels2.json") | ||
file.delete() | ||
val storage = CategoryItemStorage(file) | ||
Log.d("CategoryLabelsStorageTest", "Storage after creation: ${storage.getJsonString(1)}") | ||
storage.addCategoryIfNotAdded("reinigung") | ||
Log.d( | ||
"CategoryLabelsStorageTest", | ||
"Storage after adding category: ${storage.getJsonString(1)}" | ||
) | ||
storage.addEntry("wischen", "reinigung", save = true) | ||
Log.d( | ||
"CategoryLabelsStorageTest", | ||
"Storage after adding entry: ${storage.getJsonString(1)}" | ||
) | ||
assertTrue(storage.isEntryAdded("wischen", "reinigung")) | ||
val storage2 = CategoryItemStorage(file) | ||
Log.d( | ||
"CategoryLabelsStorageTest", | ||
"Storage2 after loading from file: ${storage2.getJsonString(1)}" | ||
) | ||
assertTrue(storage2.isEntryAdded("wischen", "reinigung")) | ||
|
||
file.delete() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the Device Mac Address for On Device Training? What is the benefit?
I saw the usage but I am not entirely sure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get your point but I can imagine a situation where one would like to know on which device the model was trained and as it does no harm, I'd just keep it now