search

Found

info Overview

Paste image resolutions to see which SD 1.5 or SDXL bucket kohya-ss/sd-scripts assigns each image to, with counts, shares and a bar chart per bucket.

📘 How to Use

  1. Press SD 1.5 or SDXL to set the training resolution (512 or 1024).
  2. Set Minimum (min_bucket_reso), Maximum (max_bucket_reso) and Step (bucket_reso_steps) to your training settings (they start at the kohya-ss/sd-scripts defaults 256, 1024 and 64).
  3. Paste your list of image resolutions and read the image count and share for each bucket.
  4. Click the "Copy" button to get a text summary for your training logs.

SD1.5 / SDXL Bucket Distribution Checker

px
px
px

Same calculation as kohya-ss/sd-scripts without bucket_no_upscale. The bucket list is built from the resolution (512 for SD 1.5, 1024 for SDXL) and the three values above. Each image goes to the bucket of the same size if there is one, otherwise to the bucket whose aspect ratio (width ÷ height) differs least.

Enter resolutions to see results
Copied!
Article

AI Training Aspect Ratio Bucket Calculator | Optimize Your Stable Diffusion & LoRA Datasets

This tool helps AI artists and model trainers optimize their image datasets for training models like Stable Diffusion and LoRA. By pasting a list of image resolutions, you can see how they are distributed across the aspect ratio buckets kohya-ss/sd-scripts builds, helping you identify and correct imbalances for more efficient and effective training.

💡 Tool Overview

  • Distribution Analysis: Automatically parses your list of image resolutions and counts how many fall into each aspect ratio bucket.
  • SD 1.5 & SDXL Resolutions: The buttons set the training resolution (512 for Stable Diffusion 1.5, 1024 for SDXL). The bucket list is built from that resolution and the Minimum (min_bucket_reso), Maximum (max_bucket_reso) and Step (bucket_reso_steps) fields, with the same calculation as kohya-ss/sd-scripts.
  • Flexible Input Format: Accepts resolutions in various common formats, such as width,height, width x height, or width height, separated by newlines.
  • Same Matching as kohya-ss/sd-scripts: Each image goes to the bucket of the same size if there is one, otherwise to the bucket whose aspect ratio (width ÷ height) differs least, as kohya-ss/sd-scripts does without --bucket_no_upscale.
  • Copy-Ready Summary: Provides a clean, text-based summary of the distribution, perfect for pasting into training logs, documentation, or configuration files.

🧐 Frequently Asked Questions

Q. What is "bucketing" in AI image training?

A. Bucketing is the process of grouping images in a training dataset by their aspect ratio. This allows the training process to handle images of various dimensions without excessive cropping or stretching, which can distort features. By training on batches of similarly-shaped images, the model learns to understand composition more effectively, leading to better quality and more versatile image generation.

Q. Why is aspect ratio distribution important?

A. The distribution of aspect ratios in your dataset directly influences the model's biases. If your dataset is heavily skewed towards one bucket (e.g., 1:1 square images), the trained model will perform best when generating images at that ratio and may struggle with others. This tool helps you visualize that distribution, so you can decide whether to balance your dataset by adding or removing images to achieve the desired output capabilities.

Q. How does the tool choose the "best" bucket for a resolution?

A. It follows kohya-ss/sd-scripts without --bucket_no_upscale. If a bucket has exactly the same width and height as the image, the image goes there. Otherwise the tool calculates the aspect ratio (width / height) and picks the bucket whose ratio has the smallest absolute difference from it (abs(bucket ratio - image ratio), no logarithm); on a tie the bucket with the smaller width wins. With the SD 1.5 defaults (512, 256, 1024, 64), a 1920x1080 image goes to 640x384 and a 4000x1000 image goes to 1024x256. The list of buckets itself is not a fixed table: it is computed from the resolution and the three fields, which gives 17 buckets for SD 1.5 and 25 for SDXL with the defaults, and 41 for SDXL with a Maximum of 2048.

📚 Fun Facts about AI Training Bucketing

The specific resolutions used in standard bucketing presets, like those for SD1.5 and SDXL, aren't arbitrary. They are carefully chosen to meet several criteria. First, their total pixel count is kept close to the model's native training resolution (e.g., 512x512 or 1024x1024). Second, both the width and height are typically multiples of 64 or 32. This is because the underlying neural network architecture, particularly the U-Net, processes image features in downsampling and upsampling stages, and dimensions that are cleanly divisible by these numbers prevent artifacts and ensure computational efficiency.