{"title": "Fast Neural Network Emulation of Dynamical Systems for Computer Animation", "book": "Advances in Neural Information Processing Systems", "page_first": 882, "page_last": 888, "abstract": null, "full_text": "Fast Neural Network Emulation of Dynamical \n\nSystems for Computer Animation \n\nRadek Grzeszczuk 1 \n\nDemetri Terzopoulos 2 \n\nGeoffrey Hinton 2 \n\n1  Intel Corporation \n\nMicrocomputer Research Lab \n2200 Mission College Blvd. \nSanta Clara, CA 95052, USA \n\n2  University of Toronto \n\nDepartment of Computer Science \n\n10 King's College Road \n\nToronto, ON  M5S 3H5, Canada \n\nAbstract \n\nComputer animation through the numerical simulation of physics-based \ngraphics  models offers  unsurpassed realism,  but  it can be computation(cid:173)\nally demanding. This paper demonstrates the possibility of replacing the \nnumerical simulation of nontrivial dynamic  models  with  a dramatically \nmore  efficient  \"NeuroAnimator\"  that  exploits  neural  networks.  Neu(cid:173)\nroAnimators  are  automatically  trained  off-line  to  emulate  physical  dy(cid:173)\nnamics through  the observation  of physics-based models in  action.  De(cid:173)\npending on  the model,  its  neural  network emulator can yield physically \nrealistic  animation  one  or  two  orders  of magnitude faster  than  conven(cid:173)\ntional  numerical simulation.  We  demonstrate NeuroAnimators for a va(cid:173)\nriety of physics-based models. \n\n1 \n\nIntroduction \n\nAnimation based on physical principles has been an influential trend in computer graphics \nfor  over a  decade  (see,  e.g.,  [1,  2,  3]).  This  is  not  only  due  to  the  unsurpassed  realism \nthat  physics-based  techniques  offer.  In  conjunction  with  suitable  control  and  constraint \nmechanisms,  physical  models  also  facilitate  the  production of copious quantities  of real(cid:173)\nistic  animation  in  a  highly  automated  fashion.  Physics-based  animation  techniques  are \nbeginning  to  find  their way  into  high-end commercial  systems.  However,  a  well-known \ndrawback has retarded their broader penetration--compared to geometric models, physical \nmodels typically entail formidable numerical simulation costs. \n\nThis paper proposes a new approach to  creating physically realistic animation that differs \n\n\fEmulation for Animation \n\n883 \n\nradically from  the conventional approach of numerically simulating the equations of mo(cid:173)\ntion of physics-based models.  We  replace physics-based models by fast  emulators which \nautomatically  learn  to  produce  similar motions  by  observing the  models  in  action.  Our \nemulators have a neural network structure, hence we dub them NeuroAnimators. \n\nOur work is inspired in part by that of Nguyen and Widrow [4].  Their \"truck backer-upper\" \ndemonstrated the neural network based approximation and control of a nonlinear kinematic \nsystem.  We introduce several generalizations that enable us  to tackle a variety of complex, \nfully dynamic models in the context of computer animation. Connectionist approximations \nof dynamical systems have been also been applied to robot control (see, e.g., [5,6]). \n\n2  The NeuroAnimator Approach \n\nOur approach is  motivated by the  following considerations:  Whether we are dealing with \nrigid  [2],  articulated  [3],  or nonrigid  [I]  dynamic animation  models,  the  numerical  sim(cid:173)\nulation of the associated equations of motion  leads  to  the computation of a  discrete-time \ndynamical system of the form StHt = ~[St, Ut, ft ]. These (generally nonlinear) equations \nexpress the vector St+8t  of state variables of the system (values of the system's degrees of \nfreedom and their velocities) at time t + r5t  in the future as a function  ~ of the state vector \nSt, the vector Ut  of control inputs, and the vector ft  of external forces acting on the system \nat time t. \n\nPhysics-based animation through the numerical simulation of a dynamical system requires \nthe evaluation of the map ~ at every timestep, which usually involves a non-trivial compu(cid:173)\ntation.  Evaluating ~ using explicit time integration methods incurs a computational cost of \nO(N) operations, where N  is proportional to the dimensionality of the state space.  Unfor(cid:173)\ntunately, for many dynamic models of interest, explicit methods are plagued by instability, \nnecessitating numerous tiny  timesteps r5t  per unit simulation time.  Alternatively,  implicit \ntime-integration methods usually permit larger timesteps, but they compute ~ by solving a \nsystem of N  algebraic equations, generally incurring a cost of O( N 3 )  per timestep. \n\nIs  it  possible  to  replace  the  conventional  numerical  simulator by  a  significantly  cheaper \nalternative?  A  crucial  realization  is  that  the  substitute,  or  emulator,  need  not  compute \nthe  map  ~ exactly,  but  merely  approximate it to  a  degree of precision  that preserves  the \nperceived faithfulness of the resulting animation to the simulated dynamics of the physical \nmodel.  Neural  networks offer a  general  mechanism for  approximating complex maps  in \nhigher dimensional spaces [7].1  Our premise is that,  to a sufficient degree of accuracy and \nat significant computational savings, trained neural networks can approximate maps  ~ not \njust for simple dynamical systems, but also for those associated with dynamic models that \nare among the most complex reported in the graphics literature to date. \n\nThe  NeuroAnimator,  which  uses  neural  networks  to  emulate  physics-based  animation, \nlearns an approximation to  the dynamic model by observing instances of state transitions, \nas well as control inputs and/or external forces that cause these transitions.  By generalizing \nfrom the sparse examples presented to  it, a trained NeuroAnimator can emulate an infinite \nvariety of continuous animations that it has never actually seen.  Each emulation step costs \nonly O(N2) operations, but it is  possible to gain additional efficiency relative to  a numer(cid:173)\nical  simulator by  training neural  networks  to  approximate a  lengthy  chain  of evaluations \nof the  discrete-time  dynamical  system.  Thus,  the  emulator network can  perform  \"super \nI Note that q,  is in general a high-dimensional map from RS+u+ f  t---7  RS, where s, u, and f denote \n\nthe dimensionalities of the state, control, and external force  vectors. \n\n\f884 \n\nR.  Grzeszczuk,  D.  Terzopoulos and G.  E.  Hinton \n\ntimesteps\" b.t = n6t, typically one or two orders of magnitude larger than 6t for the com(cid:173)\npeting implicit time-integration scheme, thereby achieving outstanding efficiency  without \nserious loss of accuracy. \n\n3  From Physics-Based Models to NeuroAnimators \n\nOur task is  to  construct neural  networks that approximate <P  in  the dynamical system.  We \npropose to employ backpropagation to train feed forward networks N<l>,  with a single layer \nof sigmoidal hidden units,  to  predict future  states  using  super time steps  b.t  = n6t while \ncontaining the approximation error so as not to appreciably degrade the physical realism of \nthe resulting animation.  The basic emulation step  is  St+~t =  N <l> [st, Ut, ftl.  The trained \nemulator  network  N<l>  takes  as  input  the  state  of the  model,  its  control  inputs,  and  the \nexternal  forces  acting  on  it  at  time  t,  and  produces  as  output  the  state  of the  model  at \ntime  t  + t1t  by  evaluating  the  network.  The  emulation  process  is  a  sequence  of these \nevaluations. After each evaluation, the network control and force inputs receive new values, \nand  the  network  state  inputs  receive  the  emulator outputs  from  the  previous  evaluation. \nSince the emulation step is large compared with the numerical simulation step, we res ample \nthe  motion  trajectory at the  animation  frame  rate,  computing intermediate states  through \nlinear interpolation of states obtained from  the emulation. \n\n3.1  Network Input/Output Structure \n\nFig.  lea) illustrates  different emulator input/output structures.  The emulator network has \na single set of output variables specifying St+~t. In  general, for a so-called active model, \nwhich includes control inputs, under the influence of unpredictable applied forces, we em(cid:173)\nploy a full network with three sets of input variables:  St. Ut. and ft. as shown in the figure. \nFor passive models, the control Ut  = 0  and the network simplifies to  one with two sets of \ninputs, St  and  ft.  In  the  special case when  the forces  ft  are completely determined by the \nstate of the  system St.  we can suppress the ft  inputs, allowing the network to learn the ef(cid:173)\nfects of these forces from the state transition training data, thus yielding a simpler emulator \nwith  two  input sets  St  and  Ut.  The simplest type of emulator has  only  a  single set  of in(cid:173)\nputs St.  This emulator suffices to approximate passive models acted upon by deterministic \nexternal forces. \n\n3.2 \n\nInput and Output Transformations \n\nThe accurate  approximation  of complex functional  mappings  using  neural  networks  can \nbe challenging.  We  have observed that a simple feedforward neural network with  a single \nlayer of sigmoid units has difficulty producing an accurate approximation to the dynamics \nof physical  models.  In  practice,  we  often  must  transform  the  emulator to  ensure a  good \napproximation of the map <P. \n\nA fundamental  problem is  that the  state variables of a dynamical system can  have a large \ndynamic range  (in  principle, from  -00 to  +(0).  To  approximate a  nonlinear map  <P  ac(cid:173)\ncurately over a large domain, we  would  need to use a  neural  network with  many sigmoid \nunits, each  shifted and scaled so  that their nonlinear segments cover different parts of the \ndomain.  The direct approximation of <P  is  therefore impractical.  A successful  strategy  is \nto train networks to emulate changes in  state variables rather than their actual values, since \nstate changes over small timesteps will have a significantly smaller dynamic range.  Hence, \nin Fig.  1 (b) (top) we restructure our simple network N <l>  as a network N ~ which is trained \n\n\fEmulation/or Animation \n\n-\"-\n\nIlJ \n\n.,  ! \n\nI  ...  ~ \n....!L.  : \n\n-\n\nr------------------------------------------------------. \n\n;;~ \n! ____________________________________________________ ~_~J \n1- ------ - - - --- ---- -------------------------------------I \n\nG \n\nN4 \n~ \n\nu \n, \n\nY \n\n, \nI \n\nI \n\n885 \n\n;;~  N'  ~ \n\nUt  I \nNcJ): \n: \nt ___ __ _ ____________________________ _ _ ______ _ __________ __ J \n\ny :  \n\n~ \n\nx \n\ny \n\nT' \nX \n\n~ \nX \n\nN\" \n1$ \n\nT'J \nY \n\nT' \nY \n\n, _____ _ ______ __ _ __ __ ___ __ _ _ _ __ __ _ ____ _______ _ _ __ _ _ _ _ _ __ _  J \n\nI \n\nI. \nI''''' \ny: \nT\" \nNcJ): \n\n-I \n\nI, I \nI t \nu,  I \n: \n\n(a) \n\n(b) \n\nFigure  1:  (a) Different types of emulators.  (b) Transforming a  simple feedforward neural \nnetwork Net>  into a practical emulator network N4, that is easily trained to emulate physics(cid:173)\nbased models.  The following operators perform the appropriate pre- and post-processing: \nT~ transforms inputs to local coordinates, T~ normalizes inputs, T~ unnormalizes outputs, \nT~ transforms outputs to global coordinates, T~ converts from a  state change to the next \nstate (see text and [8]  for the details). \n\nto emulate the change in  the  state  vector  ~St for  given  state,  external  force,  and control \ninputs,  followed  by an operator T~ that computes St+t>.t  =  St  + ~St to recover the next \nstate. \n\nWe  can  further improve the approximation power of the emulator network  by  exploiting \nnatural invariances.  In particular, since the map !f>  is  invariant under rotation and transla(cid:173)\ntion, we replace N~ with an operator T~ that converts the inputs from the world coordinate \nsystem to the local coordinate system of the model, a network N~ that is trained to emulate \nstate changes represented in  the local coordinate system, and an operator T~ that converts \nthe output of N~ back to world coordinates (Fig.  I (b) (center\u00bb. \n\nSince the values of state, force, and control variables can deviate significantly, their effect \non the  network outputs is  uneven, causing problems when large inputs must have a  small \ninfluence on outputs.  To  make inputs contribute more evenly to  the  network outputs,  we \nnormalize groups of variables so that they  have zero means and unit variances.  With nor(cid:173)\nmalization,  we  can furthermore expect the  weights  of the  trained  network  to  be of order \nunity  and  they  can  be  given  a  simple  random  initialization  prior  to  training.  Hence,  in \nFig.  l(b)) (bottom) we replace N~ with an operator T~ that normalizes its  inputs,  a  net(cid:173)\nwork N4,  that assumes  zero mean,  unit variance inputs  and outputs, and an  operator T~ \nthat unnormalizes the outputs to recover their original distributions. \n\nAlthough  the  final  emulator  in  Fig.  1 (b)  is  structurally  more  complex  than  the  standard \nfeed forward neural network Net>  that it replaces, the operators denoted by T  are completely \ndetermined  by  the  state  of the  model  and  the  distribution  of the  training  data,  and  the \nemulator network N4,  is much easier to train. \n\n3.3  Hierarchical Networks \n\nAs  a  universal  function approximator, a  neural network should in principle be able to ap(cid:173)\nproximate the map !f>  for any  dynamical system,  given enough sigmoid hidden  units  and \n\n\f886 \n\nR.  Grzeszczuk.  D.  Terzopoulos  and G.  E.  Hinton \n\ntraining data.  In  practice,  however,  the  number of hidden  layer  neurons  needed  and  the \ntraining data  requirements  grow quickly  with  the  size  of the  network,  often  making  the \ntraining of large networks impractical. To overcome the \"curse of dimensionality,\" we have \nfound it prudent to structure NeuroAnimators for all  but the simplest physics-based models \nas  hierarchies of smaller networks rather than as  large, monolithic networks.  The strategy \nbehind a hierarchical representation is to group state variables according to their dependen(cid:173)\ncies  and approximate each tightly coupled group with a subnet that takes  part of its  input \nfrom a parent network. \n\n3.4  Training NeuroAnimators \n\nTo  arrive  at a  NeuroAnimator for  a  given  physics-based  model,  we  train  the  constituent \nneural network(s) through backpropagation on  training examples generated by  simulating \nthe  model.  Training requires  the  generation  and  processing of many  examples,  hence  it \nis  typically slow,  often requiring several  CPU hours.  However, once a  NeuroAnimator is \ntrained  offline,  it  can  be  reused  online  to  produce an  infinite  variety  of fast  animations. \nThe  important point is  that by  generalizing from  the  sparse  training examples,  a  trained \nNeuroAnimator will  produce an  infinite variety of extended, continuous animations that it \nhas never \"seen\". \n\nMore specifically, each training example consists of an input vector x  and an output vector \ny.  In  the  general  case,  the  input  vector x =  [s6', rl, u6'V  comprises the  state  of the \nmodel, the external forces, and the control inputs at time t = O. The output vector y  = SLl.t \nis  the state of the model  at time t  = 6.t,  where 6.t is  the duration of the  super timestep. \nTo generate each training example, we could start the numerical simulator of the  physics(cid:173)\nbased  model  with  the  initial  conditions  So,  ro,  and  uo,  and  run  the  dynamic  simulation \nfor  n  numerical  time  steps  M  such  that  flt  =  nl5t.  In  principle,  we  could  generate an \narbitrarily large set of training examples {XT; yT}, T  =  1,2, ... , by repeating this process \nwith  different  initial  conditions.  To  learn  a  good  neural  network  approximation  N<I>  of \nthe  map CP-,  we  would  like  ideally  to  sample  q>  as  uniformly as  possible  over its  domain, \nwith randomly chosen initial  conditions among all  valid state,  external  force,  and control \ncombinations.  However,  we can make better use  of computational resources by  sampling \nthose state, force, and control  inputs that typically occur as a physics-based model is  used \nin practice. \n\nWe employ a neural  network simulator called Xerion  which  was developed at the Univer(cid:173)\nsity  of Toronto.  We  begin  the  off-line training process  by  initializing  the  weights  of N~ \nto random values from  a uniform distribution in  the range [0, 1J  (due to  the normalization \nof inputs and outputs).  Xerion automatically terminates the  backpropagation learning al(cid:173)\ngorithm when  it can  no  longer reduce the  network approximation error significantly.  We \nuse the conjugate gradient method to  train networks of small and moderate size.  For large \nnetworks,  we use gradient descent with  momentum.  We divide the training examples into \nmini-batches, each consisting of approximately 30 uncorrelated examples, and update the \nnetwork weights after processing each mini-batch. \n\n4  Results \n\nWe  have successfully constructed and  trained  several  NeuroAnimators to  emulate a  vari(cid:173)\nety  of physics-based models  (Fig.  2).  We  used  SDIFAST  (a rigid  body dynamics  simu(cid:173)\nlator marketed  by  Symbolic Dynamics,  Inc.)  to  simulate  the dynamics  of the rigid  body \n\n\fEmulation/or Animation \n\n887 \n\n(a) \n\n(b) \n\n(c) \n\n(d) \n\nFigure 2:  NeuroAnimators used in our experiments. (a) Emulator of a physics-based model \nof a planar multi-link pendulum suspended in gravity, subject to joint friction forces, exter(cid:173)\nnal  forces applied on the links, and controlled by independent motor torques at each of the \nthree joints. (b) Emulator of a physics-based model of a truck implemented as a rigid body, \nsubject to friction forces where the tires contact the ground, controlled by rear-wheel drive \n(forward and reverse) and steerable front wheels.  (c) Emulator of a physics-based model of \na lunar lander, implemented as a rigid body subject to gravitational forces and controlled by \na main rocket thruster and three independent attitude jets. (d) Emulator of a biomechanical \n(mass-spring-damper) model of a dolphin capable of swimming in  simulated water via the \ncoordinated contraction of 6 independently controlled muscle actuators which deform its \nbody, producing hydrodynamic propulsion forces. \n\nand  articulated  models,  and  we  employ  the  simulator developed  in  [10]  to  simulate  the \ndeformable-body dynamics of the dolphin. \n\nIn our experiments we have not attempted to minimize the number of network weights re(cid:173)\nquired for successful training.  We have also not tried to minimize the number of sigmoidal \nhidden units, but rather used enough units to obtain networks that generalize well while not \noverfitting the training data.  We can always expect to be able to satisfy these guidelines in \nview of our ability to generate sufficient training data. \n\nAn  important advantage  of using  neural  networks  to  emulate  dynamical  systems  is  the \nspeed at which they can be iterated to produce animation. Since the emulator for a dynam(cid:173)\nical system with the state vector of size N  never uses more than O(N) hidden units, it can \nbe evaluated using only O(N2)  operations.  By  comparison, a single simulation timestep \nusing an  implicit time integration scheme requires O(N3) operations. Moreover, a forward \npass through  the  neural  network is often equivalent to  as  many  as 50 physical simulation \nsteps,  so  the  efficiency is  even more dramatic,  yielding performance improvements up to \ntwo orders of magnitude faster than the physical simulator. A NeuroAnimator that predicts \n100  physical  simulation  steps  offers  a  speedup  of anywhere  between  50 and  100  times \ndepending on the type of physical model. \n\n5  Control Learning \n\nAn additional benefit of the NeuroAnimator is  that  it enables a novel,  highly efficient ap(cid:173)\nproach to the difficult problem of controlling physics-based models to synthesize motions \nthat satisfy prescribed animation goals.  The neural  network approximation to the physical \nmodel is differentiable; hence, it can be used to discover the causal effects that control force \ninputs have on the actions of the models.  Outstanding efficiency stems from exploiting the \ntrained NeuroAnimator to compute partial derivatives of output states with respect to con(cid:173)\ntrol inputs. The efficient computation of the approximate gradient enables the utilization of \nfast gradient-based optimization for controller synthesis. \n\n\f888 \n\nR.  Grzeszczuk, D.  Terzopoulos and G.  E. Hinton \n\nNguyen and  Widrow's  [4]  \"truck  backer-upper\" demonstrated  the  neural  network  based \napproximation and control  of a  nonlinear kinematic  system.  Our technique offers  a  new \ncontroller  synthesis  algorithm  that  works  well  in  dynamic  environments  with  changing \ncontrol objectives. See [8, 9] for the details. \n\n6  Conclusion \n\nWe have introduced an efficient alternative to the conventional approach of producing phys(cid:173)\nically realistic animation through numerical simulation. Our approach involves the learning \nof neural network emulators of physics-based models by observing the dynamic state tran(cid:173)\nsitions produced by  such models in action.  The emulators approximate physical dynamics \nwith  dramatic  efficiency,  yet  without  serious  loss  of apparent fidelity.  Our performance \nbenchmarks indicate that the  neural  network emulators can  yield  physically realistic  ani(cid:173)\nmation one or two orders of magnitude faster than conventional numerical simulation of the \nassociated physics-based models.  Our new control learning algorithm, which exploits fast \nemulation and  the differentiability of the  network approximation,  is  orders of magnitude \nfaster than competing controller synthesis algorithms for computer animation. \n\nAcknowledgements \n\nWe thank Zoubin Ghahramani for  valuable discussions leading to the idea of the rotation and transla(cid:173)\ntion invariant emulator, which was crucial to the success of this work. We are indebted to Steve Hunt, \nJohn Funge, Alexander Reshetov, Sonja Jeter and Mike Gendimenico at Intel, and Mike Revow, Drew \nvan Camp and Michiel van de  Panne at the University of Toronto for  their assistance. \n\nReferences \n\n[1]  D.  Terzopoulos, 1.  Platt, A. Barr,  K. Fleischer.  Elastically deformable  models.  In  M.e. Stone, \n\ned.,  Computer Graphics (SIGGRAPH  '87 Proceedings), 21 , 205-214, July  1987. \n\n[2]  J.K.  Hahn:  Realistic animation of rigid bodies. In J.  Dill, ed., Computer Graphics (SIGGRAPH \n\n'88 Proceedings), 22, 299-308, August  1988. \n\n[3]  J.K.  Hodgins, w.L. Wooten, D.e. Brogan, J.F. O' Brien. Animating human athletics. In R.  Cook, \n\ned., Proc.  of ACM SIGGRAPH 95 Conf, 71-78, August,  1995. \n\n[4]  D.  Nguyen,  B.  Widrow.  The  truck  backer-upper:  An  example  of self-learning  in  neural  net(cid:173)\n\nworks.  In Proc. Inter.  Joint Conf  Neural Networks , 357-363. IEEE Press,  1989. \n\n[5]  M.  I.  Jordan.  Supervised  learning  and  systems  with  excess  degrees  of freedom.  Technical \n\nReport 88-27, Univ.  of Massachusetts, Comp.& Info. Sci. , Amherst, MA,  1988. \n\n[6]  K.  S. Narendra, K.  Parthasarathy.  Gradient methods for the optimization of dynamical systems \n\ncontaining neural  networks.  IEEE Trans. on Neural Networks, 2(2):252-262,  1991. \n\n[7]  G. Cybenko.  Approximation by superposition of sigmoidal function.  Math.  of Control Signals \n\n&  Systems, 2(4):303-314,  1989. \n\n[8]  R. Grzeszczuk.  NeuroAnimator:  Fast Neural Network Emulation and Control of Physics-Based \n\nModels .  PhD thesis,  Dept. of Compo  Sci., Univ. of Toronto, May  1998. \n\n[9]  R.  Grzeszczuk,  D. Terzopoulos,  G. Hinton.  NeuroAnimator:  Fast  neural  network  emulation \nand control  of physics-based  models.  In  M. Cohen,  ed., Proc. of ACM SIGGRAPH 98 Conf, \n9-20, July  1998. \n\n[10]  X. Th, D. Terzopoulos.  Artificial fishes: Physics, locomotion, perception, behavior. In A. Glass(cid:173)\n\nner, ed.,  Proc.  of ACM SIGGRAPH 94 Conf , 43- 50.  July  1994. \n\n\f", "award": [], "sourceid": 1562, "authors": [{"given_name": "Radek", "family_name": "Grzeszczuk", "institution": null}, {"given_name": "Demetri", "family_name": "Terzopoulos", "institution": null}, {"given_name": "Geoffrey", "family_name": "Hinton", "institution": null}]}