title: The Arrival of Magic Pen Malang - Recording the Installation and Usage of AnimatedDrawings
date: 2023-04-25 20:16:01
tags: [AI, Meta]#
Introduction#
AnimatedDrawings is a tool used to animate hand-drawn graphics. The following will introduce how to install and use this tool.
Main Content#
1. How to Install and Use AnimatedDrawings#
Installation Steps
-
Install Miniconda
Before installing AnimatedDrawings, you need to install Miniconda or Anaconda. You can download and install it according to the instructions on the official website. -
Create a Virtual Environment and Install AnimatedDrawings
Execute the following commands in the terminal:
conda create --name animated_drawings python=3.8.13
conda activate animated_drawings
git clone https://github.com/facebookresearch/AnimatedDrawings.git
cd AnimatedDrawings
pip install -e .
Usage Steps
- Run the Python Interpreter
Execute the following command in the terminal:
python
- Import AnimatedDrawings
Execute the following command in the Python interpreter:
from animated_drawings import render
- Generate Animation
render.start('./examples/config/mvc/interactive_window_example.yaml')
Other Features
- Generate MP4 Video
render.start('./examples/config/mvc/export_mp4_example.yaml')
- Export GIF with Transparent Background
render.start('./examples/config/mvc/export_gif_alpha_example.yaml')
2. How to Make Tasks in Your Hand-Drawn Paintings Come to Life#
To make the annotations information for the characters, follow these steps:
Using TorchServe can help generate animations, and Docker containers are required to run it:
git clone https://github.com/facebookresearch/AnimatedDrawings.git
cd AnimatedDrawings
cd torchserve
docker build -t docker_torchserve .
docker run -d --name docker_torchserve -p 8080:8080 -p 8081:8081 docker_torchserve
This will start a Docker container for generating pose estimation files for hand-drawn graphics.
To create animation effects based on the generated pose estimation files, use the following one-line command:
cd ../examples && python image_to_animation.py drawings/jerry.png jerry_out
If the pose estimation is incorrect, you can run python fix_annotations.py
to start a web interface for manually modifying the annotations in a visual way. After updating, execute python annotations_to_animation.py jerry_out
.
So far, it has been about creating animations for a humanoid object. If there are multiple objects and you want to add different backgrounds or draw a giant monster with several tentacles, don't worry, the project provides relevant configuration files in the directory examples/config/mvc
, which can be modified according to the configuration files.
3. How to Customize Different Action Effects#
To create a BVH file, follow these basic steps:
- Record yourself dancing with your hands and feet using a camera.
- Use Rokoko to export BVH from the recorded video (requires wearing equipment to capture motion and posture).
- Create a new motion config file and retarget config file to fit the skeleton exported by Rokoko.
- Use AnimatedDrawings to create animation effects for hand-drawn graphics.
The command to create an example project is as follows:
from animated_drawings import render
render.start('./examples/config/mvc/rokoko_motion_example.yaml')
4. Conclusion#
AnimatedDrawings is a very interesting and practical tool, just like the magic pen Malang, giving life to characters and animals drawn with a pen.
Finally#
References#
Official AnimatedDrawings Project
Disclaimer#
This article is only for personal research and learning purposes.
This article is synchronized with HBlog.