How to Install and Use AnimatedDrawings: A Step-by-Step Guide ๐จ
Wednesday, Dec 18, 2024 | 8 minute read
Unleash your inner artist! This open-source project magically transforms children’s drawings into lively animations using deep learning. ๐ With user-friendly tools, customize characters and backgrounds, export as GIFs or videos, and spark creativity like never before! ๐โจ
“Every drawing holds the dreams of children, and AnimatedDrawings breathes limitless life into these dreams!” ๐
In this fast-paced digital era, children’s creativity is increasingly intertwined with technology. AnimatedDrawings, as a shining star, opens a new door for the perfect fusion of children’s drawings and animation. ๐ This open-source project not only allows kids to see their creations come to life but also inspires them to engage in more free and imaginative artistic expressions. ๐๐
1. The Magic of Animation: What is AnimatedDrawings? ๐จ
AnimatedDrawings is an extraordinary open-source project born from the innovative spirit of Facebook Research.โจ This project uses deep learning technology to transform childrenโs drawings into vibrant, dynamic animations. ๐ซ With user-friendly tools, anyone can spark their creativity and effortlessly animate the characters theyโve drawn, bringing paper art to life! ๐
2. Limitless Innovation: The Key Features That Set AnimatedDrawings Apart ๐
When it comes to features, AnimatedDrawings is nothing short of impressive! ๐ก The project offers a simple and user-friendly command-line startup, allowing every user to easily step into the world of creation. ๐ It enables users to generate multiple characters within the same scene, enriching the creative experience! ๐ Additionally, users can customize background images to give their animations a more personalized touch. ๐ Users can also upload motion data files, creating unique animated scenarios. ๐ฅ Once the animation is complete, it can be exported as a transparent GIF, making sharing and use incredibly simple! ๐ค
3. A Developer’s Choice: Why Choose AnimatedDrawings ๐ป
AnimatedDrawings boasts groundbreaking application potential across various fields, including animation production, game development, and education, stirring anticipation! ๐ The open-source dataset and convenient online demonstration platform make access and usage quick and straightforward. ๐ This project merges technology with art, showcasing endless creative possibilities and providing creators with unprecedented expressions and sources of inspiration! โจ
4. Project Details and Features ๐
AnimatedDrawings offers a simple operation process: just prepare sketches in advance or use different BVH files with configurations to create animations effortlessly. ๐๏ธ The core process involves converting the user’s sketches into key points within the animation and generating new hand-drawn images. โจ Users can also run the project using Docker or operate locally, flexibly choosing according to their needs. โ๏ธ
5. Demonstration and Dataset ๐
The project also introduces an amazing online demonstration platform, allowing users to experience its features directly without downloading the codeโeasily upload their drawings and generate animations! ๐ Additionally, the open-source Amateur Drawings dataset contains up to 180,000 labeled children’s drawings, providing a wealth of resources for research, development, and experimentation, making the creative journey vibrant and inspiring! ๐
6. Application Areas ๐
In the field of animation production, AnimatedDrawings can be used to create unique characters for animated films and TV shows, infusing vibrancy and fun into every scene! ๐ฌ In game development, it gives various game characters lively animation effects that make the gaming world even more enchanting and delightful. ๐ฎ Educators can also leverage this project to create engaging, animated educational videos and demonstrations that enhance teaching effectiveness, helping children enjoy the charm and joy of learning! ๐โจ
7. How to Install and Use AnimatedDrawings ๐
7.1 Installation Steps
For those eager to get started, first ensure that Conda is installed on your computer. Conda is an excellent environment management tool that makes managing Python dependencies and virtual environments a breeze. Letโs dive into how to install Animated Drawings:
-
Download and Install Conda: Visit here to download and install Conda. Once completed, open the terminal.
-
Create and Activate the Virtual Environment: Type the following command to name your virtual environment
animated_drawings
, specifying Python version 3.8.13:conda create --name animated_drawings python=3.8.13
- The
conda create
command sets up a new Conda environment. --name animated_drawings
specifies the environment’s name.python=3.8.13
sets the Python version.
Then, run the following command to activate the new environment:
conda activate animated_drawings
- The
-
Clone Animated Drawings: Use the Git command to clone the project from GitHub:
git clone https://github.com/facebookresearch/AnimatedDrawings.git
- The
git clone
command fetches the remote repository locally.
- The
-
Install Dependencies: Switch to the cloned project directory and install the project using pip:
cd AnimatedDrawings pip install -e .
cd AnimatedDrawings
takes you into the newly cloned project directory.pip install -e .
installs the project and its dependencies, working immediately with any code changes made, which facilitates debugging.
For Mac M1/M2 users, make sure to remove osx-64
from ~/.condarc
, only keeping osx-arm64
and noarch
for better compatibility.
7.2 Using Animated Drawings ๐จ
After installation, your exciting creative journey is about to begin! The following steps will guide you on how to use this powerful tool:
Quick Start ๐ฅ
-
Activate Your Environment:
conda activate animated_drawings
This command brings you back to the virtual environment, ensuring all operations take place within it.
-
Ensure You’re in the Root Directory:
cd {path_to_ANimatedDrawings}
Donโt forget to replace
{path_to_ANimatedDrawings}
with your local path to switch to the Animated Drawings root directory. -
Start the Python Interpreter:
python
After starting, youโll see the
>>>
prompt, indicating you can start entering Python code! -
Import the Rendering Module:
Copy and paste the following two lines of code into the interpreter:
from animated_drawings import render render.start('./examples/config/mvc/interactive_window_example.yaml')
from animated_drawings import render
imports the rendering module.render.start('./examples/config/mvc/interactive_window_example.yaml')
starts the animation and loads the specified configuration file. If all goes well, you should see an interactive window ready for your creativity! โจ
Export MP4 Video ๐น
To save your animation as a video file, simply run the following command:
from animated_drawings import render
render.start('./examples/config/mvc/export_mp4_example.yaml')
- This will start the animation and save it as a
video.mp4
file in the same directory as your script.
Export Transparent GIF ๐
If you wish to export your animation as a GIF format, you can use this command:
from animated_drawings import render
render.start('./examples/config/mvc/export_gif_example.yaml')
- This will generate a file named
video.gif
, ready for viewing and sharing anytime!
Headless Rendering ๐ฝ๏ธ
If you want to generate videos in headless mode, ensure the following content is in the view
section of the configuration file:
view:
USE_MESA: True
With this setting, the system can perform rendering even without a monitor.
Animate Your Drawings โ๏ธ
In the previous example, we used existing annotated drawings. You can also customize annotation files, and Animated Drawings will automatically generate animations for you.
Option 1: Using Docker ๐ณ
-
Install Docker Desktop: Ensure Docker is running.
-
Build the Docker Image: Run the following command in the Animated Drawings root directory:
cd torchserve docker build -t docker_torchserve .
docker build
creates a Docker image based on the Dockerfile, with-t docker_torchserve
naming the image.
-
Start the Docker Container:
docker run -d --name docker_torchserve -p 8080:8080 -p 8081:8081 docker_torchserve
docker run
starts the container and maps the ports to the local system.
To ensure Docker and TorchServe are functioning properly, verify using the following command:
curl http://localhost:8080/ping
If you receive curl: (52) Empty reply from server
, it could be due to two reasons:
- TorchServe is still initializing; wait a moment and try again.
- TorchServe has failed due to insufficient memory.
Once everything is set up, you can generate animations directly from images using the following command:
cd ../examples
python image_to_animation.py drawings/garlic.png garlic_out
Option 2: Run Locally on macOS ๐
If you prefer to operate locally instead of using Docker, follow these steps:
cd torchserve
./setup_macos.sh
torchserve --start --ts-config config.local.properties --foreground
Use the same command to generate animations:
python image_to_animation.py drawings/garlic.png garlic_out
Fixing Poor Annotations ๐ ๏ธ
If you notice any annotation issues, you can correct them using the following command:
python fix_annotations.py garlic_out/
Adding Multiple Characters in a Scene ๐ฅ
To include multiple characters in your animation, just add them to the ANIMATED_CHARACTERS
list in the configuration file like this:
from animated_drawings import render
render.start('./examples/config/mvc/multiple_characters_example.yaml')
Adding a Background Image ๐ผ๏ธ
To give your animation a background image, simply specify the path, as illustrated below:
from animated_drawings import render
render.start('./examples/config/mvc/background_example.yaml')
Using BVH Files with Different Skeletons ๐
If you want to use BVH files from different models, just create new motion configuration files and redefine the target configuration with the following command:
from animated_drawings import render
render.start('./examples/config/mvc/different_bvh_skeleton_example.yaml')
Creating Your Own BVH Files ๐๏ธ
You can extract 3D motion data from a single RGB video, using a configuration like this:
from animated_drawings import render
render.start('./examples/config/mvc/rokoko_motion_example.yaml')
Adding Extra Character Skeletons ๐ญ
You can specify different skeletons and adjust the target configuration as shown in the example code below:
from animated_drawings import render
render.start('./examples/config/mvc/six_arms_example.yaml')
from animated_drawings import render
render.start('./examples/config/mvc/four_legs_example.yaml')
Creating Your Custom Configuration File ๐
You can customize configuration files as needed, with a recommendation to refer to the Configuration File Documentation.
8. Browser Demonstration ๐
If you prefer not to download code and use the command line, head over to our online demo at www.sketch.metademolab.com. This moonlit starlight illuminates our shared dreams.
9. Amateur Drawings Dataset ๐ฆ
To access the Amateur Drawings dataset, you can run the following commands:
# Download annotations (~275Mb)
wget https://dl.fbaipublicfiles.com/amateur_drawings/amateur_drawings_annotations.json
# Download images (~50Gb)
wget https://dl.fbaipublicfiles.com/amateur_drawings/amateur_drawings.tar
Once everything is ready, you can dive into Animated Drawings and enjoy the endless fun of transforming your art into animations! โจ