New basic signs model

This commit is contained in:
Jerome Coudron
2023-05-07 21:00:52 +00:00
committed by Jelle De Geest
parent 06aa9206ac
commit 43887af670
111 changed files with 952 additions and 329 deletions

View File

@@ -420,38 +420,36 @@ public class CoursesController : AbstractFeedback
currentSign != null && signPredictor.learnableProbabilities.ContainsKey(currentSign))
{
//Debug.Log($"{signPredictor.learnableProbabilities.Aggregate("", (t, e) => $"{t}{e.Key}={e.Value}, ")}");
float accCurrentSign = signPredictor.learnableProbabilities[currentSign];
float distCurrentSign = signPredictor.learnableProbabilities[currentSign];
// Get highest predicted sign
string predictedSign = signPredictor.learnableProbabilities.Aggregate((a, b) => a.Value > b.Value ? a : b).Key;
float accPredictSign = signPredictor.learnableProbabilities[predictedSign];
string predictedSign = signPredictor.learnableProbabilities.Aggregate((a, b) => a.Value < b.Value ? a : b).Key;
float distPredictSign = signPredictor.learnableProbabilities[predictedSign];
Learnable predSign = course.theme.learnables.Find(l => l.name.ToUpper().Replace(" ", "-") == predictedSign);
// If there is a feedback-object, we wil change its appearance
if (feedbackText != null && feedbackProgressImage != null)
{
Color col;
if (accCurrentSign > sign.thresholdPercentage)
if (distCurrentSign < sign.thresholdDistance)
{
feedbackText.text = "Goed";
col = new Color(0x8b / 255.0f, 0xd4 / 255.0f, 0x5e / 255.0f);
}
else if (accCurrentSign > 0.9 * sign.thresholdPercentage)
else if (distCurrentSign < 1.5 * sign.thresholdDistance)
{
feedbackText.text = "Bijna";
col = new Color(0xf2 / 255.0f, 0x7f / 255.0f, 0x0c / 255.0f);
}
else if (accPredictSign > predSign.thresholdPercentage)
else if (distPredictSign < predSign.thresholdDistance)
{
feedbackText.text = $"Verkeerde gebaar: '{predSign.name}'";
col = new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f);
accCurrentSign = 0.0f;
}
else
{
feedbackText.text = $"Detecteren ...";
col = new Color(0xf5 / 255.0f, 0x49 / 255.0f, 0x3d / 255.0f);
//accCurrentSign = 0.0f;
}
feedbackText.color = col;
@@ -459,8 +457,8 @@ public class CoursesController : AbstractFeedback
// Tween the feedback-bar
float oldValue = feedbackProgress.value;
// use an exponential scale
float newValue = Mathf.Exp(4 * (Mathf.Clamp(accCurrentSign / sign.thresholdPercentage, 0.0f, 1.0f) - 1.0f));
float newValue = 1 - Mathf.Clamp(distCurrentSign - sign.thresholdDistance, 0.0f, 3.0f) / 3;
feedbackProgress.gameObject.Tween("FeedbackUpdate", oldValue, newValue, 0.2f, TweenScaleFunctions.CubicEaseInOut, (t) =>
{
if (feedbackProgress != null)
@@ -471,7 +469,7 @@ public class CoursesController : AbstractFeedback
}
// The internal logic for the courses
if (accPredictSign > sign.thresholdPercentage)
if (distPredictSign < sign.thresholdDistance)
{
// Correct sign
if (predictedSign == currentSign)