Skip to content
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 56 commits into from
May 6, 2022
Merged

Conversation

tfiedlerdev
Copy link
Contributor

Closes #162
The user can now add new use cases via the usecasedialog:
image

Closes #163
The user can now enable an on device training screen, which also displays a summary of recordings in the selected subdir of the current usecase
image

Foundation for #161

tfiedlerdev and others added 30 commits April 22, 2022 08:42
…device-training-screen

# Conflicts:
#	app/src/main/java/sensors_in_paradise/sonar/MainActivity.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/RecordingMetadataStorage.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/labels_editor/ClickableCarouselTextView.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/labels_editor/EditableRecording.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/labels_editor/IntervalLooper.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/labels_editor/ItemClickableMotionLayout.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/labels_editor/LabelTouchListener.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/labels_editor/LabelsEditorDialog.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/labels_editor/VideoViewHolder.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/labels_editor/VisualSequenceViewHolder.kt
…g-screen

# Conflicts:
#	app/src/main/java/sensors_in_paradise/sonar/GlobalValues.kt
#	app/src/main/java/sensors_in_paradise/sonar/JSONStorage.kt
#	app/src/main/java/sensors_in_paradise/sonar/MainActivity.kt
#	app/src/main/java/sensors_in_paradise/sonar/PageInterface.kt
#	app/src/main/java/sensors_in_paradise/sonar/page2/RecordingDataManager.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_prediction/PredictionScreen.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/RecordingScreen.kt
…o 161-support-multiple-models

# Conflicts:
#	app/src/main/java/sensors_in_paradise/sonar/util/use_cases/UseCaseDialog.kt
…g-screen

# Conflicts:
#	app/src/main/java/sensors_in_paradise/sonar/MainActivity.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/RecordingScreen.kt
treyfel and others added 13 commits April 29, 2022 14:11
# Conflicts:
#	app/build.gradle
#	app/src/main/java/sensors_in_paradise/sonar/GlobalValues.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/CameraManager.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/RecordingScreen.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/CameraManager.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/pose_estimation/ImageProcessor.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/pose_estimation/MoveNet.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/pose_estimation/PoseDetector.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/pose_estimation/PoseEstimationStorageManager.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/pose_estimation/VisualizationUtils.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/pose_estimation/data/BodyPart.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/pose_estimation/data/Device.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/pose_estimation/data/KeyPoint.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/pose_estimation/data/Person.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/pose_estimation/data/PoseSequence.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/camera/pose_estimation/data/TorsoAndBodyDistance.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/labels_editor/LabelsEditorDialog.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/labels_editor/PoseSequenceViewHolder.kt
#	app/src/main/java/sensors_in_paradise/sonar/screen_recording/labels_editor/VisualSequenceViewHolder.kt
@tfiedlerdev tfiedlerdev requested a review from lucasliebe May 4, 2022 14:08
Copy link
Contributor

@lucasliebe lucasliebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review my comments, then I will make another review after being re-requested

Some are not necessary to change if there are arguments for it but all should definitely be looked at

@@ -90,5 +64,29 @@ class GlobalValues private constructor() {

return minutes.toString().padStart(2, '0') + ":" + seconds.toString().padStart(2, '0')
}
fun getMacAddress(): String {
Copy link
Contributor

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

Copy link
Contributor Author

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

@@ -217,17 +206,38 @@ class Page3Handler(
predictionButton = activity.findViewById(R.id.button_start_predict)
progressBar = activity.findViewById(R.id.progressBar_nextPrediction_predictionFragment)
predictionButton.setOnClickListener {
togglePrediction()
if (currentUseCase.getModelFile().exists()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you can use the function initModelFromUseCase with boolean return value to prevent a double check of the file


class TFLiteModel(tfLiteModelFile: File, inputShape: IntArray, outputSize: Int) {
private val outputs = arrayOf(FloatArray(outputSize))
// TODO replace interpreter in PredictionScreen by this wrapper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please dont leave todos in commits that will get into the master branch rather turn them into issues

This seems to be done anyway

override fun onJSONInitialized() {
}

/*fun duplicateUseCaseData(originalTitle: String, duplicateTitle: String){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please no unused uncommented functions ;)

)
}

val dataSet = PieDataSet(entries, "Election Results")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Election results?

return subDirs
}

fun saveModelFromBuffer(buffer: MappedByteBuffer) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused?

@tfiedlerdev tfiedlerdev requested a review from lucasliebe May 5, 2022 13:26
Copy link
Contributor

@lucasliebe lucasliebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this pr now can be merged from my perspective

just make sure we have an old working branch for the lab please! (ask alex before pressing the green button)

Copy link
Contributor

@lucasliebe lucasliebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just found a bug!

When you just start the app, record some sensors and start a recording without caring about use cases the app crashes.

@tfiedlerdev tfiedlerdev requested a review from lucasliebe May 6, 2022 08:34
@tfiedlerdev tfiedlerdev merged commit 5597c0d into master May 6, 2022
@tfiedlerdev tfiedlerdev deleted the 162-prepare-on-device-training branch May 6, 2022 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On device training screen Prepare on device training
3 participants