kohya-ss / sd-scripts

Apache License 2.0
5.33k stars 881 forks source link

Compute aspect ratios in log-space #1741

Open catboxanon opened 1 month ago

catboxanon commented 1 month ago

Updates aspect ratio bucketing to align with NovelAI's implementation. See their GitHub repo and paper (specifically footnote [2]) for reference.

https://github.com/NovelAI/novelai-aspect-ratio-bucketing/commits/main/?since=2024-09-25&until=2024-09-25 https://arxiv.org/abs/2409.15997

[2] aspect ratios compared in log-space have the desirable property that a 1:1 aspect ratio can be equidistant from buckets 2:1 and 1:2, each of which fit an equal proportion of its area.