Mercurial > cortex
view thesis/cortex.org @ 463:6d55ac73bc6f
moar text.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 27 Mar 2014 20:46:36 -0400 |
parents | bb81cef09ad7 |
children | 8bf4bb02ed05 |
line wrap: on
line source
1 #+title: =CORTEX=2 #+author: Robert McIntyre3 #+email: rlm@mit.edu4 #+description: Using embodied AI to facilitate Artificial Imagination.5 #+keywords: AI, clojure, embodiment6 #+LaTeX_CLASS_OPTIONS: [nofloat]8 * Empathy and Embodiment as problem solving strategies10 By the end of this thesis, you will have seen a novel approach to11 interpreting video using embodiment and empathy. You will have also12 seen one way to efficiently implement empathy for embodied13 creatures. Finally, you will become familiar with =CORTEX=, a system14 for designing and simulating creatures with rich senses, which you15 may choose to use in your own research.17 This is the core vision of my thesis: That one of the important ways18 in which we understand others is by imagining ourselves in their19 position and emphatically feeling experiences relative to our own20 bodies. By understanding events in terms of our own previous21 corporeal experience, we greatly constrain the possibilities of what22 would otherwise be an unwieldy exponential search. This extra23 constraint can be the difference between easily understanding what24 is happening in a video and being completely lost in a sea of25 incomprehensible color and movement.27 ** Recognizing actions in video is extremely difficult29 Consider for example the problem of determining what is happening30 in a video of which this is one frame:32 #+caption: A cat drinking some water. Identifying this action is33 #+caption: beyond the state of the art for computers.34 #+ATTR_LaTeX: :width 7cm35 [[./images/cat-drinking.jpg]]37 It is currently impossible for any computer program to reliably38 label such a video as ``drinking''. And rightly so -- it is a very39 hard problem! What features can you describe in terms of low level40 functions of pixels that can even begin to describe at a high level41 what is happening here?43 Or suppose that you are building a program that recognizes chairs.44 How could you ``see'' the chair in figure \ref{hidden-chair}?46 #+caption: The chair in this image is quite obvious to humans, but I47 #+caption: doubt that any modern computer vision program can find it.48 #+name: hidden-chair49 #+ATTR_LaTeX: :width 10cm50 [[./images/fat-person-sitting-at-desk.jpg]]52 Finally, how is it that you can easily tell the difference between53 how the girls /muscles/ are working in figure \ref{girl}?55 #+caption: The mysterious ``common sense'' appears here as you are able56 #+caption: to discern the difference in how the girl's arm muscles57 #+caption: are activated between the two images.58 #+name: girl59 #+ATTR_LaTeX: :width 7cm60 [[./images/wall-push.png]]62 Each of these examples tells us something about what might be going63 on in our minds as we easily solve these recognition problems.65 The hidden chairs show us that we are strongly triggered by cues66 relating to the position of human bodies, and that we can determine67 the overall physical configuration of a human body even if much of68 that body is occluded.70 The picture of the girl pushing against the wall tells us that we71 have common sense knowledge about the kinetics of our own bodies.72 We know well how our muscles would have to work to maintain us in73 most positions, and we can easily project this self-knowledge to74 imagined positions triggered by images of the human body.76 ** =EMPATH= neatly solves recognition problems78 I propose a system that can express the types of recognition79 problems above in a form amenable to computation. It is split into80 four parts:82 - Free/Guided Play :: The creature moves around and experiences the83 world through its unique perspective. Many otherwise84 complicated actions are easily described in the language of a85 full suite of body-centered, rich senses. For example,86 drinking is the feeling of water sliding down your throat, and87 cooling your insides. It's often accompanied by bringing your88 hand close to your face, or bringing your face close to water.89 Sitting down is the feeling of bending your knees, activating90 your quadriceps, then feeling a surface with your bottom and91 relaxing your legs. These body-centered action descriptions92 can be either learned or hard coded.93 - Posture Imitation :: When trying to interpret a video or image,94 the creature takes a model of itself and aligns it with95 whatever it sees. This alignment can even cross species, as96 when humans try to align themselves with things like ponies,97 dogs, or other humans with a different body type.98 - Empathy :: The alignment triggers associations with99 sensory data from prior experiences. For example, the100 alignment itself easily maps to proprioceptive data. Any101 sounds or obvious skin contact in the video can to a lesser102 extent trigger previous experience. Segments of previous103 experiences are stitched together to form a coherent and104 complete sensory portrait of the scene.105 - Recognition :: With the scene described in terms of first106 person sensory events, the creature can now run its107 action-identification programs on this synthesized sensory108 data, just as it would if it were actually experiencing the109 scene first-hand. If previous experience has been accurately110 retrieved, and if it is analogous enough to the scene, then111 the creature will correctly identify the action in the scene.113 For example, I think humans are able to label the cat video as114 ``drinking'' because they imagine /themselves/ as the cat, and115 imagine putting their face up against a stream of water and116 sticking out their tongue. In that imagined world, they can feel117 the cool water hitting their tongue, and feel the water entering118 their body, and are able to recognize that /feeling/ as drinking.119 So, the label of the action is not really in the pixels of the120 image, but is found clearly in a simulation inspired by those121 pixels. An imaginative system, having been trained on drinking and122 non-drinking examples and learning that the most important123 component of drinking is the feeling of water sliding down one's124 throat, would analyze a video of a cat drinking in the following125 manner:127 1. Create a physical model of the video by putting a ``fuzzy''128 model of its own body in place of the cat. Possibly also create129 a simulation of the stream of water.131 2. Play out this simulated scene and generate imagined sensory132 experience. This will include relevant muscle contractions, a133 close up view of the stream from the cat's perspective, and most134 importantly, the imagined feeling of water entering the135 mouth. The imagined sensory experience can come from a136 simulation of the event, but can also be pattern-matched from137 previous, similar embodied experience.139 3. The action is now easily identified as drinking by the sense of140 taste alone. The other senses (such as the tongue moving in and141 out) help to give plausibility to the simulated action. Note that142 the sense of vision, while critical in creating the simulation,143 is not critical for identifying the action from the simulation.145 For the chair examples, the process is even easier:147 1. Align a model of your body to the person in the image.149 2. Generate proprioceptive sensory data from this alignment.151 3. Use the imagined proprioceptive data as a key to lookup related152 sensory experience associated with that particular proproceptive153 feeling.155 4. Retrieve the feeling of your bottom resting on a surface, your156 knees bent, and your leg muscles relaxed.158 5. This sensory information is consistent with the =sitting?=159 sensory predicate, so you (and the entity in the image) must be160 sitting.162 6. There must be a chair-like object since you are sitting.164 Empathy offers yet another alternative to the age-old AI165 representation question: ``What is a chair?'' --- A chair is the166 feeling of sitting.168 My program, =EMPATH= uses this empathic problem solving technique169 to interpret the actions of a simple, worm-like creature.171 #+caption: The worm performs many actions during free play such as172 #+caption: curling, wiggling, and resting.173 #+name: worm-intro174 #+ATTR_LaTeX: :width 15cm175 [[./images/worm-intro-white.png]]177 #+caption: =EMPATH= recognized and classified each of these178 #+caption: poses by inferring the complete sensory experience179 #+caption: from proprioceptive data.180 #+name: worm-recognition-intro181 #+ATTR_LaTeX: :width 15cm182 [[./images/worm-poses.png]]184 One powerful advantage of empathic problem solving is that it185 factors the action recognition problem into two easier problems. To186 use empathy, you need an /aligner/, which takes the video and a187 model of your body, and aligns the model with the video. Then, you188 need a /recognizer/, which uses the aligned model to interpret the189 action. The power in this method lies in the fact that you describe190 all actions form a body-centered viewpoint. You are less tied to191 the particulars of any visual representation of the actions. If you192 teach the system what ``running'' is, and you have a good enough193 aligner, the system will from then on be able to recognize running194 from any point of view, even strange points of view like above or195 underneath the runner. This is in contrast to action recognition196 schemes that try to identify actions using a non-embodied approach.197 If these systems learn about running as viewed from the side, they198 will not automatically be able to recognize running from any other199 viewpoint.201 Another powerful advantage is that using the language of multiple202 body-centered rich senses to describe body-centerd actions offers a203 massive boost in descriptive capability. Consider how difficult it204 would be to compose a set of HOG filters to describe the action of205 a simple worm-creature ``curling'' so that its head touches its206 tail, and then behold the simplicity of describing thus action in a207 language designed for the task (listing \ref{grand-circle-intro}):209 #+caption: Body-centerd actions are best expressed in a body-centered210 #+caption: language. This code detects when the worm has curled into a211 #+caption: full circle. Imagine how you would replicate this functionality212 #+caption: using low-level pixel features such as HOG filters!213 #+name: grand-circle-intro214 #+attr_latex: [htpb]215 #+begin_listing clojure216 #+begin_src clojure217 (defn grand-circle?218 "Does the worm form a majestic circle (one end touching the other)?"219 [experiences]220 (and (curled? experiences)221 (let [worm-touch (:touch (peek experiences))222 tail-touch (worm-touch 0)223 head-touch (worm-touch 4)]224 (and (< 0.2 (contact worm-segment-bottom-tip tail-touch))225 (< 0.2 (contact worm-segment-top-tip head-touch))))))226 #+end_src227 #+end_listing230 ** =CORTEX= is a toolkit for building sensate creatures232 I built =CORTEX= to be a general AI research platform for doing233 experiments involving multiple rich senses and a wide variety and234 number of creatures. I intend it to be useful as a library for many235 more projects than just this thesis. =CORTEX= was necessary to meet236 a need among AI researchers at CSAIL and beyond, which is that237 people often will invent neat ideas that are best expressed in the238 language of creatures and senses, but in order to explore those239 ideas they must first build a platform in which they can create240 simulated creatures with rich senses! There are many ideas that241 would be simple to execute (such as =EMPATH=), but attached to them242 is the multi-month effort to make a good creature simulator. Often,243 that initial investment of time proves to be too much, and the244 project must make do with a lesser environment.246 =CORTEX= is well suited as an environment for embodied AI research247 for three reasons:249 - You can create new creatures using Blender, a popular 3D modeling250 program. Each sense can be specified using special blender nodes251 with biologically inspired paramaters. You need not write any252 code to create a creature, and can use a wide library of253 pre-existing blender models as a base for your own creatures.255 - =CORTEX= implements a wide variety of senses, including touch,256 proprioception, vision, hearing, and muscle tension. Complicated257 senses like touch, and vision involve multiple sensory elements258 embedded in a 2D surface. You have complete control over the259 distribution of these sensor elements through the use of simple260 png image files. In particular, =CORTEX= implements more261 comprehensive hearing than any other creature simulation system262 available.264 - =CORTEX= supports any number of creatures and any number of265 senses. Time in =CORTEX= dialates so that the simulated creatures266 always precieve a perfectly smooth flow of time, regardless of267 the actual computational load.269 =CORTEX= is built on top of =jMonkeyEngine3=, which is a video game270 engine designed to create cross-platform 3D desktop games. =CORTEX=271 is mainly written in clojure, a dialect of =LISP= that runs on the272 java virtual machine (JVM). The API for creating and simulating273 creatures and senses is entirely expressed in clojure, though many274 senses are implemented at the layer of jMonkeyEngine or below. For275 example, for the sense of hearing I use a layer of clojure code on276 top of a layer of java JNI bindings that drive a layer of =C++=277 code which implements a modified version of =OpenAL= to support278 multiple listeners. =CORTEX= is the only simulation environment279 that I know of that can support multiple entities that can each280 hear the world from their own perspective. Other senses also281 require a small layer of Java code. =CORTEX= also uses =bullet=, a282 physics simulator written in =C=.284 #+caption: Here is the worm from above modeled in Blender, a free285 #+caption: 3D-modeling program. Senses and joints are described286 #+caption: using special nodes in Blender.287 #+name: worm-recognition-intro288 #+ATTR_LaTeX: :width 12cm289 [[./images/blender-worm.png]]291 Here are some thing I anticipate that =CORTEX= might be used for:293 - exploring new ideas about sensory integration294 - distributed communication among swarm creatures295 - self-learning using free exploration,296 - evolutionary algorithms involving creature construction297 - exploration of exoitic senses and effectors that are not possible298 in the real world (such as telekenisis or a semantic sense)299 - imagination using subworlds301 During one test with =CORTEX=, I created 3,000 creatures each with302 their own independent senses and ran them all at only 1/80 real303 time. In another test, I created a detailed model of my own hand,304 equipped with a realistic distribution of touch (more sensitive at305 the fingertips), as well as eyes and ears, and it ran at around 1/4306 real time.308 #+BEGIN_LaTeX309 \begin{sidewaysfigure}310 \includegraphics[width=9.5in]{images/full-hand.png}311 \caption{312 I modeled my own right hand in Blender and rigged it with all the313 senses that {\tt CORTEX} supports. My simulated hand has a314 biologically inspired distribution of touch sensors. The senses are315 displayed on the right, and the simulation is displayed on the316 left. Notice that my hand is curling its fingers, that it can see317 its own finger from the eye in its palm, and that it can feel its318 own thumb touching its palm.}319 \end{sidewaysfigure}320 #+END_LaTeX322 ** Contributions324 - I built =CORTEX=, a comprehensive platform for embodied AI325 experiments. =CORTEX= supports many features lacking in other326 systems, such proper simulation of hearing. It is easy to create327 new =CORTEX= creatures using Blender, a free 3D modeling program.329 - I built =EMPATH=, which uses =CORTEX= to identify the actions of330 a worm-like creature using a computational model of empathy.332 * Building =CORTEX=334 I intend for =CORTEX= to be used as a general purpose library for335 building creatures and outfitting them with senses, so that it will336 be useful for other researchers who want to test out ideas of their337 own. To this end, wherver I have had to make archetictural choices338 about =CORTEX=, I have chosen to give as much freedom to the user as339 possible, so that =CORTEX= may be used for things I have not340 forseen.342 ** Simulation or Reality?344 The most important archetictural decision of all is the choice to345 use a computer-simulated environemnt in the first place! The world346 is a vast and rich place, and for now simulations are a very poor347 reflection of its complexity. It may be that there is a significant348 qualatative difference between dealing with senses in the real349 world and dealing with pale facilimilies of them in a350 simulation. What are the advantages and disadvantages of a351 simulation vs. reality?353 *** Simulation355 The advantages of virtual reality are that when everything is a356 simulation, experiments in that simulation are absolutely357 reproducible. It's also easier to change the character and world358 to explore new situations and different sensory combinations.360 If the world is to be simulated on a computer, then not only do361 you have to worry about whether the character's senses are rich362 enough to learn from the world, but whether the world itself is363 rendered with enough detail and realism to give enough working364 material to the character's senses. To name just a few365 difficulties facing modern physics simulators: destructibility of366 the environment, simulation of water/other fluids, large areas,367 nonrigid bodies, lots of objects, smoke. I don't know of any368 computer simulation that would allow a character to take a rock369 and grind it into fine dust, then use that dust to make a clay370 sculpture, at least not without spending years calculating the371 interactions of every single small grain of dust. Maybe a372 simulated world with today's limitations doesn't provide enough373 richness for real intelligence to evolve.375 *** Reality377 The other approach for playing with senses is to hook your378 software up to real cameras, microphones, robots, etc., and let it379 loose in the real world. This has the advantage of eliminating380 concerns about simulating the world at the expense of increasing381 the complexity of implementing the senses. Instead of just382 grabbing the current rendered frame for processing, you have to383 use an actual camera with real lenses and interact with photons to384 get an image. It is much harder to change the character, which is385 now partly a physical robot of some sort, since doing so involves386 changing things around in the real world instead of modifying387 lines of code. While the real world is very rich and definitely388 provides enough stimulation for intelligence to develop as389 evidenced by our own existence, it is also uncontrollable in the390 sense that a particular situation cannot be recreated perfectly or391 saved for later use. It is harder to conduct science because it is392 harder to repeat an experiment. The worst thing about using the393 real world instead of a simulation is the matter of time. Instead394 of simulated time you get the constant and unstoppable flow of395 real time. This severely limits the sorts of software you can use396 to program the AI because all sense inputs must be handled in real397 time. Complicated ideas may have to be implemented in hardware or398 may simply be impossible given the current speed of our399 processors. Contrast this with a simulation, in which the flow of400 time in the simulated world can be slowed down to accommodate the401 limitations of the character's programming. In terms of cost,402 doing everything in software is far cheaper than building custom403 real-time hardware. All you need is a laptop and some patience.405 ** Because of Time, simulation is perferable to reality407 I envision =CORTEX= being used to support rapid prototyping and408 iteration of ideas. Even if I could put together a well constructed409 kit for creating robots, it would still not be enough because of410 the scourge of real-time processing. Anyone who wants to test their411 ideas in the real world must always worry about getting their412 algorithms to run fast enough to process information in real413 time. The need for real time processing only increases if multiple414 senses are involved. In the extreme case, even simple algorithms415 will have to be accelerated by ASIC chips or FPGAs, turning what416 would otherwise be a few lines of code and a 10x speed penality417 into a multi-month ordeal. For this reason, =CORTEX= supports418 /time-dialiation/, which scales back the framerate of the419 simulation in proportion to the amount of processing each420 frame. From the perspective of the creatures inside the simulation,421 time always appears to flow at a constant rate, regardless of how422 complicated the envorimnent becomes or how many creatures are in423 the simulation. The cost is that =CORTEX= can sometimes run slower424 than real time. This can also be an advantage, however ---425 simulations of very simple creatures in =CORTEX= generally run at426 40x on my machine!428 ** Video game engines are a great starting point430 I did not need to write my own physics simulation code or shader to431 build =CORTEX=. Doing so would lead to a system that is impossible432 for anyone but myself to use anyway. Instead, I use a video game433 engine as a base and modify it to accomodate the additional needs434 of =CORTEX=. Video game engines are an ideal starting point to435 build =CORTEX=, because they are not far from being creature436 building systems themselves.438 First off, general purpose video game engines come with a physics439 engine and lighting / sound system. The physics system provides440 tools that can be co-opted to serve as touch, proprioception, and441 muscles. Since some games support split screen views, a good video442 game engine will allow you to efficiently create multiple cameras443 in the simulated world that can be used as eyes. Video game systems444 offer integrated asset management for things like textures and445 creatures models, providing an avenue for defining creatures.446 Finally, because video game engines support a large number of447 users, if I don't stray too far from the base system, other448 researchers can turn to this community for help when doing their449 research.451 ** =CORTEX= is based on jMonkeyEngine3453 While preparing to build =CORTEX= I studied several video game454 engines to see which would best serve as a base. The top contenders455 were:457 - [[http://www.idsoftware.com][Quake II]]/[[http://www.bytonic.de/html/jake2.html][Jake2]] :: The Quake II engine was designed by ID458 software in 1997. All the source code was released by ID459 software into the Public Domain several years ago, and as a460 result it has been ported to many different languages. This461 engine was famous for its advanced use of realistic shading462 and had decent and fast physics simulation. The main advantage463 of the Quake II engine is its simplicity, but I ultimately464 rejected it because the engine is too tied to the concept of a465 first-person shooter game. One of the problems I had was that466 there does not seem to be any easy way to attach multiple467 cameras to a single character. There are also several physics468 clipping issues that are corrected in a way that only applies469 to the main character and do not apply to arbitrary objects.471 - [[http://source.valvesoftware.com/][Source Engine]] :: The Source Engine evolved from the Quake II472 and Quake I engines and is used by Valve in the Half-Life473 series of games. The physics simulation in the Source Engine474 is quite accurate and probably the best out of all the engines475 I investigated. There is also an extensive community actively476 working with the engine. However, applications that use the477 Source Engine must be written in C++, the code is not open, it478 only runs on Windows, and the tools that come with the SDK to479 handle models and textures are complicated and awkward to use.481 - [[http://jmonkeyengine.com/][jMonkeyEngine3]] :: jMonkeyEngine3 is a new library for creating482 games in Java. It uses OpenGL to render to the screen and uses483 screengraphs to avoid drawing things that do not appear on the484 screen. It has an active community and several games in the485 pipeline. The engine was not built to serve any particular486 game but is instead meant to be used for any 3D game.489 I chose jMonkeyEngine3 because it because it had the most features490 out of all the open projects I looked at, and because I could then491 write my code in clojure, an implementation of =LISP= that runs on492 the JVM.494 ** Bodies are composed of segments connected by joints496 ** Eyes reuse standard video game components498 ** Hearing is hard; =CORTEX= does it right500 ** Touch uses hundreds of hair-like elements502 ** Proprioception is the sense that makes everything ``real''504 ** Muscles are both effectors and sensors506 ** =CORTEX= brings complex creatures to life!508 ** =CORTEX= enables many possiblities for further research510 * Empathy in a simulated worm512 Here I develop a computational model of empathy, using =CORTEX= as a513 base. Empathy in this context is the ability to observe another514 creature and infer what sorts of sensations that creature is515 feeling. My empathy algorithm involves multiple phases. First is516 free-play, where the creature moves around and gains sensory517 experience. From this experience I construct a representation of the518 creature's sensory state space, which I call \Phi-space. Using519 \Phi-space, I construct an efficient function which takes the520 limited data that comes from observing another creature and enriches521 it full compliment of imagined sensory data. I can then use the522 imagined sensory data to recognize what the observed creature is523 doing and feeling, using straightforward embodied action predicates.524 This is all demonstrated with using a simple worm-like creature, and525 recognizing worm-actions based on limited data.527 #+caption: Here is the worm with which we will be working.528 #+caption: It is composed of 5 segments. Each segment has a529 #+caption: pair of extensor and flexor muscles. Each of the530 #+caption: worm's four joints is a hinge joint which allows531 #+caption: about 30 degrees of rotation to either side. Each segment532 #+caption: of the worm is touch-capable and has a uniform533 #+caption: distribution of touch sensors on each of its faces.534 #+caption: Each joint has a proprioceptive sense to detect535 #+caption: relative positions. The worm segments are all the536 #+caption: same except for the first one, which has a much537 #+caption: higher weight than the others to allow for easy538 #+caption: manual motor control.539 #+name: basic-worm-view540 #+ATTR_LaTeX: :width 10cm541 [[./images/basic-worm-view.png]]543 #+caption: Program for reading a worm from a blender file and544 #+caption: outfitting it with the senses of proprioception,545 #+caption: touch, and the ability to move, as specified in the546 #+caption: blender file.547 #+name: get-worm548 #+begin_listing clojure549 #+begin_src clojure550 (defn worm []551 (let [model (load-blender-model "Models/worm/worm.blend")]552 {:body (doto model (body!))553 :touch (touch! model)554 :proprioception (proprioception! model)555 :muscles (movement! model)}))556 #+end_src557 #+end_listing559 ** Embodiment factors action recognition into managable parts561 Using empathy, I divide the problem of action recognition into a562 recognition process expressed in the language of a full compliment563 of senses, and an imaganitive process that generates full sensory564 data from partial sensory data. Splitting the action recognition565 problem in this manner greatly reduces the total amount of work to566 recognize actions: The imaganitive process is mostly just matching567 previous experience, and the recognition process gets to use all568 the senses to directly describe any action.570 ** Action recognition is easy with a full gamut of senses572 Embodied representations using multiple senses such as touch,573 proprioception, and muscle tension turns out be be exceedingly574 efficient at describing body-centered actions. It is the ``right575 language for the job''. For example, it takes only around 5 lines576 of LISP code to describe the action of ``curling'' using embodied577 primitives. It takes about 10 lines to describe the seemingly578 complicated action of wiggling.580 The following action predicates each take a stream of sensory581 experience, observe however much of it they desire, and decide582 whether the worm is doing the action they describe. =curled?=583 relies on proprioception, =resting?= relies on touch, =wiggling?=584 relies on a fourier analysis of muscle contraction, and585 =grand-circle?= relies on touch and reuses =curled?= as a gaurd.587 #+caption: Program for detecting whether the worm is curled. This is the588 #+caption: simplest action predicate, because it only uses the last frame589 #+caption: of sensory experience, and only uses proprioceptive data. Even590 #+caption: this simple predicate, however, is automatically frame591 #+caption: independent and ignores vermopomorphic differences such as592 #+caption: worm textures and colors.593 #+name: curled594 #+attr_latex: [htpb]595 #+begin_listing clojure596 #+begin_src clojure597 (defn curled?598 "Is the worm curled up?"599 [experiences]600 (every?601 (fn [[_ _ bend]]602 (> (Math/sin bend) 0.64))603 (:proprioception (peek experiences))))604 #+end_src605 #+end_listing607 #+caption: Program for summarizing the touch information in a patch608 #+caption: of skin.609 #+name: touch-summary610 #+attr_latex: [htpb]612 #+begin_listing clojure613 #+begin_src clojure614 (defn contact615 "Determine how much contact a particular worm segment has with616 other objects. Returns a value between 0 and 1, where 1 is full617 contact and 0 is no contact."618 [touch-region [coords contact :as touch]]619 (-> (zipmap coords contact)620 (select-keys touch-region)621 (vals)622 (#(map first %))623 (average)624 (* 10)625 (- 1)626 (Math/abs)))627 #+end_src628 #+end_listing631 #+caption: Program for detecting whether the worm is at rest. This program632 #+caption: uses a summary of the tactile information from the underbelly633 #+caption: of the worm, and is only true if every segment is touching the634 #+caption: floor. Note that this function contains no references to635 #+caption: proprioction at all.636 #+name: resting637 #+attr_latex: [htpb]638 #+begin_listing clojure639 #+begin_src clojure640 (def worm-segment-bottom (rect-region [8 15] [14 22]))642 (defn resting?643 "Is the worm resting on the ground?"644 [experiences]645 (every?646 (fn [touch-data]647 (< 0.9 (contact worm-segment-bottom touch-data)))648 (:touch (peek experiences))))649 #+end_src650 #+end_listing652 #+caption: Program for detecting whether the worm is curled up into a653 #+caption: full circle. Here the embodied approach begins to shine, as654 #+caption: I am able to both use a previous action predicate (=curled?=)655 #+caption: as well as the direct tactile experience of the head and tail.656 #+name: grand-circle657 #+attr_latex: [htpb]658 #+begin_listing clojure659 #+begin_src clojure660 (def worm-segment-bottom-tip (rect-region [15 15] [22 22]))662 (def worm-segment-top-tip (rect-region [0 15] [7 22]))664 (defn grand-circle?665 "Does the worm form a majestic circle (one end touching the other)?"666 [experiences]667 (and (curled? experiences)668 (let [worm-touch (:touch (peek experiences))669 tail-touch (worm-touch 0)670 head-touch (worm-touch 4)]671 (and (< 0.55 (contact worm-segment-bottom-tip tail-touch))672 (< 0.55 (contact worm-segment-top-tip head-touch))))))673 #+end_src674 #+end_listing677 #+caption: Program for detecting whether the worm has been wiggling for678 #+caption: the last few frames. It uses a fourier analysis of the muscle679 #+caption: contractions of the worm's tail to determine wiggling. This is680 #+caption: signigicant because there is no particular frame that clearly681 #+caption: indicates that the worm is wiggling --- only when multiple frames682 #+caption: are analyzed together is the wiggling revealed. Defining683 #+caption: wiggling this way also gives the worm an opportunity to learn684 #+caption: and recognize ``frustrated wiggling'', where the worm tries to685 #+caption: wiggle but can't. Frustrated wiggling is very visually different686 #+caption: from actual wiggling, but this definition gives it to us for free.687 #+name: wiggling688 #+attr_latex: [htpb]689 #+begin_listing clojure690 #+begin_src clojure691 (defn fft [nums]692 (map693 #(.getReal %)694 (.transform695 (FastFourierTransformer. DftNormalization/STANDARD)696 (double-array nums) TransformType/FORWARD)))698 (def indexed (partial map-indexed vector))700 (defn max-indexed [s]701 (first (sort-by (comp - second) (indexed s))))703 (defn wiggling?704 "Is the worm wiggling?"705 [experiences]706 (let [analysis-interval 0x40]707 (when (> (count experiences) analysis-interval)708 (let [a-flex 3709 a-ex 2710 muscle-activity711 (map :muscle (vector:last-n experiences analysis-interval))712 base-activity713 (map #(- (% a-flex) (% a-ex)) muscle-activity)]714 (= 2715 (first716 (max-indexed717 (map #(Math/abs %)718 (take 20 (fft base-activity))))))))))719 #+end_src720 #+end_listing722 With these action predicates, I can now recognize the actions of723 the worm while it is moving under my control and I have access to724 all the worm's senses.726 #+caption: Use the action predicates defined earlier to report on727 #+caption: what the worm is doing while in simulation.728 #+name: report-worm-activity729 #+attr_latex: [htpb]730 #+begin_listing clojure731 #+begin_src clojure732 (defn debug-experience733 [experiences text]734 (cond735 (grand-circle? experiences) (.setText text "Grand Circle")736 (curled? experiences) (.setText text "Curled")737 (wiggling? experiences) (.setText text "Wiggling")738 (resting? experiences) (.setText text "Resting")))739 #+end_src740 #+end_listing742 #+caption: Using =debug-experience=, the body-centered predicates743 #+caption: work together to classify the behaviour of the worm.744 #+caption: the predicates are operating with access to the worm's745 #+caption: full sensory data.746 #+name: basic-worm-view747 #+ATTR_LaTeX: :width 10cm748 [[./images/worm-identify-init.png]]750 These action predicates satisfy the recognition requirement of an751 empathic recognition system. There is power in the simplicity of752 the action predicates. They describe their actions without getting753 confused in visual details of the worm. Each one is frame754 independent, but more than that, they are each indepent of755 irrelevant visual details of the worm and the environment. They756 will work regardless of whether the worm is a different color or757 hevaily textured, or if the environment has strange lighting.759 The trick now is to make the action predicates work even when the760 sensory data on which they depend is absent. If I can do that, then761 I will have gained much,763 ** \Phi-space describes the worm's experiences765 As a first step towards building empathy, I need to gather all of766 the worm's experiences during free play. I use a simple vector to767 store all the experiences.769 Each element of the experience vector exists in the vast space of770 all possible worm-experiences. Most of this vast space is actually771 unreachable due to physical constraints of the worm's body. For772 example, the worm's segments are connected by hinge joints that put773 a practical limit on the worm's range of motions without limiting774 its degrees of freedom. Some groupings of senses are impossible;775 the worm can not be bent into a circle so that its ends are776 touching and at the same time not also experience the sensation of777 touching itself.779 As the worm moves around during free play and its experience vector780 grows larger, the vector begins to define a subspace which is all781 the sensations the worm can practicaly experience during normal782 operation. I call this subspace \Phi-space, short for783 physical-space. The experience vector defines a path through784 \Phi-space. This path has interesting properties that all derive785 from physical embodiment. The proprioceptive components are786 completely smooth, because in order for the worm to move from one787 position to another, it must pass through the intermediate788 positions. The path invariably forms loops as actions are repeated.789 Finally and most importantly, proprioception actually gives very790 strong inference about the other senses. For example, when the worm791 is flat, you can infer that it is touching the ground and that its792 muscles are not active, because if the muscles were active, the793 worm would be moving and would not be perfectly flat. In order to794 stay flat, the worm has to be touching the ground, or it would795 again be moving out of the flat position due to gravity. If the796 worm is positioned in such a way that it interacts with itself,797 then it is very likely to be feeling the same tactile feelings as798 the last time it was in that position, because it has the same body799 as then. If you observe multiple frames of proprioceptive data,800 then you can become increasingly confident about the exact801 activations of the worm's muscles, because it generally takes a802 unique combination of muscle contractions to transform the worm's803 body along a specific path through \Phi-space.805 There is a simple way of taking \Phi-space and the total ordering806 provided by an experience vector and reliably infering the rest of807 the senses.809 ** Empathy is the process of tracing though \Phi-space811 Here is the core of a basic empathy algorithm, starting with an812 experience vector:814 First, group the experiences into tiered proprioceptive bins. I use815 powers of 10 and 3 bins, and the smallest bin has an approximate816 size of 0.001 radians in all proprioceptive dimensions.818 Then, given a sequence of proprioceptive input, generate a set of819 matching experience records for each input, using the tiered820 proprioceptive bins.822 Finally, to infer sensory data, select the longest consective chain823 of experiences. Conecutive experience means that the experiences824 appear next to each other in the experience vector.826 This algorithm has three advantages:828 1. It's simple830 3. It's very fast -- retrieving possible interpretations takes831 constant time. Tracing through chains of interpretations takes832 time proportional to the average number of experiences in a833 proprioceptive bin. Redundant experiences in \Phi-space can be834 merged to save computation.836 2. It protects from wrong interpretations of transient ambiguous837 proprioceptive data. For example, if the worm is flat for just838 an instant, this flattness will not be interpreted as implying839 that the worm has its muscles relaxed, since the flattness is840 part of a longer chain which includes a distinct pattern of841 muscle activation. Markov chains or other memoryless statistical842 models that operate on individual frames may very well make this843 mistake.845 #+caption: Program to convert an experience vector into a846 #+caption: proprioceptively binned lookup function.847 #+name: bin848 #+attr_latex: [htpb]849 #+begin_listing clojure850 #+begin_src clojure851 (defn bin [digits]852 (fn [angles]853 (->> angles854 (flatten)855 (map (juxt #(Math/sin %) #(Math/cos %)))856 (flatten)857 (mapv #(Math/round (* % (Math/pow 10 (dec digits))))))))859 (defn gen-phi-scan860 "Nearest-neighbors with binning. Only returns a result if861 the propriceptive data is within 10% of a previously recorded862 result in all dimensions."863 [phi-space]864 (let [bin-keys (map bin [3 2 1])865 bin-maps866 (map (fn [bin-key]867 (group-by868 (comp bin-key :proprioception phi-space)869 (range (count phi-space)))) bin-keys)870 lookups (map (fn [bin-key bin-map]871 (fn [proprio] (bin-map (bin-key proprio))))872 bin-keys bin-maps)]873 (fn lookup [proprio-data]874 (set (some #(% proprio-data) lookups)))))875 #+end_src876 #+end_listing878 #+caption: =longest-thread= finds the longest path of consecutive879 #+caption: experiences to explain proprioceptive worm data.880 #+name: phi-space-history-scan881 #+ATTR_LaTeX: :width 10cm882 [[./images/aurellem-gray.png]]884 =longest-thread= infers sensory data by stitching together pieces885 from previous experience. It prefers longer chains of previous886 experience to shorter ones. For example, during training the worm887 might rest on the ground for one second before it performs its888 excercises. If during recognition the worm rests on the ground for889 five seconds, =longest-thread= will accomodate this five second890 rest period by looping the one second rest chain five times.892 =longest-thread= takes time proportinal to the average number of893 entries in a proprioceptive bin, because for each element in the894 starting bin it performes a series of set lookups in the preceeding895 bins. If the total history is limited, then this is only a constant896 multiple times the number of entries in the starting bin. This897 analysis also applies even if the action requires multiple longest898 chains -- it's still the average number of entries in a899 proprioceptive bin times the desired chain length. Because900 =longest-thread= is so efficient and simple, I can interpret901 worm-actions in real time.903 #+caption: Program to calculate empathy by tracing though \Phi-space904 #+caption: and finding the longest (ie. most coherent) interpretation905 #+caption: of the data.906 #+name: longest-thread907 #+attr_latex: [htpb]908 #+begin_listing clojure909 #+begin_src clojure910 (defn longest-thread911 "Find the longest thread from phi-index-sets. The index sets should912 be ordered from most recent to least recent."913 [phi-index-sets]914 (loop [result '()915 [thread-bases & remaining :as phi-index-sets] phi-index-sets]916 (if (empty? phi-index-sets)917 (vec result)918 (let [threads919 (for [thread-base thread-bases]920 (loop [thread (list thread-base)921 remaining remaining]922 (let [next-index (dec (first thread))]923 (cond (empty? remaining) thread924 (contains? (first remaining) next-index)925 (recur926 (cons next-index thread) (rest remaining))927 :else thread))))928 longest-thread929 (reduce (fn [thread-a thread-b]930 (if (> (count thread-a) (count thread-b))931 thread-a thread-b))932 '(nil)933 threads)]934 (recur (concat longest-thread result)935 (drop (count longest-thread) phi-index-sets))))))936 #+end_src937 #+end_listing939 There is one final piece, which is to replace missing sensory data940 with a best-guess estimate. While I could fill in missing data by941 using a gradient over the closest known sensory data points,942 averages can be misleading. It is certainly possible to create an943 impossible sensory state by averaging two possible sensory states.944 Therefore, I simply replicate the most recent sensory experience to945 fill in the gaps.947 #+caption: Fill in blanks in sensory experience by replicating the most948 #+caption: recent experience.949 #+name: infer-nils950 #+attr_latex: [htpb]951 #+begin_listing clojure952 #+begin_src clojure953 (defn infer-nils954 "Replace nils with the next available non-nil element in the955 sequence, or barring that, 0."956 [s]957 (loop [i (dec (count s))958 v (transient s)]959 (if (zero? i) (persistent! v)960 (if-let [cur (v i)]961 (if (get v (dec i) 0)962 (recur (dec i) v)963 (recur (dec i) (assoc! v (dec i) cur)))964 (recur i (assoc! v i 0))))))965 #+end_src966 #+end_listing968 ** Efficient action recognition with =EMPATH=970 To use =EMPATH= with the worm, I first need to gather a set of971 experiences from the worm that includes the actions I want to972 recognize. The =generate-phi-space= program (listing973 \ref{generate-phi-space} runs the worm through a series of974 exercices and gatheres those experiences into a vector. The975 =do-all-the-things= program is a routine expressed in a simple976 muscle contraction script language for automated worm control. It977 causes the worm to rest, curl, and wiggle over about 700 frames978 (approx. 11 seconds).980 #+caption: Program to gather the worm's experiences into a vector for981 #+caption: further processing. The =motor-control-program= line uses982 #+caption: a motor control script that causes the worm to execute a series983 #+caption: of ``exercices'' that include all the action predicates.984 #+name: generate-phi-space985 #+attr_latex: [htpb]986 #+begin_listing clojure987 #+begin_src clojure988 (def do-all-the-things989 (concat990 curl-script991 [[300 :d-ex 40]992 [320 :d-ex 0]]993 (shift-script 280 (take 16 wiggle-script))))995 (defn generate-phi-space []996 (let [experiences (atom [])]997 (run-world998 (apply-map999 worm-world1000 (merge1001 (worm-world-defaults)1002 {:end-frame 7001003 :motor-control1004 (motor-control-program worm-muscle-labels do-all-the-things)1005 :experiences experiences})))1006 @experiences))1007 #+end_src1008 #+end_listing1010 #+caption: Use longest thread and a phi-space generated from a short1011 #+caption: exercise routine to interpret actions during free play.1012 #+name: empathy-debug1013 #+attr_latex: [htpb]1014 #+begin_listing clojure1015 #+begin_src clojure1016 (defn init []1017 (def phi-space (generate-phi-space))1018 (def phi-scan (gen-phi-scan phi-space)))1020 (defn empathy-demonstration []1021 (let [proprio (atom ())]1022 (fn1023 [experiences text]1024 (let [phi-indices (phi-scan (:proprioception (peek experiences)))]1025 (swap! proprio (partial cons phi-indices))1026 (let [exp-thread (longest-thread (take 300 @proprio))1027 empathy (mapv phi-space (infer-nils exp-thread))]1028 (println-repl (vector:last-n exp-thread 22))1029 (cond1030 (grand-circle? empathy) (.setText text "Grand Circle")1031 (curled? empathy) (.setText text "Curled")1032 (wiggling? empathy) (.setText text "Wiggling")1033 (resting? empathy) (.setText text "Resting")1034 :else (.setText text "Unknown")))))))1036 (defn empathy-experiment [record]1037 (.start (worm-world :experience-watch (debug-experience-phi)1038 :record record :worm worm*)))1039 #+end_src1040 #+end_listing1042 The result of running =empathy-experiment= is that the system is1043 generally able to interpret worm actions using the action-predicates1044 on simulated sensory data just as well as with actual data. Figure1045 \ref{empathy-debug-image} was generated using =empathy-experiment=:1047 #+caption: From only proprioceptive data, =EMPATH= was able to infer1048 #+caption: the complete sensory experience and classify four poses1049 #+caption: (The last panel shows a composite image of \emph{wriggling},1050 #+caption: a dynamic pose.)1051 #+name: empathy-debug-image1052 #+ATTR_LaTeX: :width 10cm :placement [H]1053 [[./images/empathy-1.png]]1055 One way to measure the performance of =EMPATH= is to compare the1056 sutiability of the imagined sense experience to trigger the same1057 action predicates as the real sensory experience.1059 #+caption: Determine how closely empathy approximates actual1060 #+caption: sensory data.1061 #+name: test-empathy-accuracy1062 #+attr_latex: [htpb]1063 #+begin_listing clojure1064 #+begin_src clojure1065 (def worm-action-label1066 (juxt grand-circle? curled? wiggling?))1068 (defn compare-empathy-with-baseline [matches]1069 (let [proprio (atom ())]1070 (fn1071 [experiences text]1072 (let [phi-indices (phi-scan (:proprioception (peek experiences)))]1073 (swap! proprio (partial cons phi-indices))1074 (let [exp-thread (longest-thread (take 300 @proprio))1075 empathy (mapv phi-space (infer-nils exp-thread))1076 experience-matches-empathy1077 (= (worm-action-label experiences)1078 (worm-action-label empathy))]1079 (println-repl experience-matches-empathy)1080 (swap! matches #(conj % experience-matches-empathy)))))))1082 (defn accuracy [v]1083 (float (/ (count (filter true? v)) (count v))))1085 (defn test-empathy-accuracy []1086 (let [res (atom [])]1087 (run-world1088 (worm-world :experience-watch1089 (compare-empathy-with-baseline res)1090 :worm worm*))1091 (accuracy @res)))1092 #+end_src1093 #+end_listing1095 Running =test-empathy-accuracy= using the very short exercise1096 program defined in listing \ref{generate-phi-space}, and then doing1097 a similar pattern of activity manually yeilds an accuracy of around1098 73%. This is based on very limited worm experience. By training the1099 worm for longer, the accuracy dramatically improves.1101 #+caption: Program to generate \Phi-space using manual training.1102 #+name: manual-phi-space1103 #+attr_latex: [htpb]1104 #+begin_listing clojure1105 #+begin_src clojure1106 (defn init-interactive []1107 (def phi-space1108 (let [experiences (atom [])]1109 (run-world1110 (apply-map1111 worm-world1112 (merge1113 (worm-world-defaults)1114 {:experiences experiences})))1115 @experiences))1116 (def phi-scan (gen-phi-scan phi-space)))1117 #+end_src1118 #+end_listing1120 After about 1 minute of manual training, I was able to achieve 95%1121 accuracy on manual testing of the worm using =init-interactive= and1122 =test-empathy-accuracy=. The majority of errors are near the1123 boundaries of transitioning from one type of action to another.1124 During these transitions the exact label for the action is more open1125 to interpretation, and dissaggrement between empathy and experience1126 is more excusable.1128 ** Digression: bootstrapping touch using free exploration1130 In the previous section I showed how to compute actions in terms of1131 body-centered predicates which relied averate touch activation of1132 pre-defined regions of the worm's skin. What if, instead of recieving1133 touch pre-grouped into the six faces of each worm segment, the true1134 topology of the worm's skin was unknown? This is more similiar to how1135 a nerve fiber bundle might be arranged. While two fibers that are1136 close in a nerve bundle /might/ correspond to two touch sensors that1137 are close together on the skin, the process of taking a complicated1138 surface and forcing it into essentially a circle requires some cuts1139 and rerragenments.1141 In this section I show how to automatically learn the skin-topology of1142 a worm segment by free exploration. As the worm rolls around on the1143 floor, large sections of its surface get activated. If the worm has1144 stopped moving, then whatever region of skin that is touching the1145 floor is probably an important region, and should be recorded.1147 #+caption: Program to detect whether the worm is in a resting state1148 #+caption: with one face touching the floor.1149 #+name: pure-touch1150 #+begin_listing clojure1151 #+begin_src clojure1152 (def full-contact [(float 0.0) (float 0.1)])1154 (defn pure-touch?1155 "This is worm specific code to determine if a large region of touch1156 sensors is either all on or all off."1157 [[coords touch :as touch-data]]1158 (= (set (map first touch)) (set full-contact)))1159 #+end_src1160 #+end_listing1162 After collecting these important regions, there will many nearly1163 similiar touch regions. While for some purposes the subtle1164 differences between these regions will be important, for my1165 purposes I colapse them into mostly non-overlapping sets using1166 =remove-similiar= in listing \ref{remove-similiar}1168 #+caption: Program to take a lits of set of points and ``collapse them''1169 #+caption: so that the remaining sets in the list are siginificantly1170 #+caption: different from each other. Prefer smaller sets to larger ones.1171 #+name: remove-similiar1172 #+begin_listing clojure1173 #+begin_src clojure1174 (defn remove-similar1175 [coll]1176 (loop [result () coll (sort-by (comp - count) coll)]1177 (if (empty? coll) result1178 (let [[x & xs] coll1179 c (count x)]1180 (if (some1181 (fn [other-set]1182 (let [oc (count other-set)]1183 (< (- (count (union other-set x)) c) (* oc 0.1))))1184 xs)1185 (recur result xs)1186 (recur (cons x result) xs))))))1187 #+end_src1188 #+end_listing1190 Actually running this simulation is easy given =CORTEX='s facilities.1192 #+caption: Collect experiences while the worm moves around. Filter the touch1193 #+caption: sensations by stable ones, collapse similiar ones together,1194 #+caption: and report the regions learned.1195 #+name: learn-touch1196 #+begin_listing clojure1197 #+begin_src clojure1198 (defn learn-touch-regions []1199 (let [experiences (atom [])1200 world (apply-map1201 worm-world1202 (assoc (worm-segment-defaults)1203 :experiences experiences))]1204 (run-world world)1205 (->>1206 @experiences1207 (drop 175)1208 ;; access the single segment's touch data1209 (map (comp first :touch))1210 ;; only deal with "pure" touch data to determine surfaces1211 (filter pure-touch?)1212 ;; associate coordinates with touch values1213 (map (partial apply zipmap))1214 ;; select those regions where contact is being made1215 (map (partial group-by second))1216 (map #(get % full-contact))1217 (map (partial map first))1218 ;; remove redundant/subset regions1219 (map set)1220 remove-similar)))1222 (defn learn-and-view-touch-regions []1223 (map view-touch-region1224 (learn-touch-regions)))1225 #+end_src1226 #+end_listing1228 The only thing remining to define is the particular motion the worm1229 must take. I accomplish this with a simple motor control program.1231 #+caption: Motor control program for making the worm roll on the ground.1232 #+caption: This could also be replaced with random motion.1233 #+name: worm-roll1234 #+begin_listing clojure1235 #+begin_src clojure1236 (defn touch-kinesthetics []1237 [[170 :lift-1 40]1238 [190 :lift-1 19]1239 [206 :lift-1 0]1241 [400 :lift-2 40]1242 [410 :lift-2 0]1244 [570 :lift-2 40]1245 [590 :lift-2 21]1246 [606 :lift-2 0]1248 [800 :lift-1 30]1249 [809 :lift-1 0]1251 [900 :roll-2 40]1252 [905 :roll-2 20]1253 [910 :roll-2 0]1255 [1000 :roll-2 40]1256 [1005 :roll-2 20]1257 [1010 :roll-2 0]1259 [1100 :roll-2 40]1260 [1105 :roll-2 20]1261 [1110 :roll-2 0]1262 ])1263 #+end_src1264 #+end_listing1267 #+caption: The small worm rolls around on the floor, driven1268 #+caption: by the motor control program in listing \ref{worm-roll}.1269 #+name: worm-roll1270 #+ATTR_LaTeX: :width 12cm1271 [[./images/worm-roll.png]]1274 #+caption: After completing its adventures, the worm now knows1275 #+caption: how its touch sensors are arranged along its skin. These1276 #+caption: are the regions that were deemed important by1277 #+caption: =learn-touch-regions=. Note that the worm has discovered1278 #+caption: that it has six sides.1279 #+name: worm-touch-map1280 #+ATTR_LaTeX: :width 12cm1281 [[./images/touch-learn.png]]1283 While simple, =learn-touch-regions= exploits regularities in both1284 the worm's physiology and the worm's environment to correctly1285 deduce that the worm has six sides. Note that =learn-touch-regions=1286 would work just as well even if the worm's touch sense data were1287 completely scrambled. The cross shape is just for convienence. This1288 example justifies the use of pre-defined touch regions in =EMPATH=.1290 * Contributions1292 In this thesis you have seen the =CORTEX= system, a complete1293 environment for creating simulated creatures. You have seen how to1294 implement five senses including touch, proprioception, hearing,1295 vision, and muscle tension. You have seen how to create new creatues1296 using blender, a 3D modeling tool. I hope that =CORTEX= will be1297 useful in further research projects. To this end I have included the1298 full source to =CORTEX= along with a large suite of tests and1299 examples. I have also created a user guide for =CORTEX= which is1300 inculded in an appendix to this thesis.1302 You have also seen how I used =CORTEX= as a platform to attach the1303 /action recognition/ problem, which is the problem of recognizing1304 actions in video. You saw a simple system called =EMPATH= which1305 ientifies actions by first describing actions in a body-centerd,1306 rich sense language, then infering a full range of sensory1307 experience from limited data using previous experience gained from1308 free play.1310 As a minor digression, you also saw how I used =CORTEX= to enable a1311 tiny worm to discover the topology of its skin simply by rolling on1312 the ground.1314 In conclusion, the main contributions of this thesis are:1316 - =CORTEX=, a system for creating simulated creatures with rich1317 senses.1318 - =EMPATH=, a program for recognizing actions by imagining sensory1319 experience.1321 # An anatomical joke:1322 # - Training1323 # - Skeletal imitation1324 # - Sensory fleshing-out1325 # - Classification