MCJ's Neural Nets Now With Mac Version



________________________________________________________________________
Introduction
________________________________________________________________________

This is a kit of software ( server app + daz script ) allowing you to animate objects and figures in the Daz Studio scene using shallow trained neural network. It also lets you train the neural networks based on the property values of those objects and figures.

The neural network code is a slightly modified version of TINN by Gustav Louw
https://github.com/glouw/tinn

It's a single-layered-neural-network and seems to require normalized input/output values

The PC version was posted in March 2019

April 7th 2019 Mac Version released!!!

the Mac Client Script
MCJNEURALNETCONSOLEMAC0407190652PM.DSA

and

The Mac 64bit .exe Tinn Neural Net Application Server/Worker/Service
MCJTINNSERVERMAC0407190652PM.ZIP

Later i will convert all this into a genuine Daz Studio plugin

and eventually this spring/summer will implement a deep neural net ( maybe with GPU support !)



in this image, in pink-magenta, the perfect trajectory of the finger in function of the target position
in blue the solution provided by the A.I.
________________________________________________________________________

Installation
________________________________________________________________________

1 - install the neural net server ( or service if you will )

download mcjTinnServer64bitv003.exe it and place it it a folder that allows execution launched by Daz Studio. 

the file can be found at the bottom of this page in the attachments section

Note: i distribute the .exe inside a .zip file in the hope that your browser or PC wont paranoiacly refuse to download it

April 7th 2019 Mac Version released!!!

the Mac Client Script
MCJNEURALNETCONSOLEMAC0407190652PM.DSA 


2 - install the neural net client 

download mcjNeuralNetConsole.zip and unZip it in one of your Daz Studio Format Content Folders

for example : C:\Users\YOURUSERNAMEHERE\Documents\DAZ 3D\Studio\My Library

once unzipped the script mcjNeuralNetConsole.dsa should appear in 

Daz Studio Format / Scripts / mcasual

April 7th 2019 Mac Version released!!!
The Mac 64bit .exe Tinn Neural Net Application Server/Worker/Service
MCJTINNSERVERMAC0407190652PM.ZIP


________________________________________________________________________
Version History
________________________________________________________________________
April 7th 2019 7PM = Release of MAC server .exe and MAC client script
March 26th 2019 7:08PM - Release server v1 script v1
March 26th 2019 7:28PM - Release  script v2 - added the web-help functionality, fixed problem with buttons



________________________________________________________________________
Theory
________________________________________________________________________

what's a neural network for newbies by a newbie

you have a set of input values, numbers

and another set of output values, also numbers

you present hundreds of examples of input/output values
to the neural network 

the neural net is now an expert
at giving you output values for any given input values

in our example, the input values are the positions of a moving target ( a null node named mark ) in Gabrielle's personal space ( meaning the target is parented to Gabrielle's hip joint ) and the output values are Gabrielle's shoulder and foreArm joints rotation angles


________________________________________________________________________
Instructions
________________________________________________________________________

----------------------------------------------------------------------------------------------------------------------------------------------
select all the nodes that produce your input/output values
----------------------------------------------------------------------------------------------------------------------------------------------

in our example, 
- Gab's rShoulder  joint
- Gab's rForeArm joint, 
- A special node named Vernier* 
- The target node named mark 

the vernier creator script may eventually be published on this site

----------------------------------------------------------------------------------------------------------------------------------------------
launch the mcjNeuralNetConsole script
----------------------------------------------------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------------------------------------------------
Specify which NeuralNet server/service will do the maths
----------------------------------------------------------------------------------------------------------------------------------------------

for this software kit, the computations are done in an external app named mcjTinnServer. Which you should have installed by now since you did not skip past the "installation" section of this web page. Click on the [Select NeuralNet Server] button and select mcjTinnServer in your download folder. This only needs to be done one time, the script will remember the location.

----------------------------------------------------------------------------------------------------------------------------------------------
Build your lists of Inputs / Outputs
----------------------------------------------------------------------------------------------------------------------------------------------

from the list of selected nodes, i  selected Gabrielle's rShoulder joint

all of Gabrielle's rShoulder properties appeared in the ListBox titled "channels"

there's 3 checkboxes that let you hide/show morphs, hidden properties or non-transforms properties

so i selected in turn the xRotate, yRotate and zRotate properties of the rShoulder joint

and added them to the output list using the [Add Output] button

then i selected the rForeArm joint and added the yRotate( bend) property to the outputs list

then i selected the target/mark, and added it's x, y and zTranslate properties to the inputs list

