Skip to main content
universidade lusófona
Outcomes

Software

 


LMA classification of  humanoid model (fbx) dancing

Unity3d and python project invoking machine learning model 

 

Download zip file here

Install:
Inside "projetoML/img" are images that explain more in dept about the installation.
1. Open the folder "projetoML", right click on an empty space, more options, open in terminal (or type cmd in the bar above)
2. Make sure the directory ends in "SendBonesToML\projetoML> "
3. Type "where python" to make sure its installed (version 3.11 does not work)
4. Type "python -m venv myvenv" (If there are more than 1 python versions installed, type the full directory to the desired python.exe)
5. Type "python -m pip install --upgrade pip"
6. Type "pip install -r requirements.txt"
7. Close cmd, navigate to "projetoML\src", open "predict.py" in editor, scroll all the way down, modify the directory of file_name_in (where bone data will be written) and file_name_out (where class predictions will be written). I recommend creating these json files inside the Assets folder of the project in Unity.
8. Run "run.bat" file. Should be working now. After installed, its only needed to run "run.bat" to open the ML
There is also a file simulate.py that generates random bone values into a json, for testing.

Execution:

1. Open scene in Unity with the FBX, import "BoneDataSender.cs" into it
2. Add BoneDataSender as a component to the model
3. Assign the FBX bones to Xsens bones (assign bones with the same order as they appear in the dropdown, the order must be the same) (FBX models usually only have 2 bones at the torso, hips and chest. If needed, add an empty gameobject son of the hips and place it between the chest and hips to fulfill the missing bone convertion)
4. Make sure the json files exists and that the ML is reading from its directory.
5. Run the file "run.bat" to start the ML, when it gives a classification and stops, its ready
6. Play the scene in Unity, then check SendData to start sending information (Theres 3 dots at the right of the name of the component, with a function to automatically stop and empty the json file)