Skip to main content

Easily create datasets for diffusion models personalization

Project description

self diffusion

selfdiffusion

License: MIT 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.7.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: selfdiffusion-0.1.7.tar.gz
  • Upload date:
  • Size: 9.4 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.7.tar.gz
Algorithm Hash digest
SHA256 b48df439a8955d81467797f1530117ad372121918fb0a1577165a1a31d8c94ed
MD5 7e62cec449fa30ba1290c273b6f589e1
BLAKE2b-256 773c8af201815a754d43cddc19aeec8c0eb07e087f2c0bbfc1b7dff1cdb943f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: selfdiffusion-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for selfdiffusion-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8a45bfe67c0dfec92448b5408fbb6b59918938a0c56ae037bac954170e571749
MD5 edeb6246b944fe72ab5c522ab7ea541d
BLAKE2b-256 cde5a473d4f0b26d766ff45a415a9dbc9a85a1444b84a020f5ffbdf514d66f28

See more details on using hashes here.

Supported by

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