note that since the marker is parented to Gabrielle's hip bone so those are relative coordinates

and added them to the input list using the [Add Intput] button


Saving/retrieving your Input/Output selections

using the [Save I/O Selection] button you can save the contents of your input/output lists in a text file

Next time you run the script, you can recall this selection, as long as it's the same scene with the same nodes

----------------------------------------------------------------------------------------------------------------------------------------------
Creating the NeuralNetwork
----------------------------------------------------------------------------------------------------------------------------------------------
in the field named "Num Hidden Layer Nodes" enter the number of hidden layer nodes, example: 100
i suppose a larger number of nodes lets the NeuralNet solve problems that are more complex
Click the  [Create NeuralNet for listed IOs] button
the script will start/run the NeuralNet server/service ( invisible on-screen but visible in task-manager )
the initial neural net has the same number of inputs and outputs as your Input/Output lists specify.

----------------------------------------------------------------------------------------------------------------------------------------------
Training the Neural Network - 
----------------------------------------------------------------------------------------------------------------------------------------------
1 - We need training data 
----------------------------------------------------------------------------------------------------------------------------------------------
The A.I. is untrained, it's an Artificial Idiot. It will give you totally random outputs for whatever inputs you give. You need to show it examples of what intelligent outputs look like.

In my example, i used mcjAutoLimb2015 to animate the arm over a 200 frames range, 

The index finger tracks the position of the marker/target, so the rotations of the rShoulder and the rForeArm are intelligent output values for the 200 positions of the target/marker

So i specify that the timerange for the training data is the timelin "playRange" i.e. frames 0 to 199

I click the [Save IO Animation as training data] button and save it as vernierTraining.data


Note: contrary to Gustav Louw's Tinn training files, 
the first line specifies the number of inputs and outputs


----------------------------------------------------------------------------------------------------------------------------------------------
2 - The data does the training
----------------------------------------------------------------------------------------------------------------------------------------------

in the Training Specs section of the script, you can specify the number of iterations, the number of times the A.I. will use and re-use your 200 ( or more or less ) training data samples. You can also specify a  training 'rate' and an annealing rate. But since i'm not familiar with that, you'll have to learn it or ball-park it. the default values for those is 1.0

Click the [Train NeuralNet from file] button

select the training data file you saved a moment ago

it will take a few seconds and the message in the log window will be TrnedTinn, OK


if a problem occurs it bay be because you used a training data file that was not created for the same number of inputs and outputs as what your Input/Output lists specify

----------------------------------------------------------------------------------------------------------------------------------------------
Saving/Retrieving your super intelligent A.I.
----------------------------------------------------------------------------------------------------------------------------------------------

Click the [Save NeuralNet to file(.data)] button

Later on if your Inputs and Output lists are compatible with this saved A.I. you can use the [Load NeuralNet from file] button to retrieve it



----------------------------------------------------------------------------------------------------------------------------------------------
Allow the A.I. to rule the world 
----------------------------------------------------------------------------------------------------------------------------------------------
Specify a range of frames to be processed, ex: the whole playrange

Click on the [Solve Animation Range Using NeuralNet] button

the script will transmit one by one the positions of the marker and the vernier reading to the trained neural network and apply the response to Gabrielle's rShoulder and rForeArm rotations

keep an eye on the log window, when all the frames of the animation will have been solved by the A.I. the message "completed task" will appear


________________________________________________________________________
License that came with Gustav Louw's Tinn Library at Github
________________________________________________________________________

MIT License
Copyright (c) 2018 Gustav Louw
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

________________________________________________________________________

// License for the script and mcjTinnServer.exe

________________________________________________________________________


// You can use this script freely for personal or commercial use.

// You may not sell, resell, sub-license or rent this script in any way.

// you may credit this script to mCasual/Jacques


// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,

// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES

// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND

// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT

// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,

// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR

// OTHER DEALINGS IN THE SOFTWARE.


__________________________________________


ċ
mCasual Jacques,
Mar 26, 2019, 4:08 PM
ċ
mcjNeuralNetConsole.zip
(63k)
mCasual Jacques,
Mar 26, 2019, 4:27 PM
ċ
mcjNeuralNetConsoleMac0407190652PM.dsa
(40k)
mCasual Jacques,
Apr 7, 2019, 4:21 PM
ċ
mcjTinnBrain64Bitv003.zip
(11k)
mCasual Jacques,
Mar 26, 2019, 4:00 PM
ċ
mcjTinnServerMAC0407190652PM.zip
(10k)
mCasual Jacques,
Apr 7, 2019, 4:22 PM
Comments