Tested new implementation for models
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
"name": "InterfacesScripts",
|
"name": "InterfacesScripts",
|
||||||
"rootNamespace": "",
|
"rootNamespace": "",
|
||||||
"references": [
|
"references": [
|
||||||
"GUID:5c2b5ba89f9e74e418232e154bc5cc7a"
|
"GUID:5c2b5ba89f9e74e418232e154bc5cc7a",
|
||||||
|
"GUID:d0b6b39a21908f94fbbd9f2c196a9725"
|
||||||
],
|
],
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ public class Theme : ScriptableObject
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public NNModel model;
|
public NNModel model;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The index of the model you want to use
|
||||||
|
/// </summary>
|
||||||
|
public ModelIndex modelIndex;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of all learnable words/letters
|
/// List of all learnable words/letters
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ MonoBehaviour:
|
|||||||
description: Van vis tot leeuw
|
description: Van vis tot leeuw
|
||||||
index: 2
|
index: 2
|
||||||
model: {fileID: 0}
|
model: {fileID: 0}
|
||||||
|
modelIndex: 1
|
||||||
learnables:
|
learnables:
|
||||||
- name: Walvis
|
- name: Walvis
|
||||||
image: {fileID: 21300000, guid: 2b01165a5836ab14593d7a5862bd6793, type: 3}
|
image: {fileID: 21300000, guid: 2b01165a5836ab14593d7a5862bd6793, type: 3}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ MonoBehaviour:
|
|||||||
title: Kleren en Kleuren
|
title: Kleren en Kleuren
|
||||||
description: Van rok tot sok
|
description: Van rok tot sok
|
||||||
index: 1
|
index: 1
|
||||||
|
model: {fileID: 0}
|
||||||
|
modelIndex: 1
|
||||||
learnables:
|
learnables:
|
||||||
- name: Blauw
|
- name: Blauw
|
||||||
image: {fileID: 21300000, guid: 182fb89eba9c64041bef31ca35c4bcd8, type: 3}
|
image: {fileID: 21300000, guid: 182fb89eba9c64041bef31ca35c4bcd8, type: 3}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ MonoBehaviour:
|
|||||||
title: Familie
|
title: Familie
|
||||||
description: Van generatie tot generatie
|
description: Van generatie tot generatie
|
||||||
index: 6
|
index: 6
|
||||||
|
model: {fileID: 0}
|
||||||
|
modelIndex: 1
|
||||||
learnables:
|
learnables:
|
||||||
- name: Broer
|
- name: Broer
|
||||||
image: {fileID: 21300000, guid: eecf67266f150f1489717049489cf16d, type: 3}
|
image: {fileID: 21300000, guid: eecf67266f150f1489717049489cf16d, type: 3}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ MonoBehaviour:
|
|||||||
description: Van kers tot pompoen
|
description: Van kers tot pompoen
|
||||||
index: 3
|
index: 3
|
||||||
model: {fileID: 0}
|
model: {fileID: 0}
|
||||||
|
modelIndex: 1
|
||||||
learnables:
|
learnables:
|
||||||
- name: Aardappel
|
- name: Aardappel
|
||||||
image: {fileID: 21300000, guid: 2610cdbc24a125f43ada7fed67d8f51b, type: 3}
|
image: {fileID: 21300000, guid: 2610cdbc24a125f43ada7fed67d8f51b, type: 3}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ MonoBehaviour:
|
|||||||
title: Hobbies
|
title: Hobbies
|
||||||
description: Van schilderen tot reizen
|
description: Van schilderen tot reizen
|
||||||
index: 4
|
index: 4
|
||||||
|
model: {fileID: 0}
|
||||||
|
modelIndex: 1
|
||||||
learnables:
|
learnables:
|
||||||
- name: Dansen
|
- name: Dansen
|
||||||
image: {fileID: 21300000, guid: 6d405f607ae817744b49f921f0611088, type: 3}
|
image: {fileID: 21300000, guid: 6d405f607ae817744b49f921f0611088, type: 3}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ MonoBehaviour:
|
|||||||
title: Huis beschrijven
|
title: Huis beschrijven
|
||||||
description: Van zetel tot villa
|
description: Van zetel tot villa
|
||||||
index: 5
|
index: 5
|
||||||
|
model: {fileID: 0}
|
||||||
|
modelIndex: 1
|
||||||
learnables:
|
learnables:
|
||||||
- name: Keuken
|
- name: Keuken
|
||||||
image: {fileID: 21300000, guid: b17ce5bf59092b847b084d3400e7a1b4, type: 3}
|
image: {fileID: 21300000, guid: b17ce5bf59092b847b084d3400e7a1b4, type: 3}
|
||||||
|
|||||||
@@ -1301,6 +1301,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 043ccd99cf82b3cc9bf2e00956ce2b93, type: 3}
|
m_Script: {fileID: 11500000, guid: 043ccd99cf82b3cc9bf2e00956ce2b93, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
modelList: {fileID: 11400000, guid: 39516e4e6e56f0f4f80647d9c4d8034c, type: 2}
|
||||||
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
||||||
modelInfoFile: {fileID: 4900000, guid: fb8b51022bdcd654a9f29c054832a1b5, type: 3}
|
modelInfoFile: {fileID: 4900000, guid: fb8b51022bdcd654a9f29c054832a1b5, type: 3}
|
||||||
configAsset: {fileID: 4900000, guid: 6288c43cdca97374782dac1ea87aa029, type: 3}
|
configAsset: {fileID: 4900000, guid: 6288c43cdca97374782dac1ea87aa029, type: 3}
|
||||||
|
|||||||
@@ -128,13 +128,16 @@ public class TemplateCourse : MonoBehaviour
|
|||||||
{
|
{
|
||||||
// Setting up course
|
// Setting up course
|
||||||
course = courselist.courses[courselist.currentCourseIndex];
|
course = courselist.courses[courselist.currentCourseIndex];
|
||||||
feedback.signPredictor.model = course.theme.model;
|
//feedback.signPredictor.model = course.theme.model;
|
||||||
|
feedback.signPredictor.modelList.SetCurrentModel(course.theme.modelIndex);
|
||||||
|
//feedback.signPredictor.model = feedback.signPredictor.modelList.models[feedback.signPredictor.modelList.currentModelIndex].model;
|
||||||
maxWords = course.theme.learnables.Count;
|
maxWords = course.theme.learnables.Count;
|
||||||
|
|
||||||
// vvv TEMPORARY STUFF vvv
|
// vvv TEMPORARY STUFF vvv
|
||||||
feedbackProgressBar.SetActive(course.theme.model != null);
|
feedbackProgressBar.SetActive(course.theme.model != null);
|
||||||
previewMessage.SetActive(course.theme.model == null);
|
previewMessage.SetActive(course.theme.model == null);
|
||||||
feedback.signPredictor.model = previewModel;
|
// Instead, the NONE-modelIndex points to Fingerspelling, which gives the same result
|
||||||
|
//feedback.signPredictor.model = previewModel;
|
||||||
// ^^^ TEMPORARY STUFF ^^^
|
// ^^^ TEMPORARY STUFF ^^^
|
||||||
|
|
||||||
// Create entry in current user for keeping track of progress
|
// Create entry in current user for keeping track of progress
|
||||||
|
|||||||
@@ -6245,6 +6245,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 043ccd99cf82b3cc9bf2e00956ce2b93, type: 3}
|
m_Script: {fileID: 11500000, guid: 043ccd99cf82b3cc9bf2e00956ce2b93, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
modelList: {fileID: 11400000, guid: 39516e4e6e56f0f4f80647d9c4d8034c, type: 2}
|
||||||
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
||||||
modelInfoFile: {fileID: 4900000, guid: fb8b51022bdcd654a9f29c054832a1b5, type: 3}
|
modelInfoFile: {fileID: 4900000, guid: fb8b51022bdcd654a9f29c054832a1b5, type: 3}
|
||||||
configAsset: {fileID: 4900000, guid: 6288c43cdca97374782dac1ea87aa029, type: 3}
|
configAsset: {fileID: 4900000, guid: 6288c43cdca97374782dac1ea87aa029, type: 3}
|
||||||
|
|||||||
@@ -241,6 +241,9 @@ public class HangmanGameController : MonoBehaviour
|
|||||||
}
|
}
|
||||||
userList.Save();
|
userList.Save();
|
||||||
|
|
||||||
|
// Hangman always uses fingerspelling
|
||||||
|
feedback.signPredictor.model = feedback.signPredictor.modelList.GetModelByIndex(ModelIndex.FINGERSPELLING);
|
||||||
|
|
||||||
// Set calllbacks
|
// Set calllbacks
|
||||||
feedback.getSignCallback = () =>
|
feedback.getSignCallback = () =>
|
||||||
{
|
{
|
||||||
|
|||||||
8
Assets/MediaPipeUnity/ScriptableObjects.meta
Normal file
8
Assets/MediaPipeUnity/ScriptableObjects.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 438a3ced42dd6fc4ab38e3a16c1e43a7
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
20
Assets/MediaPipeUnity/ScriptableObjects/ModelList.asset
Normal file
20
Assets/MediaPipeUnity/ScriptableObjects/ModelList.asset
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
%YAML 1.1
|
||||||
|
%TAG !u! tag:unity3d.com,2011:
|
||||||
|
--- !u!114 &11400000
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 0}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 78a3f61c93a08c04496c49ffd10b9021, type: 3}
|
||||||
|
m_Name: ModelList
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
currentModelIndex: 0
|
||||||
|
models:
|
||||||
|
- index: 0
|
||||||
|
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
||||||
|
- index: 1
|
||||||
|
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 39516e4e6e56f0f4f80647d9c4d8034c
|
||||||
|
NativeFormatImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
mainObjectFileID: 11400000
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
9
Assets/MediaPipeUnity/Scripts/ModelIndex.cs
Normal file
9
Assets/MediaPipeUnity/Scripts/ModelIndex.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public enum ModelIndex
|
||||||
|
{
|
||||||
|
FINGERSPELLING,
|
||||||
|
NONE
|
||||||
|
}
|
||||||
11
Assets/MediaPipeUnity/Scripts/ModelIndex.cs.meta
Normal file
11
Assets/MediaPipeUnity/Scripts/ModelIndex.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6dbd5e1100bc81648b52206df369d0a1
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
39
Assets/MediaPipeUnity/Scripts/ModelList.cs
Normal file
39
Assets/MediaPipeUnity/Scripts/ModelList.cs
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
using Unity.Barracuda;
|
||||||
|
/// <summary>
|
||||||
|
/// This scriptable will hold tupples of Courseindices and models
|
||||||
|
/// </summary>
|
||||||
|
[CreateAssetMenu(menuName = "Create new Scriptable/ModelList")]
|
||||||
|
public class ModelList : ScriptableObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Index of the currently active model
|
||||||
|
/// </summary>
|
||||||
|
public int currentModelIndex = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A list of all the models
|
||||||
|
/// </summary>
|
||||||
|
public List<ModelTuple> models = new List<ModelTuple>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get a model by modelindex
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="modelIndex">ModelIndex of the model</param>
|
||||||
|
/// <returns>Model associated with this index, null if no model was found</returns>
|
||||||
|
public NNModel GetModelByIndex(ModelIndex modelIndex)
|
||||||
|
{
|
||||||
|
return models.Find((m) => m.index == modelIndex).model;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Function to find a model-index in the list based on its index
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="title"></param>
|
||||||
|
public void SetCurrentModel(ModelIndex index)
|
||||||
|
{
|
||||||
|
currentModelIndex = models.FindIndex((m) => m.index == index);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Assets/MediaPipeUnity/Scripts/ModelList.cs.meta
Normal file
11
Assets/MediaPipeUnity/Scripts/ModelList.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 78a3f61c93a08c04496c49ffd10b9021
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
18
Assets/MediaPipeUnity/Scripts/ModelTuple.cs
Normal file
18
Assets/MediaPipeUnity/Scripts/ModelTuple.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
using Unity.Barracuda;
|
||||||
|
/// <summary>
|
||||||
|
/// Small class to link a model to a courseIndex irrespective of its position in a list
|
||||||
|
/// </summary>
|
||||||
|
[Serializable]
|
||||||
|
public class ModelTuple
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ModelIndex to which the model corresponds
|
||||||
|
/// </summary>
|
||||||
|
public ModelIndex index;
|
||||||
|
/// <summary>
|
||||||
|
/// The model itself
|
||||||
|
/// </summary>
|
||||||
|
public NNModel model;
|
||||||
|
}
|
||||||
11
Assets/MediaPipeUnity/Scripts/ModelTuple.cs.meta
Normal file
11
Assets/MediaPipeUnity/Scripts/ModelTuple.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bce8507dcb30db447b69708ad4f5f962
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -18,6 +18,9 @@ namespace Mediapipe.Unity.Tutorial
|
|||||||
{
|
{
|
||||||
public class SignPredictor : MonoBehaviour
|
public class SignPredictor : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public ModelList modelList;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reference to the model used in the SignPredictor
|
/// Reference to the model used in the SignPredictor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -3900,6 +3900,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: 043ccd99cf82b3cc9bf2e00956ce2b93, type: 3}
|
m_Script: {fileID: 11500000, guid: 043ccd99cf82b3cc9bf2e00956ce2b93, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
|
modelList: {fileID: 11400000, guid: 39516e4e6e56f0f4f80647d9c4d8034c, type: 2}
|
||||||
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
model: {fileID: 5022602860645237092, guid: e6d85df707405ad4f97c23b07227ee99, type: 3}
|
||||||
modelInfoFile: {fileID: 4900000, guid: fb8b51022bdcd654a9f29c054832a1b5, type: 3}
|
modelInfoFile: {fileID: 4900000, guid: fb8b51022bdcd654a9f29c054832a1b5, type: 3}
|
||||||
configAsset: {fileID: 4900000, guid: 6288c43cdca97374782dac1ea87aa029, type: 3}
|
configAsset: {fileID: 4900000, guid: 6288c43cdca97374782dac1ea87aa029, type: 3}
|
||||||
|
|||||||
@@ -182,7 +182,8 @@ public partial class GameController : MonoBehaviour
|
|||||||
userList.Save();
|
userList.Save();
|
||||||
|
|
||||||
currentTheme = minigame.themeList.themes[minigame.themeList.currentThemeIndex];
|
currentTheme = minigame.themeList.themes[minigame.themeList.currentThemeIndex];
|
||||||
feedback.signPredictor.model = currentTheme.model;
|
//feedback.signPredictor.model = currentTheme.model;
|
||||||
|
feedback.signPredictor.model = feedback.signPredictor.modelList.GetModelByIndex(currentTheme.modelIndex);
|
||||||
words.AddRange(currentTheme.learnables);
|
words.AddRange(currentTheme.learnables);
|
||||||
ShuffleWords();
|
ShuffleWords();
|
||||||
NextWord();
|
NextWord();
|
||||||
|
|||||||
Reference in New Issue
Block a user