Skip to main content

Easily create datasets for diffusion models personalization

Project description

self diffusion

selfdiffusion

License: MIT PyPI version Python Versions

selfdiffusion is a CLI tool that helps you prepare training datasets of portrait images for stable diffusion model fine tuning.

selfdiffusion takes as input images of different sizes and uses an empirical heuristic to extract the subject of the image and create a version of it that fits the native resolution of the model you want to fine-tune.

Getting started

install the CLI tool with pip:

pip install selfdiffusion

Usage

Start by assembling a set of images that contains the single subject you want to fine tune the model on. If you don't have such a dataset, we provide the utiliy bing command to download images from the internet into a target folder:

selfdiffusion bing "portrait of a person" --target /path/to/target/folder --limit 20

this will download 20 images of people from bing and store them in the /path/to/target/folder.

Once you have your starting images, extract portraits suitable for fine tuning with the following command:

# 512x512 is ideal for fine-tuning runwayml/stable-diffusion-v1-5
selfdiffusion person /path/to/input/images /path/to/output/images --resolution 512 512

you can find out more about model fine tuning in the exemples folder of the diffusers repository.

Notes

selfdiffusion will produce an output image for every input image given that:

  1. The input image as a resolution that is greater then the requested output resolution in both dimensions.

  2. There is a single person in your image, as determined by yolov8 and it's face is the only one in the image, as determined by face_recognition.

Sometimes, selfdiffusion will filter out an image that very evidently contains a single subject and it's face. If you absolutely want to have this image in your dataset, we suggest using a tool like Birme for capturing the subject and resizing to the native model resolution.

Author

Jonathan Pelletier.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

selfdiffusion-0.1.5.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

selfdiffusion-0.1.5-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file selfdiffusion-0.1.5.tar.gz.

File metadata

  • Download URL: selfdiffusion-0.1.5.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for selfdiffusion-0.1.5.tar.gz
Algorithm Hash digest
SHA256 ce116354ee5e5993b594ef0256ea2c61c7110ca7497bf2954d279b1f96390815
MD5 55276541627b9aeeb9e8f51cc209a95f
BLAKE2b-256 bc98c90f11576736f392194f88a86d2d71e5b8f8779e77144ea2d994b449c7ad

See more details on using hashes here.

File details

Details for the file selfdiffusion-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for selfdiffusion-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7096f3de77d4de0290b8b054d587442ed9525632683a1e3dca40d5ad33b4312e
MD5 1ccfe9f598e3c230908853e1c11987dc
BLAKE2b-256 c34e8965950718775ffda83d5c84c75138ae8f05d526d6c197e19300f4fcefdd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page