Image to Human Avatar
This project aims to automatically process photos of humans into animatable human avatars.
Specifically, we aim to detect the human in the image, position it to our standard positioning, and mask it.
| Source Image | Area of Interest | Cropped | Masked |
|---|---|---|---|
| High quality image of a human. Shoulder width $x$ | Area of interest in $2.5x$ shoulder width where the center is the neck | Image after cropping | Image after masking |
Real Examples
| Source Image | Avatar | Masked Avatar |
|---|---|---|
Conditions
- Input can be of any aspect ratio.
- There must be a human in the image (real or fictional).
- The human must be standing, with their arms down, facing the camera (TODO).
- The image must be safe-for-work.
- The creator of the avatar must have the right to use the image.
Usage
# cropping only (crop_image) — lightweight, no torch
pip install image-to-human-avatar
# full avatar pipeline (image_to_avatar): add the [mask] extra for background masking + pose
pip install "image-to-human-avatar[mask]"
To then process an image (requires the [mask] extra):
from human_avatar.image_to_avatar import image_to_avatar
from PIL import Image
image = Image.open("example.jpg")
cropped, masked, pose = image_to_avatar(image)
masked.save("masked.png")
Pass include_pose=False to skip the full-body pose extraction (much faster).
To only crop a person out of an image of any size, without the avatar quality conditions:
from human_avatar.image_to_avatar import crop_image
from PIL import Image
image = Image.open("example.jpg")
crop = crop_image(image, resolution=256) # 256x256 shoulder-centered crop
Web Server on Docker
docker build -t human-avatar .
docker run --rm -p 9874:8080 -e PORT=8080 \
-v $(pwd)/output:/mnt/output \
human-avatar
curl -X POST http://localhost:9874/ \
-F "output=gs://output/flux" \
-F "file=@assets/examples/flux/source.jpg"
Pass -F "pose=false" to skip writing the full-body pose.pose file (much faster).
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file image_to_human_avatar-0.2.4.tar.gz.
File metadata
- Download URL: image_to_human_avatar-0.2.4.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
66bfdcbe839882f5fb807730ad1ce706f99d83d8f8c19793375eac05f42fe609
|
|
| MD5 |
f7218e0877c8f84eb49e1f20cedbafc1
|
|
| BLAKE2b-256 |
43ea7fad161e642cf0dd61267f76a0ade18a81ce0c28e5027f9be81d99fdd453
|
File details
Details for the file image_to_human_avatar-0.2.4-py3-none-any.whl.
File metadata
- Download URL: image_to_human_avatar-0.2.4-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dec64915bee1ece42792f6d9f3c4e2c2d20389d2a98b8b08ac67733efdc1c2f9
|
|
| MD5 |
620e46bf69477edeb3b1718bbde351d0
|
|
| BLAKE2b-256 |
b461174dc05641c68e1979ff7c8c92f0032ac6b8ee99da155a7f32cd647bf403
|