How to Install and Use AnimatedDrawings: A Step-by-Step Guide ๐ŸŽจ

Wednesday, Dec 18, 2024 | 8 minute read

GitHub Trend
How to Install and Use AnimatedDrawings: A Step-by-Step Guide ๐ŸŽจ

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:

  1. Download and Install Conda: Visit here to download and install Conda. Once completed, open the terminal.

  2. 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
    
  3. 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.
  4. 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 ๐Ÿ”ฅ

  1. Activate Your Environment:

    conda activate animated_drawings
    

    This command brings you back to the virtual environment, ensuring all operations take place within it.

  2. 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.

  3. Start the Python Interpreter:

    python
    

    After starting, youโ€™ll see the >>> prompt, indicating you can start entering Python code!

  4. 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 ๐Ÿณ

  1. Install Docker Desktop: Ensure Docker is running.

  2. 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.
  3. 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:

  1. TorchServe is still initializing; wait a moment and try again.
  2. 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! โœจ

ยฉ 2024 - 2025 GitHub Trend

๐Ÿ“ˆ Fun Projects ๐Ÿ”