[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-70947":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":24,"defaultBranch":25,"hasWiki":24,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":15,"lastSyncTime":30,"discoverSource":31},70947,"AnimatedDrawings","facebookresearch\u002FAnimatedDrawings","facebookresearch","Code to accompany \"A Method for Animating Children's Drawings of the Human Figure\"","",null,"Python",12798,1160,1,2,0,5,6,9,15,44.19,"MIT License",true,false,"main",[],"2026-06-12 02:02:45","# Animated Drawings\n\n![Sequence 02](https:\u002F\u002Fuser-images.githubusercontent.com\u002F6675724\u002F219223438-2c93f9cb-d4b5-45e9-a433-149ed76affa6.gif)\n\n**_Update 09-03-25: This project has been a joy to share with you all. Thanks to this community for your creativity and support along the way. I'm moving on to new adventures and won't be able to maintain this repository anymore, so I've chosen to archive it. If you have questions or want to say hello in the future, come find me at [www.hjessmith.com](http:\u002F\u002Fwww.hjessmith.com)._**\n \nThis repo contains an implementation of the algorithm described in the paper, [A Method for Animating Children's Drawings of the Human Figure](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3592788). In addition, this repo aims to be a useful creative tool in its own right, allowing you to flexibly create animations starring your own drawn characters. Here's a [video overview](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=WsMUKQLVsOI) of the project. If you do create something fun with this, let us know! Use hashtag **#FAIRAnimatedDrawings**, or tag me on twitter: [@hjessmith](https:\u002F\u002Ftwitter.com\u002Fhjessmith\u002F).\n\n\n\n\n## Installation\n*This project has been tested with macOS Ventura 13.2.1 and Ubuntu 18.04. If you're installing on another operating system, you may encounter issues.*\n\nWe *strongly* recommend activating a Python virtual environment prior to installing Animated Drawings.\nConda's Miniconda is a great choice. Follow [these steps](https:\u002F\u002Fconda.io\u002Fprojects\u002Fconda\u002Fen\u002Fstable\u002Fuser-guide\u002Finstall\u002Findex.html) to download and install it. Then run the following commands:\n\n````bash\n    # create and activate the virtual environment\n    conda create --name animated_drawings python=3.8.13\n    conda activate animated_drawings\n\n    # clone AnimatedDrawings and use pip to install\n    git clone https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FAnimatedDrawings.git\n    cd AnimatedDrawings\n    pip install -e .\n````\n\nMac M1\u002FM2 users: if you get architecture errors, make sure your `~\u002F.condarc` does not have `osx-64`, but only `osx-arm64` and `noarch` in its subdirs listing. You can see that it's going to go sideways as early as `conda create` because it will show `osx-64` instead of `osx-arm64` versions of libraries under \"The following NEW packages will be INSTALLED\".\n\n## Using Animated Drawings\n\n### Quick Start\nNow that everything's set up, let's animate some drawings! To get started, follow these steps:\n1. Open a terminal and activate the animated_drawings conda environment:\n````bash\n~ % conda activate animated_drawings\n````\n\n2. Ensure you're in the root directory of AnimatedDrawings:\n````bash\n(animated_drawings) ~ % cd {location of AnimatedDrawings on your computer}\n````\n\n3. Start up a Python interpreter:\n````bash\n(animated_drawings) AnimatedDrawings % python\n````\n\n4. Copy and paste the follow two lines into the interpreter:\n````python\nfrom animated_drawings import render\nrender.start('.\u002Fexamples\u002Fconfig\u002Fmvc\u002Finteractive_window_example.yaml')\n````\n\nIf everything is installed correctly, an interactive window should appear on your screen.\n(Use spacebar to pause\u002Funpause the scene, arrow keys to move back and forth in time, and q to close the screen.)\n\n\u003Cimg src='.\u002Fmedia\u002Finteractive_window_example.gif' width=\"256\" height=\"256\" \u002F> \u003C\u002Fbr>\u003C\u002Fbr>\u003C\u002Fbr>\n\nThere's a lot happening behind the scenes here. Characters, motions, scenes, and more are all controlled by configuration files, such as `interactive_window_example.yaml`. Below, we show how different effects can be achieved by varying the config files. You can learn more about the [config files here](examples\u002Fconfig\u002FREADME.md).\n\n### Export MP4 video\n\nSuppose you'd like to save the animation as a video file instead of viewing it directly in a window. Specify a different example config by copying these lines into the Python interpreter:\n\n````python\nfrom animated_drawings import render\nrender.start('.\u002Fexamples\u002Fconfig\u002Fmvc\u002Fexport_mp4_example.yaml')\n````\n\nInstead of an interactive window, the animation was saved to a file, video.mp4, located in the same directory as your script.\n\n\u003Cimg src='.\u002Fmedia\u002Fmp4_export_video.gif' width=\"256\" height=\"256\" \u002F> \u003C\u002Fbr>\u003C\u002Fbr>\u003C\u002Fbr>\n\n### Export transparent .gif\n\nPerhaps you'd like a transparent .gif instead of an .mp4? Copy these lines in the Python interpreter instead:\n\n````python\nfrom animated_drawings import render\nrender.start('.\u002Fexamples\u002Fconfig\u002Fmvc\u002Fexport_gif_example.yaml')\n````\n\nInstead of an interactive window, the animation was saved to a file, video.gif, located in the same directory as your script.\n\n\u003Cimg src='.\u002Fmedia\u002Fgif_export_video.gif' width=\"256\" height=\"256\" \u002F> \u003C\u002Fbr>\u003C\u002Fbr>\u003C\u002Fbr>\n\n### Headless Rendering\n\nIf you'd like to generate a video headlessly (e.g. on a remote server accessed via ssh), you'll need to specify `USE_MESA: True` within the `view` section of the config file.\n\n````yaml\n    view:\n      USE_MESA: True\n````\n\n### Animating Your Own Drawing\n\nAll of the examples above use drawings with pre-existing annotations.\nTo understand what we mean by *annotations* here, look at one of the 'pre-rigged' character's [annotation files](examples\u002Fcharacters\u002Fchar1\u002F).\nYou can use whatever process you'd like to create those annotations files and, as long as they are valid, AnimatedDrawings will give you an animation.\n\nSo you'd like to animate your own drawn character.\nI wouldn't want you to create those annotation files manually. That would be tedious.\nTo make it fast and easy, we've trained a drawn humanoid figure detector and pose estimator and provided scripts to automatically generate annotation files from the model predictions.\nThere are currently two options for setting this up.\n\n#### Option 1: Docker\nTo get it working, you'll need to set up a Docker container that runs TorchServe.\nThis allows us to quickly show your image to our machine learning models and receive their predictions.\n\nTo set up the container, follow these steps:\n\n1. [Install Docker Desktop](https:\u002F\u002Fdocs.docker.com\u002Fget-docker\u002F)\n2. Ensure Docker Desktop is running.\n3. Run the following commands, starting from the Animated Drawings root directory:\n\n````bash\n    (animated_drawings) AnimatedDrawings % cd torchserve\n\n    # build the docker image... this takes a while (~5-7 minutes on Macbook Pro 2021)\n    (animated_drawings) torchserve % docker build -t docker_torchserve .\n\n    # start the docker container and expose the necessary ports\n    (animated_drawings) torchserve % docker run -d --name docker_torchserve -p 8080:8080 -p 8081:8081 docker_torchserve\n````\n\nWait ~10 seconds, then ensure Docker and TorchServe are working by pinging the server:\n\n````bash\n    (animated_drawings) torchserve % curl http:\u002F\u002Flocalhost:8080\u002Fping\n\n    # should return:\n    # {\n    #   \"status\": \"Healthy\"\n    # }\n````\n\nIf, after waiting, the response is `curl: (52) Empty reply from server`, one of two things is likely happening.\n1. Torchserve hasn't finished initializing yet, so wait another 10 seconds and try again.\n2. Torchserve is failing because it doesn't have enough RAM.  Try [increasing the amount of memory available to your Docker containers](https:\u002F\u002Fdocs.docker.com\u002Fdesktop\u002Fsettings\u002Fmac\u002F#advanced) to 16GB by modifying Docker Desktop's settings.\n\nWith that set up, you can now go directly from image -> animation with a single command:\n\n````bash\n    (animated_drawings) torchserve % cd ..\u002Fexamples\n    (animated_drawings) examples % python image_to_animation.py drawings\u002Fgarlic.png garlic_out\n````\n\nAs you waited, the image located at `drawings\u002Fgarlic.png` was analyzed, the character detected, segmented, and rigged, and it was animated using BVH motion data from a human actor.\nThe resulting animation was saved as `.\u002Fgarlic_out\u002Fvideo.gif`.\n\n\u003Cimg src='.\u002Fexamples\u002Fdrawings\u002Fgarlic.png' height=\"256\" \u002F>\u003Cimg src='.\u002Fmedia\u002Fgarlic.gif' width=\"256\" height=\"256\" \u002F>\u003C\u002Fbr>\u003C\u002Fbr>\u003C\u002Fbr>\n\n#### Option 2: Running locally on macOS\n\nGetting Docker working can be complicated, and it's unnecessary if you just want to play around with this locally.\nContributer @Gravityrail kindly submitted a script that sets up Torchserve locally on MacOS, no Docker required.\n\n```bash\ncd torchserve\n.\u002Fsetup_macos.sh\ntorchserve --start --ts-config config.local.properties --foreground\n```\n\nWith torchserve running locally like this, you can use the same command as before to make the garlic dance:\n\n```bash \npython image_to_animation.py drawings\u002Fgarlic.png garlic_out\n```\n### Fixing bad predictions\nYou may notice that, when you ran `python image_to_animation.py drawings\u002Fgarlic.png garlic_out`, there were additional non-video files within `garlic_out`.\n`mask.png`, `texture.png`, and `char_cfg.yaml` contain annotation results of the image character analysis step. These annotations were created from our model predictions.\nIf the mask predictions are incorrect, you can edit the mask with an image editing program like Paint or Photoshop.\nIf the joint predictions are incorrect, you can run `python fix_annotations.py` to launch a web interface to visualize, correct, and update the annotations. Pass it the location of the folder containing incorrect joint predictions (here we use `garlic_out\u002F` as an example):\n\n````bash\n    (animated_drawings) examples % python fix_annotations.py garlic_out\u002F\n    ...\n     * Running on http:\u002F\u002F127.0.0.1:5050\n    Press CTRL+C to quit\n````\n\nNavigate to `http:\u002F\u002F127.0.0.1:5050` in your browser to access the web interface. Drag the joints into the appropriate positions, and hit `Submit` to save your edits.\n\nOnce you've modified the annotations, you can render an animation using them like so:\n\n````bash\n    # specify the folder where the fixed annoations are located\n    (animated_drawings) examples % python annotations_to_animation.py garlic_out\n````\n\n### Adding multiple characters to scene\nMultiple characters can be added to a video by specifying multiple entries within the config scene's 'ANIMATED_CHARACTERS' list.\nTo see for yourself, run the following commands from a Python interpreter within the AnimatedDrawings root directory:\n\n````python\nfrom animated_drawings import render\nrender.start('.\u002Fexamples\u002Fconfig\u002Fmvc\u002Fmultiple_characters_example.yaml')\n````\n\u003Cimg src='.\u002Fexamples\u002Fcharacters\u002Fchar1\u002Ftexture.png' height=\"256\" \u002F> \u003Cimg src='.\u002Fexamples\u002Fcharacters\u002Fchar2\u002Ftexture.png' height=\"256\" \u002F> \u003Cimg src='.\u002Fmedia\u002Fmultiple_characters_example.gif' height=\"256\" \u002F>\n\n### Adding a background image\nSuppose you'd like to add a background to the animation. You can do so by specifying the image path within the config.\nRun the following commands from a Python interpreter within the AnimatedDrawings root directory:\n\n````python\nfrom animated_drawings import render\nrender.start('.\u002Fexamples\u002Fconfig\u002Fmvc\u002Fbackground_example.yaml')\n````\n\n\u003Cimg src='.\u002Fexamples\u002Fcharacters\u002Fchar4\u002Ftexture.png' height=\"256\" \u002F> \u003Cimg src='.\u002Fexamples\u002Fcharacters\u002Fchar4\u002Fbackground.png' height=\"256\" \u002F> \u003Cimg src='.\u002Fmedia\u002Fbackground_example.gif' height=\"256\" \u002F>\n\n### Using BVH Files with Different Skeletons\nYou can use any motion clip you'd like, as long as it is in BVH format.\n\nIf the BVH's skeleton differs from the examples used in this project, you'll need to create a new motion config file and retarget config file.\nOnce you've done that, you should be good to go.\nThe following code and resulting clip uses a BVH with completely different skeleton.\nRun the following commands from a Python interpreter within the AnimatedDrawings root directory:\n\n````python\nfrom animated_drawings import render\nrender.start('.\u002Fexamples\u002Fconfig\u002Fmvc\u002Fdifferent_bvh_skeleton_example.yaml')\n````\n\n\u003Cimg src='.\u002Fmedia\u002Fdifferent_bvh_skeleton_example.gif' height=\"256\" \u002F>\n\n### Creating Your Own BVH Files\nYou may be wondering how you can create BVH files of your own.\nYou used to need a motion capture studio.\nBut now, thankfully, there are simple and accessible options for getting 3D motion data from a single RGB video.\nFor example, I created this Readme's banner animation by:\n1. Recording myself doing a silly dance with my phone's camera.\n2. Using [Rokoko](https:\u002F\u002Fwww.rokoko.com\u002F) to export a BVH from my video.\n3. Creating a new [motion config file](examples\u002Fconfig\u002FREADME.md#motion) and [retarget config file](examples\u002Fconfig\u002FREADME.md#retarget) to fit the skeleton exported by Rokoko.\n4. Using AnimatedDrawings to animate the characters and export a transparent animated gif.\n5. Combining the animated gif, original video, and original drawings in Adobe Premiere.\n\u003Cimg src='https:\u002F\u002Fuser-images.githubusercontent.com\u002F6675724\u002F219223438-2c93f9cb-d4b5-45e9-a433-149ed76affa6.gif' height=\"256\" \u002F>\n\nHere is an example of the configs I used apply my motion to a character. To use these config files, ensure that the Rokoko exports the BVH with the Mixamo skeleton preset:\n\n ````python\nfrom animated_drawings import render\nrender.start('.\u002Fexamples\u002Fconfig\u002Fmvc\u002Frokoko_motion_example.yaml')\n ````\n\nIt will show this in a new window:\n\n![Sequence 01](https:\u002F\u002Fuser-images.githubusercontent.com\u002F6675724\u002F233157474-1506d219-c085-49f9-a537-43d6c1bae93a.gif)\n\n\n\n\n### Adding Addition Character Skeletons\nAll of the example animations above depict \"human-like\" characters; they have two arms and two legs.\nOur method is primarily designed with these human-like characters in mind, and the provided pose estimation model assumes a human-like skeleton is present.\nBut you can manually specify a different skeletons within the `character config` and modify the specified `retarget config` to support it.\nIf you're interested, look at the configuration files specified in the two examples below.\n\n\n````python\nfrom animated_drawings import render\nrender.start('.\u002Fexamples\u002Fconfig\u002Fmvc\u002Fsix_arms_example.yaml')\n````\n\n\u003Cimg src='https:\u002F\u002Fuser-images.githubusercontent.com\u002F6675724\u002F223584962-925ee5aa-11de-47e5-ace2-a6d5940b34ae.png' height=\"256\" \u002F>\u003Cimg src='https:\u002F\u002Fuser-images.githubusercontent.com\u002F6675724\u002F223585000-dc8acf4e-974d-4cae-998b-94543f5f42c8.gif' width=\"256\" height=\"256\" \u002F>\u003C\u002Fbr>\u003C\u002Fbr>\u003C\u002Fbr>\n\n````python\nfrom animated_drawings import render\nrender.start('.\u002Fexamples\u002Fconfig\u002Fmvc\u002Ffour_legs_example.yaml')\n````\n\n\u003Cimg src='https:\u002F\u002Fuser-images.githubusercontent.com\u002F6675724\u002F223585033-f11e4e66-0443-405a-80e5-09b6aa0e335d.png' height=\"256\" \u002F>\u003Cimg src='https:\u002F\u002Fuser-images.githubusercontent.com\u002F6675724\u002F223585043-7ce9eac0-bb4c-4547-b038-c63ca2852ef2.gif' width=\"256\" height=\"256\" \u002F>\u003C\u002Fbr>\u003C\u002Fbr>\u003C\u002Fbr>\n\nIf you're interested in animating quadrupeds specifically, you may want to check out [the quadruped example directory](examples\u002Fquadruped).\n\n### Creating Your Own Config Files\nIf you want to create your own config files, see the [configuration file documentation](examples\u002Fconfig\u002FREADME.md).\n\n## Browser-Based Demo\n\nIf you'd like to animate a drawing of your own, but don't want to deal with downloading code and using the command line, check out our browser-based demo:\n\n[www.sketch.metademolab.com](https:\u002F\u002Fsketch.metademolab.com\u002F)\n\n## Paper & Citation\n If you find the resources in this repo helpful, please consider citing the accompanying paper, [A Method for Animating Children's Drawings of The Human Figure](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1145\u002F3592788)).\n\nCitation:\n\n```\n@article{10.1145\u002F3592788,\nauthor = {Smith, Harrison Jesse and Zheng, Qingyuan and Li, Yifei and Jain, Somya and Hodgins, Jessica K.},\ntitle = {A Method for Animating Children’s Drawings of the Human Figure},\nyear = {2023},\nissue_date = {June 2023},\npublisher = {Association for Computing Machinery},\naddress = {New York, NY, USA},\nvolume = {42},\nnumber = {3},\nissn = {0730-0301},\nurl = {https:\u002F\u002Fdoi.org\u002F10.1145\u002F3592788},\ndoi = {10.1145\u002F3592788},\nabstract = {Children’s drawings have a wonderful inventiveness, creativity, and variety to them. We present a system that automatically animates children’s drawings of the human figure, is robust to the variance inherent in these depictions, and is simple and straightforward enough for anyone to use. We demonstrate the value and broad appeal of our approach by building and releasing the Animated Drawings Demo, a freely available public website that has been used by millions of people around the world. We present a set of experiments exploring the amount of training data needed for fine-tuning, as well as a perceptual study demonstrating the appeal of a novel twisted perspective retargeting technique. Finally, we introduce the Amateur Drawings Dataset, a first-of-its-kind annotated dataset, collected via the public demo, containing over 178,000 amateur drawings and corresponding user-accepted character bounding boxes, segmentation masks, and joint location annotations.},\njournal = {ACM Trans. Graph.},\nmonth = {jun},\narticleno = {32},\nnumpages = {15},\nkeywords = {2D animation, motion retargeting, motion stylization, Skeletal animation}\n}\n```\n\n## Amateur Drawings Dataset\n\nTo obtain the Amateur Drawings Dataset, run the following two commands from the command line:\n\n````bash\n# download annotations (~275Mb)\nwget https:\u002F\u002Fdl.fbaipublicfiles.com\u002Famateur_drawings\u002Famateur_drawings_annotations.json\n\n# download images (~50Gb)\nwget https:\u002F\u002Fdl.fbaipublicfiles.com\u002Famateur_drawings\u002Famateur_drawings.tar\n````\n\nIf you'd like higher res images, they can be found on the releases (ad_orig_img_fs). They've been split into multiple chunks using the split cli. They are released under the same license as the original dataset. \n\nIf you have feedback about the dataset, please fill out [this form](https:\u002F\u002Fforms.gle\u002FkE66yskh9uhtLbFz9).\n\n## ChildlikeSHAPES\n\nIf you want this data set, construct the full archive from the chunks in the release page\n````cat datachunk_* > full_archive.7z  #(pw=An1m8dR3610Ns)````\n\n\n## Trained Model Weights\n\nTrained model weights for human-like figure detection and pose estimation are included in the [repo releases](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FAnimatedDrawings\u002Freleases). Model weights are released under [MIT license](https:\u002F\u002Fgithub.com\u002Ffacebookresearch\u002FAnimatedDrawings\u002Fblob\u002Fmain\u002FLICENSE). The .mar files were generated using the OpenMMLab framework ([OpenMMDet Apache 2.0 License](https:\u002F\u002Fgithub.com\u002Fopen-mmlab\u002Fmmdetection\u002Fblob\u002Fmain\u002FLICENSE), [OpenMMPose Apache 2.0 License](https:\u002F\u002Fgithub.com\u002Fopen-mmlab\u002Fmmpose\u002Fblob\u002Fmain\u002FLICENSE))\n\n## As-Rigid-As-Possible Shape Manipulation\n\nThese characters are deformed using [As-Rigid-As-Possible (ARAP) shape manipulation](https:\u002F\u002Fwww-ui.is.s.u-tokyo.ac.jp\u002F~takeo\u002Fpapers\u002Ftakeo_jgt09_arapFlattening.pdf).\nWe have a Python implementation of the algorithm, located [here](https:\u002F\u002Fgithub.com\u002Ffairinternal\u002FAnimatedDrawings\u002Fblob\u002Fmain\u002Fanimated_drawings\u002Fmodel\u002Farap.py), that might be of use to other developers.\n\n## License\nAnimated Drawings code, model weights, and Amateur Drawings dataset is released under the [MIT license](https:\u002F\u002Fgithub.com\u002Ffairinternal\u002FAnimatedDrawings\u002Fblob\u002Fmain\u002FLICENSE). ChildlikeSHAPES dataset is released under [CC-BY 4.0](https:\u002F\u002Fcreativecommons.org\u002Flicenses\u002Fby\u002F4.0\u002F) license. \n","AnimatedDrawings 是一个用于将儿童绘制的人体图形自动转化为动画的项目。该项目基于 Python 开发，实现了论文《A Method for Animating Children's Drawings of the Human Figure》中提出的算法，并提供了一个灵活的创意工具，让用户能够用自己的手绘角色创作动画。它支持 macOS 和 Ubuntu 系统，建议在 Conda 的虚拟环境中安装使用。此项目非常适合教育场景或个人创意项目，为非专业绘画者提供了一种简单易用的方式来探索动画制作的乐趣。","2026-06-11 03:35:05","high_star"]